sbt / sbt-projectmatrix

MIT License
124 stars 14 forks source link

Misleading compilation errors when using no root src folder #81

Open struong opened 1 year ago

struong commented 1 year ago

I am trying out projectmatrix for a CE2->CE3 upgrade. When the src folder is under root sbt-projectmatrix will fail to compile.

To reproduce: Clone https://github.com/lrodero/cats-effect-tutorial, add the plugin: addSbtPlugin("com.eed3si9n" % "sbt-projectmatrix" % "0.9.0")

Change build.sbt to:

val scala213 = "2.13.5"
val scala212 = "2.12.12"
val supportedScalaVersions = Seq(scala212, scala213)

lazy val main =
  projectMatrix
    .in(file("."))
    .configs(IntegrationTest)
    .settings(libraryDependencies += "org.typelevel" %% "cats-effect" % "2.2.0")
    .jvmPlatform(scalaVersions = supportedScalaVersions)

sbt clean compile will result in:

[error] 100 errors found
[warn] there were 35 feature warnings; re-run with -feature for details
[warn] one warning found
[error] (Compile / compileIncremental) Compilation failed

Oddly you can run the compile steps individually and they will work:

main / compile -> works
main2_12 / Compile / compile -> works
Compile / compileIncremental -> breaks

The workaround is easy enough, I just moved the src folder into another directory e.g. app and changes the build.sbt with:

  projectMatrix
    .in(file("app"))
tarmath commented 9 months ago

Thank you for your report.

I just ran into this myself and was pretty confused for a while, and after finding this and moving the sources everything worked great...