I have a library that needs two different versions of "com.thesamet.scalapb" %% "compilerplugin"
depending on the Scala version.
In my project/scalapb.sbt
I have this code:
def scalapbVersion(version:String): String =
if(version == "2.11") {
println(s">>>>>>>> Using 0.9.7 to fix 2.11 compat. ${version}")
"0.9.7"
} else {
println(s">>>>>>>> Using last version. ${version}")
"0.10.2"
}
libraryDependencies += "com.thesamet.scalapb" %% "compilerplugin" % scalapbVersion(scalaBinaryVersion.value)
Executing sbt clean "++2.11.12 compile
I get >>>>>>>> Using lastest version. 2.12
but in the logs, also, I can see that the cross-build plugin changes the version to Scala 2.11 after the previous message:
[info] Setting Scala version to 2.11.12 on 13 projects.
[info] Excluded 1 projects, run ++ 2.11.12 -v for more details.
So I suppose that the order is:
- sbt load plugins configuration with the default Scala version.
- cross-build changes the scala version
How to integrate sbt-protoc
with sbt cross-build?