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 deps = buildDependencies.value
|
||||
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 (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}")
|
||||
case _ => None
|
||||
for {
|
||||
depProjId <- (dep.project / projectID).get(data)
|
||||
depSV <- (dep.project / scalaVersion).get(data)
|
||||
depSBV <- (dep.project / scalaBinaryVersion).get(data)
|
||||
depCross <- (dep.project / crossVersion).get(data)
|
||||
} yield {
|
||||
if (isScala2Scala3Sandwich(sbv, depSBV) && depCross == CrossVersion.binary)
|
||||
depProjId
|
||||
.withCrossVersion(CrossVersion.constant(depSBV))
|
||||
.withConfigurations(dep.configuration)
|
||||
.withExplicitArtifacts(Vector.empty)
|
||||
else
|
||||
depProjId.withConfigurations(dep.configuration).withExplicitArtifacts(Vector.empty)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue