Use project axes when not auto scala lib (#86)

* add test that should fail for module not found
* Use axisValues when !autoScalaLibrary

---------

Co-authored-by: Miguel Villa <miguel.villa@siriusxm.com>
This commit is contained in:
Miguel Vilá 2023-12-29 09:45:39 -05:00 committed by GitHub
parent 7181625be7
commit 506e9ddd86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 56 additions and 1 deletions

View File

@ -499,7 +499,7 @@ object ProjectMatrix {
acc.customRow(autoScalaLibrary, axisValues ++ Seq(VirtualAxis.scalaABIVersion(sv)), process)
}
} else {
customRow(autoScalaLibrary, Seq(VirtualAxis.jvm), process)
customRow(autoScalaLibrary, axisValues ++ Seq(VirtualAxis.jvm), process)
}
override def customRow(

View File

@ -0,0 +1,46 @@
import sbt.internal.ProjectMatrix
ThisBuild / organization := "com.example"
ThisBuild / version := "0.1.0-SNAPSHOT"
ThisBuild / publishMavenStyle := true
ThisBuild / ivyPaths := {
val base = (ThisBuild / baseDirectory).value
IvyPaths(base, Some(base / "ivy-cache"))
}
publish / skip := true
lazy val scala212 = "2.12.10"
lazy val check = taskKey[Unit]("")
lazy val config12 = ConfigAxis("Config1_2", "-config1.2")
lazy val config13 = ConfigAxis("Config1_3", "-config1.3")
check := {
val app12 = app.finder(config12).apply(autoScalaLibrary = false)
assert(app12.id == "appConfig1_2", s"app12.id is ${app12.id}")
val app13 = app.finder(config13).apply(autoScalaLibrary = false)
assert(app13.id == "appConfig1_3", s"app13.id is ${app13.id}")
}
lazy val app: ProjectMatrix = (projectMatrix in file("app"))
.settings(
name := "app",
ivyPaths := (ThisBuild / ivyPaths).value
)
.customRow(
autoScalaLibrary = false,
scalaVersions = Seq(scala212),
axisValues = Seq(config12, VirtualAxis.jvm),
_.settings(
libraryDependencies += "com.typesafe" % "config" % "1.2.1"
)
)
.customRow(
autoScalaLibrary = false,
scalaVersions = Seq(scala212),
axisValues = Seq(config13, VirtualAxis.jvm),
_.settings(
libraryDependencies += "com.typesafe" % "config" % "1.3.3"
)
)

View File

@ -0,0 +1,3 @@
import sbt._
case class ConfigAxis(idSuffix: String, directorySuffix: String) extends VirtualAxis.WeakAxis

View File

@ -0,0 +1,5 @@
sys.props.get("plugin.version") match {
case Some(x) => addSbtPlugin("com.eed3si9n" % "sbt-projectmatrix" % x)
case _ => sys.error("""|The system property 'plugin.version' is not defined.
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin)
}

View File

@ -0,0 +1 @@
> check