显示从SBT构建发出的精确scala命令

时间:2014-03-14 09:52:12

标签: sbt scalac

当我针对本地版本的Scala构建我的(相对复杂的)SBT项目时,我收到以下错误:

scalac error: bad option: '-Ydelambdafy:method'

这可能是scalac或我们的构建文件中的错误。但是,我无法在直接调用scalac时重现此错误:

$ scalac -Ydelambdafy:method test.scala

这按预期运行。有没有办法让SBT显示它发出的确切scalac命令? (请注意,将确切的标记从scalacOptions传递到scalac也不会导致错误。)

scalacOptions是:

List(
  -deprecation,
  -unchecked,
  -feature,
  -encoding, utf8,
  -Ydelambdafy:method,
  -Xplugin:<...>/scala-js-test/compiler/target/scala-2.11.0-RC1/scalajs-compiler_2.11.0-RC1-0.4.1-SNAPSHOT.jar)`
)

相关资料库是Scala.js masterscalajs-library子项目,其中Scala master的版本为scalaHome

要为此版本配置项目,请发出:

set every List(scalaHome := Some(file("<scalaHome>")), scalaVersion := "2.11.0-RC1")

在根项目中。

2 个答案:

答案 0 :(得分:3)

我认为您需要的是debug然后是compile

[sbt-0-13-2]> help debug
debug

    Sets the global logging level to debug.
    This will be used as the default level for logging from commands, settings, and tasks.
    Any explicit `logLevel` configuration in a project overrides this setting.

--debug

    Sets the global logging level as described above, but does so before any other commands are executed on startup, including project loading.
    This is useful as a startup option:
        * it takes effect before any logging occurs
        * if no other commands are passed, interactive mode is still entered

[sbt-0-13-2]> debug
[debug] > shell
[sbt-0-13-2]> compile
[debug] > compile
[debug] Evaluating tasks: compile:compile
[debug] Running task... Cancelable: false, check cycles: false
...
[debug] Running cached compiler 3d61bf70, interfacing (CompilerInterface) with Scala compiler version 2.10.4-RC1
[debug] Calling Scala compiler with arguments  (CompilerInterface):
[debug]     -bootclasspath
[debug]     /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/sunrsasign.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/classes:/Users/jacek/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-2.10.4-RC1.jar
[debug]     -classpath
[debug]     /Users/jacek/sandbox/so/sbt-0.13.2/target/scala-2.10/classes
[debug] Scala compilation took 77.142708 s

答案 1 :(得分:3)

嗯,这就是事情:sbt实际上并没有打电话给&#34; scalac&#34;。它直接调用编译器,创建并调用正确的类。

但是,如果您使用的是SBT 0.13+,那么如果直接运行它,您可以得到它 运行的近似值,但是这样做:

export compile

export命令也适用于其他一些任务,但无论如何都不适用于所有任务。

相关问题