1
votes

I know there is scalacOptions in sbt. But options add via addCompilerPlugin does not exists in scalacOptions.

I type show scalacOptions in sbt console and there is nothing like -Xplugin.

So how can I get real scalac options when I am writing an sbt plugin

My sbt info

> libraryDependencies
[info] List(org.scala-lang:scala-library:2.10.4, org.scala-lang:scala-reflect:2.10.4, io.netty:netty:3.9.0.Final, net.sandrogrzicic:scalabuff-runtime:1.3.7, org.scalamacros:quasiquotes:2.0.0, org.specs2:specs2:2.3.11:test, org.scalamacros:paradise:2.0.0:plugin->default(compile))
> show scalacOptions
[info] List(-feature, -deprecation, -language:implicitConversions, -language:dynamics)
[success] Total time: 0 s, completed Jul 3, 2014 4:04:09 PM
> version
[info] 0.0.1-SNAPSHOT
> sbt
sbtBinaryVersion    sbtClearOnFailure   sbtDependency       sbtPlugin           sbtPopOnFailure     sbtResolver         sbtStashOnFailure   
> sbtVersion
[info] 0.13.5
> 

my build.sbt

libraryDependencies ++= Seq(
  "org.scala-lang" % "scala-reflect" % "2.10.4",
  "io.netty" % "netty" % "3.9.0.Final",
  "net.sandrogrzicic" %% "scalabuff-runtime" % "1.3.7",
  "org.scalamacros" %% "quasiquotes" % "2.0.0",
  "org.specs2" %% "specs2" % "2.3.11" % "test")

scalacOptions ++= Seq(
  "-feature",
  "-deprecation",
  "-language:implicitConversions",
  "-language:dynamics"
)

parallelExecution in Test := false

addCompilerPlugin("org.scalamacros" % "paradise" % "2.0.0" cross CrossVersion.full)
2
I glad to see that I'm not the only one who get bunch of troubles with sbt. It just have no documentation, so make git clone of the project and try to track source code inside ./main/src/main/scala/sbt/Defaults.scalaayvango

2 Answers

1
votes

Finally I found compile:scalacOptions actually contains the plugin settings

0
votes

Are you sure that you have actually managed to add the compiler plugin?

With sbt 0.13.5 and an empty project with this in build.sbt:

addCompilerPlugin("org.scala-lang.plugins" % "continuations" % "2.10.1")

I get the plugin in both libraryDependencies and scalacOptions:

> libraryDependencies
[info] List(org.scala-lang:scala-library:2.10.4, org.scala-lang.plugins:continuations:2.10.1:plugin->default(compile))
> show scalacOptions
[info] List(-Xplugin:/Users/johan/.ivy2/cache/org.scala-lang.plugins/continuations/jars/continuations-2.10.1.jar)