sbt / sbt-projectmatrix

MIT License
124 stars 14 forks source link

Compile / unmanagedSourceDirectories not working anymore when using projectMatrix #83

Open kostaskougios opened 1 year ago

kostaskougios commented 1 year ago

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)

keynmol commented 1 year ago

@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