From aff013efd12d04911394e9f1bffb40d38a3ef71e Mon Sep 17 00:00:00 2001 From: Hamza Remmal Date: Fri, 15 Aug 2025 13:30:45 +0200 Subject: [PATCH] chore: mark `scala-library` and `scalajs-scalalib_2.13` as `always` instead of `semver-spec` --- project/Build.scala | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/project/Build.scala b/project/Build.scala index 0ce02826aa71..f389aeade02e 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -1661,7 +1661,12 @@ object Build { name := "scala-library-nonbootstrapped", moduleName := "scala-library", version := dottyNonBootstrappedVersion, - versionScheme := Some("semver-spec"), + // We mark the current library as "always" instead of "semver-spec" so that buildtools can + // assume binary compatibility between 2.13.x and 3.x.y. If not set, build tools will, at least sbt, + // will error by claiming that scala-library:2.13.x and 3.x.y are potentially binary incompatible. + // Situation where we have 2.13.x and 3.x.y in the same dependency tree happens + // because we allow cross-compilation. + versionScheme := Some("always"), scalaVersion := referenceVersion, // nonbootstrapped artifacts are compiled with the reference compiler (already officially published) crossPaths := false, // org.scala-lang:scala-library doesn't have a crosspath autoScalaLibrary := false, // do not add a dependency to stdlib @@ -1736,7 +1741,12 @@ object Build { name := "scala-library-bootstrapped", moduleName := "scala-library", version := dottyVersion, - versionScheme := Some("semver-spec"), + // We mark the current library as "always" instead of "semver-spec" so that buildtools can + // assume binary compatibility between 2.13.x and 3.x.y. If not set, build tools will, at least sbt, + // will error by claiming that scala-library:2.13.x and 3.x.y are potentially binary incompatible. + // Situation where we have 2.13.x and 3.x.y in the same dependency tree happens + // because we allow cross-compilation. + versionScheme := Some("always"), // sbt defaults to scala 2.12.x and metals will report issues as it doesn't consider the project a scala 3 project // (not the actual version we use to compile the project) scalaVersion := referenceVersion, @@ -1851,7 +1861,12 @@ object Build { // Yes, I know, this is weird and feels wrong. moduleName := "scalajs-scalalib_2.13", version := dottyVersion, - versionScheme := Some("semver-spec"), + // We mark the current library as "always" instead of "semver-spec" so that buildtools can + // assume binary compatibility between 2.13.x and 3.x.y. If not set, build tools will, at least sbt, + // will error by claiming that scalajs-scalalib_2.13:2.13.x and 3.x.y are potentially binary incompatible. + // Situation where we have 2.13.x and 3.x.y in the same dependency tree happens + // because we allow cross-compilation. + versionScheme := Some("always"), crossPaths := false, // sbt defaults to scala 2.12.x and metals will report issues as it doesn't consider the project a scala 3 project // (not the actual version we use to compile the project)