Skip to content

Commit

Permalink
Backport Scala 3.x-2.13 sandwich fix
Browse files Browse the repository at this point in the history
  • Loading branch information
eed3si9n committed Nov 23, 2024
1 parent 3fa61c0 commit 83277ca
Show file tree
Hide file tree
Showing 16 changed files with 15 additions and 114 deletions.
1 change: 1 addition & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ lazy val root = (project in file("."))
.settings(
name := "sbt-projectmatrix",
pluginCrossBuild / sbtVersion := "1.2.8",
scriptedSbt := "1.9.6",
scalacOptions := Seq("-deprecation", "-unchecked"),
scriptedLaunchOpts := { scriptedLaunchOpts.value ++
Seq("-Xmx1024M", "-Dplugin.version=" + version.value)
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/sbt/VirtualAxis.scala
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ object VirtualAxis {

private[sbt] def isScala2Scala3Sandwich(sbv1: String, sbv2: String): Boolean = {
def compare(a: String, b: String): Boolean =
a == "2.13" && (b.startsWith("0.") || b.startsWith("3."))
a == "2.13" && (b == "3" || b.startsWith("3."))
compare(sbv1, sbv2) || compare(sbv2, sbv1)
}

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

57 changes: 0 additions & 57 deletions src/sbt-test/projectMatrix/jvm-sandwich-sbt-1.3/build.sbt

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

7 changes: 0 additions & 7 deletions src/sbt-test/projectMatrix/jvm-sandwich-sbt-1.3/test

This file was deleted.

21 changes: 12 additions & 9 deletions src/sbt-test/projectMatrix/jvm-sandwich/build.sbt
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
lazy val check = taskKey[Unit]("")
lazy val scala3M1 = "3.0.0-M1"
lazy val scala3M2 = "3.0.0-M2"
lazy val scala213 = "2.13.4"
lazy val scala3 = "3.5.2"
lazy val scala213 = "2.13.14"

lazy val fooApp = (projectMatrix in file("foo-app"))
.dependsOn(fooCore)
.settings(
name := "foo app",
)
.jvmPlatform(scalaVersions = Seq(scala3M1, scala3M2))
.jvmPlatform(scalaVersions = Seq(scala3))

lazy val fooApp3 = fooApp.jvm(scala3)
.settings(
test := { () },
)

lazy val fooCore = (projectMatrix in file("foo-core"))
.settings(
name := "foo core",
)
.jvmPlatform(scalaVersions = Seq(scala213, "2.12.12"))
.jvmPlatform(scalaVersions = Seq(scala213, "2.12.18"))

lazy val barApp = (projectMatrix in file("bar-app"))
.dependsOn(barCore)
Expand All @@ -27,7 +31,7 @@ lazy val barCore = (projectMatrix in file("bar-core"))
.settings(
name := "bar core",
)
.jvmPlatform(scalaVersions = Seq(scala3M1))
.jvmPlatform(scalaVersions = Seq(scala3))

// choose 2.13 when bazCore offers both 2.13 and Dotty
lazy val bazApp = (projectMatrix in file("baz-app"))
Expand All @@ -38,10 +42,9 @@ lazy val bazApp = (projectMatrix in file("baz-app"))
val cp = (Compile / fullClasspath).value
.map(_.data.getName)

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"))
assert(!cp.contains("baz-core_3-0.1.0-SNAPSHOT.jar"), s"$cp")
},
)
.jvmPlatform(scalaVersions = Seq(scala213))
Expand All @@ -51,4 +54,4 @@ lazy val bazCore = (projectMatrix in file("baz-core"))
name := "baz core",
exportJars := true,
)
.jvmPlatform(scalaVersions = Seq(scala213, scala3M1, scala3M2))
.jvmPlatform(scalaVersions = Seq(scala213, scala3))

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ sys.props.get("plugin.version") match {
case _ => sys.error("""|The system property 'plugin.version' is not defined.
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin)
}
addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.4.5")
2 changes: 1 addition & 1 deletion src/sbt-test/projectMatrix/jvm-sandwich/test
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
> projects

> fooApp3_0_0_M1/compile
> fooApp3/compile

> barApp/compile

Expand Down

0 comments on commit 83277ca

Please sign in to comment.