When I build my (relatively complex) SBT project against a local version of Scala, I am getting the following error:
scalac error: bad option: '-Ydelambdafy:method'
This is potentially a bug in scalac
or our buildfile. However, I am unable to reproduce this error while invoking scalac
directly:
$ scalac -Ydelambdafy:method test.scala
This runs as expected. Is there a way I can make SBT display the exact scalac
command it issues? (Note that passing the exact flags from scalacOptions
to scalac
also does not result in the error).
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)`
)
The repository in question is the scalajs-library
subproject of the Scala.js master with a build of the current Scala master as scalaHome
.
To configure the project for this build, issue:
set every List(scalaHome := Some(file("<scalaHome>")), scalaVersion := "2.11.0-RC1")
in the root project.
Well, here's the thing: sbt doesn't actually call "scalac". It invokes the compiler directly, creating and calling the proper class.
However, if you are using SBT 0.13+, you can get an approximation of what it would have run if it did run it directly, but doing this:
export compile
The export
command also work for some other tasks, but not, by any means, all of them.
I think what you need is debug
and then 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