sbt / sbt-projectmatrix

MIT License
124 stars 14 forks source link

Support for mixed-style matrix dependencies #13

Closed rtimush closed 5 years ago

rtimush commented 5 years ago

If I understand correctly, at the moment if one project depends on another they should use the same suffix ids. This makes the following scenario impossible:

lazy val core = (projectMatrix in file("core"))
  .jvmPlatform(scalaVersions = Seq("2.12.8", "2.11.12"))

lazy val coreConfigIntegration = (projectMatrix in file("config"))
  .dependsOn(core)
  .crossLibrary(
    scalaVersions = Seq("2.12.8", "2.11.12"),
    suffix = "Config1.2",
    settings = Seq(libraryDependencies += "com.typesafe" % "config" % "1.2.1")
  )
  .crossLibrary(
    scalaVersions = Seq("2.12.8"),
    suffix = "Config1.3",
    settings = Seq(libraryDependencies += "com.typesafe" % "config" % "1.3.3")
  )

The core project is cross-build for different scala versions, and the coreConfigIntegration project should use the matching scala version. It would be nice if this was supported.

eed3si9n commented 5 years ago

Maybe we can provide a flavor of .dependOn(...) that can specify a specific row/platform.

rtimush commented 5 years ago

For now, I found a verbose workaround to specify dependencies on the generated subprojects:

lazy val coreConfigIntegration12_212 = coreConfigIntegration.crossLib("Config1.2")("2.12.8").dependsOn(core.jvm("2.12.8")
lazy val coreConfigIntegration12_211 = coreConfigIntegration.crossLib("Config1.2")("2.11.12").dependsOn(core.jvm("2.11.12")
...

I remember in some other cross-building plugin there was a concept of cross-building "axes". With this concept dependsOn could select a dependency that has a matching subset of axes (like here coreConfigIntegration has a "platform" and a "config" axes, and the core project has only "platform").

eed3si9n commented 5 years ago

It would be interesting to explore that concept.