mirror of https://github.com/sbt/sbt.git
Allow incompatible mixed scala versions
The zinc scripted project depends on all of the compiler bridges. As a
result the introduction of the strict scala binary version check in
f8139da192 broke zinc scripted. This
commit reverts to the old behavior in the non scala sandwich case.
I also switched to a for comprehension instead of a pattern match
because this is a rare case where I think it made the code significantly
more readable.
This commit is contained in:
parent
debc9a28a4
commit
c6021ecdf6
|
|
@ -3470,25 +3470,19 @@ object Classpaths {
|
||||||
val data = settingsData.value
|
val data = settingsData.value
|
||||||
val deps = buildDependencies.value
|
val deps = buildDependencies.value
|
||||||
deps.classpath(ref) flatMap { dep =>
|
deps.classpath(ref) flatMap { dep =>
|
||||||
val depProjIdOpt = (dep.project / projectID).get(data)
|
for {
|
||||||
val depSVOpt = (dep.project / scalaVersion).get(data)
|
depProjId <- (dep.project / projectID).get(data)
|
||||||
val depSBVOpt = (dep.project / scalaBinaryVersion).get(data)
|
depSV <- (dep.project / scalaVersion).get(data)
|
||||||
val depCrossOpt = (dep.project / crossVersion).get(data)
|
depSBV <- (dep.project / scalaBinaryVersion).get(data)
|
||||||
(depProjIdOpt, depSVOpt, depSBVOpt, depCrossOpt) match {
|
depCross <- (dep.project / crossVersion).get(data)
|
||||||
case (Some(depProjId), Some(depSV), Some(depSBV), Some(depCross)) =>
|
} yield {
|
||||||
if (sbv == depSBV || depCross != CrossVersion.binary)
|
if (isScala2Scala3Sandwich(sbv, depSBV) && depCross == CrossVersion.binary)
|
||||||
Some(
|
depProjId
|
||||||
depProjId.withConfigurations(dep.configuration).withExplicitArtifacts(Vector.empty)
|
.withCrossVersion(CrossVersion.constant(depSBV))
|
||||||
)
|
.withConfigurations(dep.configuration)
|
||||||
else if (isScala2Scala3Sandwich(sbv, depSBV) && depCross == CrossVersion.binary)
|
.withExplicitArtifacts(Vector.empty)
|
||||||
Some(
|
else
|
||||||
depProjId
|
depProjId.withConfigurations(dep.configuration).withExplicitArtifacts(Vector.empty)
|
||||||
.withCrossVersion(CrossVersion.constant(depSBV))
|
|
||||||
.withConfigurations(dep.configuration)
|
|
||||||
.withExplicitArtifacts(Vector.empty)
|
|
||||||
)
|
|
||||||
else sys.error(s"scalaBinaryVersion mismatch: expected $sbv but found ${depSBV}")
|
|
||||||
case _ => None
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue