Skip to content

Commit bbc089e

Browse files
authored
chore: ensure stdlib always produces Java 17 >= artifacts (#23593)
We make sure that we always generate classifies that are compatible with the minimum JVM version. Related to #19750, https://www.scala-lang.org/blog/next-scala-lts.html and https://www.scala-lang.org/news/next-scala-lts-jdk.html
2 parents 14b7f03 + dcbb54c commit bbc089e

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

project/Build.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1437,6 +1437,9 @@ object Build {
14371437
// Needed so that the library sources are visible when `dotty.tools.dotc.core.Definitions#init` is called
14381438
"-sourcepath", (Compile / sourceDirectories).value.map(_.getCanonicalPath).distinct.mkString(File.pathSeparator),
14391439
),
1440+
// Make sure that the produced artifacts have the minimum JVM version in the bytecode
1441+
Compile / javacOptions ++= Seq("--target", Versions.minimumJVMVersion),
1442+
Compile / scalacOptions ++= Seq("--java-output-version", Versions.minimumJVMVersion),
14401443
// Only publish compilation artifacts, no test artifacts
14411444
Compile / publishArtifact := true,
14421445
Test / publishArtifact := false,
@@ -1467,6 +1470,9 @@ object Build {
14671470
// Needed so that the library sources are visible when `dotty.tools.dotc.core.Definitions#init` is called
14681471
"-sourcepath", (Compile / sourceDirectories).value.map(_.getCanonicalPath).distinct.mkString(File.pathSeparator),
14691472
),
1473+
// Make sure that the produced artifacts have the minimum JVM version in the bytecode
1474+
Compile / javacOptions ++= Seq("--target", Versions.minimumJVMVersion),
1475+
Compile / scalacOptions ++= Seq("--java-output-version", Versions.minimumJVMVersion),
14701476
// Only publish compilation artifacts, no test artifacts
14711477
Compile / publishArtifact := true,
14721478
Test / publishArtifact := false,

project/Versions.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
object Versions {
2+
3+
/* The Minimum JVM version the artifact should be able to use */
4+
val minimumJVMVersion = "17"
5+
6+
}

0 commit comments

Comments
 (0)