mirror of https://github.com/sbt/sbt.git
[2.x] fix: Fix scala-reflect not found problem (#8632)
## Problem We enforce same-version policy for scala-reflect in Scala 2.13. However due to sandwich dependency, the graph can bump scala-library to 3.8.1, which is missing scala-reflect counterpart. ## Solution Drop the same-version policy.
This commit is contained in:
parent
0a96df6f89
commit
92b0564dc6
|
|
@ -3134,17 +3134,16 @@ object Classpaths {
|
||||||
}).value),
|
}).value),
|
||||||
csrSameVersions ++= {
|
csrSameVersions ++= {
|
||||||
partialVersion(scalaVersion.value) match {
|
partialVersion(scalaVersion.value) match {
|
||||||
// See https://github.com/sbt/sbt/issues/8224
|
case Some((major, minor)) if major == 2 && minor < 13 =>
|
||||||
// Scala 3.8+ should align only Scala3_8Artifacts
|
|
||||||
case Some((3, minor)) if minor >= 8 =>
|
|
||||||
ScalaArtifacts.Scala3_8Artifacts
|
|
||||||
.map(a => InclExclRule(scalaOrganization.value, a))
|
|
||||||
.toSet :: Nil
|
|
||||||
case Some((major, minor)) if major == 2 || major == 3 =>
|
|
||||||
ScalaArtifacts.Artifacts
|
ScalaArtifacts.Artifacts
|
||||||
.map(a => InclExclRule(scalaOrganization.value, a))
|
.map(a => InclExclRule(scalaOrganization.value, a))
|
||||||
.toSet :: Nil
|
.toSet :: Nil
|
||||||
case _ => Nil
|
// Due to the Scala 2.13-3.x sandwich, the absence of scala-reflect
|
||||||
|
// that corresponds with scala-library 3.8.x propagates to 2.13 builds as well.
|
||||||
|
case _ =>
|
||||||
|
ScalaArtifacts.Scala3_8Artifacts
|
||||||
|
.map(a => InclExclRule(scalaOrganization.value, a))
|
||||||
|
.toSet :: Nil
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
moduleName := normalizedName.value,
|
moduleName := normalizedName.value,
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
lazy val a = project
|
||||||
|
.settings(
|
||||||
|
scalaVersion := "3.8.1"
|
||||||
|
)
|
||||||
|
|
||||||
|
// (b / update) sbt.librarymanagement.ResolveException: Error downloading org.scala-lang:scala-reflect:3.8.1
|
||||||
|
lazy val b = project
|
||||||
|
.dependsOn(a)
|
||||||
|
.settings(
|
||||||
|
scalaVersion := "2.13.10",
|
||||||
|
libraryDependencies += "org.scala-lang" % "scala-reflect" % "2.13.10",
|
||||||
|
)
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
> update
|
||||||
|
|
@ -3,12 +3,12 @@ import sbt.librarymanagement.InclExclRule
|
||||||
lazy val a = project.settings(
|
lazy val a = project.settings(
|
||||||
scalaVersion := "2.13.11",
|
scalaVersion := "2.13.11",
|
||||||
libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value,
|
libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value,
|
||||||
TaskKey[Unit]("checkLibs") := checkLibs("2.13.11", (Compile/dependencyClasspath).value, ".*scala-(library|reflect).*"),
|
TaskKey[Unit]("checkLibs") := checkLibs("2.13.11", (Compile/dependencyClasspath).value, ".*scala-library.*"),
|
||||||
)
|
)
|
||||||
|
|
||||||
lazy val b = project.dependsOn(a).settings(
|
lazy val b = project.dependsOn(a).settings(
|
||||||
scalaVersion := "2.13.12",
|
scalaVersion := "2.13.12",
|
||||||
TaskKey[Unit]("checkLibs") := checkLibs("2.13.12", (Compile/dependencyClasspath).value, ".*scala-(library|reflect).*"),
|
TaskKey[Unit]("checkLibs") := checkLibs("2.13.12", (Compile/dependencyClasspath).value, ".*scala-library.*"),
|
||||||
)
|
)
|
||||||
|
|
||||||
lazy val a3 = project.settings(
|
lazy val a3 = project.settings(
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,5 @@ $ delete s2.13.14.txt
|
||||||
# without the default `csrSameVersions`, scala-reflect in b stays at 2.13.11
|
# without the default `csrSameVersions`, scala-reflect in b stays at 2.13.11
|
||||||
> set b/csrSameVersions := Nil
|
> set b/csrSameVersions := Nil
|
||||||
> b/update
|
> b/update
|
||||||
-> b/checkLibs
|
|
||||||
|
|
||||||
> ak/checkLibs
|
> ak/checkLibs
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue