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



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

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

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

$ scalac -Ydelambdafy:method test.scala

按预期运行。是否有一种方法可以使SBT显示它发出的确切scalac命令?(注意,将确切的标志从scalacOptions传递到scalac也不会导致错误)。

scalacOptions is:

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主库的scalajs-library子项目,当前Scala主库的构建为scalaHome

要为此构建配置项目,发出:

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

问题是:sbt实际上并不调用"scalac"。它直接调用编译器,创建并调用适当的类。

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

export compile

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

我认为你需要的是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

相关内容

  • 没有找到相关文章

最新更新