mirror of https://github.com/sbt/sbt.git
Port fix for sandwich and Scala.JS
Ref https://github.com/sbt/sbt/pull/5984
This commit is contained in:
parent
e373bfc3cc
commit
cb72b1e9f1
|
|
@ -280,34 +280,22 @@ object ProjectMatrix {
|
|||
val ref = thisProjectRef.value
|
||||
val data = settingsData.value
|
||||
val deps = buildDependencies.value
|
||||
val sbtV = VersionNumber(sbtVersion.value)
|
||||
|
||||
if (sbtV._1.getOrElse(0L) == 1 && (sbtV._2.getOrElse(0L) < 4)) {
|
||||
deps.classpath(ref) flatMap { dep =>
|
||||
val depProjIdOpt = (dep.project / projectID).get(data)
|
||||
val depSVOpt = (dep.project / scalaVersion).get(data)
|
||||
val depSBVOpt = (dep.project / scalaBinaryVersion).get(data)
|
||||
val depCrossOpt = (dep.project / crossVersion).get(data)
|
||||
(depProjIdOpt, depSVOpt, depSBVOpt, depCrossOpt) match {
|
||||
case (Some(depProjId), Some(depSV), Some(depSBV), Some(depCross)) =>
|
||||
if (sbv == depSBV || depCross != CrossVersion.binary)
|
||||
Some(
|
||||
depProjId.withConfigurations(dep.configuration)
|
||||
.withExplicitArtifacts(Vector.empty)
|
||||
)
|
||||
else if (VirtualAxis.isScala2Scala3Sandwich(sbv, depSBV) && depCross == CrossVersion.binary)
|
||||
Some(
|
||||
depProjId
|
||||
.withCrossVersion(CrossVersion.constant(depSBV))
|
||||
.withConfigurations(dep.configuration)
|
||||
.withExplicitArtifacts(Vector.empty)
|
||||
)
|
||||
else sys.error(s"scalaBinaryVersion mismatch: expected $sbv but found ${depSBV} in $depProjId")
|
||||
case _ => None
|
||||
deps.classpath(ref) flatMap { dep =>
|
||||
for {
|
||||
depProjId <- (dep.project / projectID).get(data)
|
||||
depSBV <- (dep.project / scalaBinaryVersion).get(data)
|
||||
depCross <- (dep.project / crossVersion).get(data)
|
||||
} yield {
|
||||
depCross match {
|
||||
case b: CrossVersion.Binary if VirtualAxis.isScala2Scala3Sandwich(sbv, depSBV) =>
|
||||
depProjId
|
||||
.withCrossVersion(CrossVersion.constant(depSBV))
|
||||
.withConfigurations(dep.configuration)
|
||||
.withExplicitArtifacts(Vector.empty)
|
||||
case _ =>
|
||||
depProjId.withConfigurations(dep.configuration).withExplicitArtifacts(Vector.empty)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
orig
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,16 +1,18 @@
|
|||
lazy val check = taskKey[Unit]("")
|
||||
|
||||
val dottyVersion = "3.0.0-M1"
|
||||
ThisBuild / resolvers += "scala-integration" at "https://scala-ci.typesafe.com/artifactory/scala-integration/"
|
||||
// TODO use 2.13.4 when it's out
|
||||
lazy val scala213 = "2.13.4-bin-aeee8f0"
|
||||
lazy val scala3 = "3.0.0-M1"
|
||||
lazy val scala213 = "2.13.4"
|
||||
|
||||
lazy val fooApp = (projectMatrix in file("foo-app"))
|
||||
.dependsOn(fooCore)
|
||||
.settings(
|
||||
name := "foo app",
|
||||
)
|
||||
.jvmPlatform(scalaVersions = Seq(dottyVersion))
|
||||
.jvmPlatform(scalaVersions = Seq(scala3))
|
||||
|
||||
lazy val fooApp3 = fooApp.jvm(scala3)
|
||||
.settings(
|
||||
test := { () },
|
||||
)
|
||||
|
||||
lazy val fooCore = (projectMatrix in file("foo-core"))
|
||||
.settings(
|
||||
|
|
@ -29,7 +31,7 @@ lazy val barCore = (projectMatrix in file("bar-core"))
|
|||
.settings(
|
||||
name := "bar core",
|
||||
)
|
||||
.jvmPlatform(scalaVersions = Seq(dottyVersion))
|
||||
.jvmPlatform(scalaVersions = Seq(scala3))
|
||||
|
||||
// choose 2.13 when bazCore offers both 2.13 and Dotty
|
||||
lazy val bazApp = (projectMatrix in file("baz-app"))
|
||||
|
|
@ -51,4 +53,4 @@ lazy val bazCore = (projectMatrix in file("baz-core"))
|
|||
name := "baz core",
|
||||
exportJars := true,
|
||||
)
|
||||
.jvmPlatform(scalaVersions = Seq(scala213, dottyVersion))
|
||||
.jvmPlatform(scalaVersions = Seq(scala213, scala3))
|
||||
|
|
|
|||
|
|
@ -1,16 +1,13 @@
|
|||
lazy val check = taskKey[Unit]("")
|
||||
|
||||
val dottyVersion = "3.0.0-M1"
|
||||
ThisBuild / resolvers += "scala-integration" at "https://scala-ci.typesafe.com/artifactory/scala-integration/"
|
||||
// TODO use 2.13.4 when it's out
|
||||
lazy val scala213 = "2.13.4-bin-aeee8f0"
|
||||
lazy val scala3 = "3.0.0-M1"
|
||||
lazy val scala213 = "2.13.4"
|
||||
|
||||
lazy val fooApp = (projectMatrix in file("foo-app"))
|
||||
.dependsOn(fooCore)
|
||||
.settings(
|
||||
name := "foo app",
|
||||
)
|
||||
.jvmPlatform(scalaVersions = Seq(dottyVersion))
|
||||
.jvmPlatform(scalaVersions = Seq(scala3))
|
||||
|
||||
lazy val fooCore = (projectMatrix in file("foo-core"))
|
||||
.settings(
|
||||
|
|
@ -29,7 +26,7 @@ lazy val barCore = (projectMatrix in file("bar-core"))
|
|||
.settings(
|
||||
name := "bar core",
|
||||
)
|
||||
.jvmPlatform(scalaVersions = Seq(dottyVersion))
|
||||
.jvmPlatform(scalaVersions = Seq(scala3))
|
||||
|
||||
// choose 2.13 when bazCore offers both 2.13 and Dotty
|
||||
lazy val bazApp = (projectMatrix in file("baz-app"))
|
||||
|
|
@ -52,4 +49,4 @@ lazy val bazCore = (projectMatrix in file("baz-core"))
|
|||
name := "baz core",
|
||||
exportJars := true,
|
||||
)
|
||||
.jvmPlatform(scalaVersions = Seq(scala213, dottyVersion))
|
||||
.jvmPlatform(scalaVersions = Seq(scala213, scala3))
|
||||
|
|
|
|||
Loading…
Reference in New Issue