I am using sbt cross build my project supports two scala versions scala-2.12.8
and scala-2.13.1
and accrodingly i have source code directoroes as
src/main/scala_2.12
src/main/test_2.12
src/main/scala_2.13
src/main/test_2.13
i looked at the sbt documentation its not clear from it then i found this answer here is my code
unmanagedSourceDirectories in Compile <+= (scalaVersion, sourceDirectory in Compile) {
case (v, dir) if v startsWith "2.12" => dir / "scala_2.12"
case (v, dir) if v startsWith "2.13" => dir / "scala"
}
and am getting the following error
info] Loading project definition from /home/git/testproj/project
/home/git/testproj/build.sbt:54: error: (sbt.SettingKey[String], sbt.SettingKey[java.io.File]) does not take parameters
unmanagedSourceDirectories in Compile <+= (scalaVersion, sourceDirectory in Compile) {
^
[error] Type error in expression
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore?
It's build-in in sbt since 0.13.something for cross compilation:
And for any configuration you created (e.g.
it
,functional-test
, or whatever you name it) it will be:This was described in documentation in Scala-version specific source directory section.