sbt-projectmatrix
sbt-projectmatrix copied to clipboard
Compile / unmanagedSourceDirectories not working anymore when using projectMatrix
I tried to use sbt-projectmatrix today but got into an issue with my generated source files. i.e.
lazy val ls = projectMatrix
.jvmPlatform(scalaVersions = Seq(scala3Version))
.settings(
Compile / unmanagedSourceDirectories += baseDirectory.value / "src" / "main" / "generated"
)
When I was using project, the generated folder was correctly seen as a src directory and scala files were compiling. When using projectMatrix, the generated folder is not seen as a source directory (when running with sbt and also in IntelliJ after reimporting)
@kostaskougios I believe this is because projectmatrix hijacks the baseDirectory value and sets it to
.sbt/matrix/<module-name>
I think in your case you can use sourceDirectory.value which the plugin keeps sane: https://github.com/sbt/sbt-projectmatrix/blob/develop/src/main/scala/sbt/internal/ProjectMatrix.scala#L269