Add `projectMatrixBaseDirectory` setting

Similar to https://github.com/portable-scala/sbt-crossproject/pull/152
This commit is contained in:
Hugo van Rijswijk 2024-02-05 09:48:17 +01:00
parent 506e9ddd86
commit 7f30c1e0dc
5 changed files with 7 additions and 1 deletions

View File

@ -270,7 +270,8 @@ object ProjectMatrix {
inConfig(Compile)(makeSources(nonScalaDirSuffix, svDirSuffix)),
inConfig(Test)(makeSources(nonScalaDirSuffix, svDirSuffix)),
projectDependencies := projectDependenciesTask.value,
ProjectMatrixKeys.virtualAxes := axes
ProjectMatrixKeys.virtualAxes := axes,
ProjectMatrixKeys.projectMatrixBaseDirectory := base,
)
.settings(self.settings)
.configure(transforms: _*)

View File

@ -7,6 +7,7 @@ import scala.language.experimental.macros
trait ProjectMatrixKeys {
val virtualAxes = settingKey[Seq[VirtualAxis]]("Virtual axes for the project")
val projectMatrixBaseDirectory = settingKey[File]("Base directory of the current project matrix")
}
object ProjectMatrixKeys extends ProjectMatrixKeys

View File

@ -41,6 +41,7 @@ lazy val bazApp = (projectMatrix in file("baz-app"))
streams.value.log.info(cp.toString)
assert(cp.contains("baz-core_2.13-0.1.0-SNAPSHOT.jar"), s"$cp")
assert(!cp.contains("baz-core_3.0.0-M1-0.1.0-SNAPSHOT.jar"), s"$cp")
assert(projectMatrixBaseDirectory.value == file("baz-app"))
},
)
.jvmPlatform(scalaVersions = Seq(scala213))

View File

@ -19,6 +19,7 @@ lazy val core = (projectMatrix in file("core"))
.settings(
check := {
assert(moduleName.value == "core", s"moduleName is ${moduleName.value}")
assert(projectMatrixBaseDirectory.value == file("core"))
},
)
.jvmPlatform(scalaVersions = Seq(scala213, scala212))
@ -27,6 +28,7 @@ lazy val intf = (projectMatrix in file("intf"))
.settings(
check := {
assert(moduleName.value == "intf", s"moduleName is ${moduleName.value}")
assert(projectMatrixBaseDirectory.value == file("intf"))
},
)
.jvmPlatform(autoScalaLibrary = false)

View File

@ -15,6 +15,7 @@ lazy val core = (projectMatrix in file("core"))
.settings(
check := {
assert(platformTest.value.endsWith("-platform"))
assert(projectMatrixBaseDirectory.value == file("core"))
},
)
.jvmPlatform(scalaVersions = Seq(scala213, scala212))