[2.x] fix: Restores Scala 2 reflect/compiler unification#8700
[2.x] fix: Restores Scala 2 reflect/compiler unification#8700eed3si9n merged 4 commits intosbt:developfrom
Conversation
|
@eed3si9n Could you please review this pr? |
|
I think +1 on reverting #8632, and then we can follow up with potentially detecting scala-reflect not found whose version >= 3.0 and display a custom error message. |
|
fyi @lrytz |
|
@eed3si9n Could you re-run the failed CI checks? I don't think they're related to my change |
|
I have but looks like we're hitting the not found issue: [info] [warn] Note: Unresolved dependencies path:
[info] [error] sbt.librarymanagement.ResolveException: Error downloading org.scala-lang:scala-reflect:3.8.1
[info] [error] Not found
[info] [error] Not found
[info] [error] not found: /home/runner/.ivy2/local/org.scala-lang/scala-reflect/3.8.1/ivys/ivy.xml
[info] [error] not found: https://repo1.maven.org/maven2/org/scala-lang/scala-reflect/3.8.1/scala-reflect-3.8.1.pom |
|
Now all checks have passed |
…bt#8700) Commit 92b0564 (fix for sbt#8632) changed `csrSameVersions` so that Scala 2.13+ only aligned `scala-library` and `scala3-library`. This removed `scala-compiler` and `scala-reflect` from version unification, so transitive dependencies pulling in an older `scala-compiler` (e.g. 2.13.15 via `refined_2.13`) were no longer evicted to match `scalaVersion` (e.g. 2.13.18).
|
Hi, apologies for a possibly stupid question, but I can see this is a backport candidate, which should mean that sbt 1.12.1 and 1.12.2 will be patched with this fix, and that the changes will then be automatically picked up in my code, correct? My question is how will I know when this has happened? Will something be added to the https://github.com/sbt/sbt/releases page? I'm asking as once I know the backport has been published I can remove the temporary workaround I have in place whilst using the current versions of 1.12.1 and 1.12.2. Thanks! |
|
A backport would appear in a future 1.12.x release (not 1.11.x) You can either rely on system like Dependabot or Scala Steward to create pull request for new releases |
|
Thank you. Just so I'm clear, when that 1.12.x release is made, and announced, I can either move to that new release, or stay on the 1.12.1 release and I will automatically pick up the new backported version of 1.12.1 with this fix in it? |
|
@ludwiggj version numbers (not just for sbt, but in general in software) are immutable; 1.12.1 and 1.12.2 will remain exactly as they are, from now until the end of time you need to wait for 1.12.3 to be released it's possible you're confused about what "1.12.x" means? it's just a shorthand for referring to the entire series 1.12.0, 1.12.1, 1.12.2, 1.12.3, ... |
|
Hi Seth, thanks. I understand what 1.12.x refers to. I think I was just confused but the use of the "backport candidate" label in this fix. What you're saying makes complete sense. So I'll move to 1.12.3 when it becomes available, and I guess 1.12.1 and 1.12.2 will always have this issue. |
|
👍 (and fyi, in this context, "backport candidate" refers to backporting from sbt 2.x to sbt 1.x) |
|
sbt 1.12.3 is released. |
Fix Scala 2 artifact version unification
Fixes #8689
What was wrong
Commit 92b0564 (fix for #8632) changed
csrSameVersionsso that Scala 2.13+ only alignedscala-libraryandscala3-library. This removedscala-compilerandscala-reflectfrom versionunification, so transitive dependencies pulling in an older
scala-compiler(e.g. 2.13.15 viarefined_2.13) were no longer evicted to matchscalaVersion(e.g. 2.13.18). The olderscala-compilerbrought in jline jars targeting Java 22, breaking builds on older JDKs.
What this PR does
Restore full
csrSameVersionsfor Scala 2.x: All Scala 2 artifacts (scala-library,scala-compiler,scala-reflect,scala-actors,scalap) are aligned again, regardless of minorversion. Scala 3.x keeps the narrower
Scala3_8Artifactsset to avoid aligning artifacts that don't exist across major boundaries.Exclude
scala-libraryin Scala 2→3.8+ sandwich deps: InprojectDependenciesTask, when a Scala 2 project depends on a Scala 3.8+ project,scala-libraryis excluded from the inter-projectdependency. This prevents
scala-library:3.xfrom entering the Scala 2 resolution graph and triggering a cross-major-version bump viacsrSameVersions. This preserves the fix for [2.x] fix: Fix scala-reflect not found problem #8632.Restore
stdlib-unfreezetest coverage:checkLibsnow verifies bothscala-libraryandscala-reflectalignment. The negative assertion (-> b/checkLibswhencsrSameVersions := Nil) isrestored.
Testing
mainProj/compilepasses.dependency-management/stdlib-unfreeze,dependency-management/stdlib-unfreeze-warn,dependency-management/stdlib-unfreeze-update,dependency-management/stdlib-3.8.