From dcbb54c8e5ecf131df7e923073d3cbb8a8fa69d5 Mon Sep 17 00:00:00 2001 From: Hamza Remmal Date: Wed, 23 Jul 2025 22:53:09 +0100 Subject: [PATCH] chore: ensure stdlib always produces Java 17 >= artifacts --- project/Build.scala | 6 ++++++ project/Versions.scala | 6 ++++++ 2 files changed, 12 insertions(+) create mode 100644 project/Versions.scala diff --git a/project/Build.scala b/project/Build.scala index 4cda2cda5135..0764c1f787ad 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -1437,6 +1437,9 @@ object Build { // Needed so that the library sources are visible when `dotty.tools.dotc.core.Definitions#init` is called "-sourcepath", (Compile / sourceDirectories).value.map(_.getCanonicalPath).distinct.mkString(File.pathSeparator), ), + // Make sure that the produced artifacts have the minimum JVM version in the bytecode + Compile / javacOptions ++= Seq("--target", Versions.minimumJVMVersion), + Compile / scalacOptions ++= Seq("--java-output-version", Versions.minimumJVMVersion), // Only publish compilation artifacts, no test artifacts Compile / publishArtifact := true, Test / publishArtifact := false, @@ -1467,6 +1470,9 @@ object Build { // Needed so that the library sources are visible when `dotty.tools.dotc.core.Definitions#init` is called "-sourcepath", (Compile / sourceDirectories).value.map(_.getCanonicalPath).distinct.mkString(File.pathSeparator), ), + // Make sure that the produced artifacts have the minimum JVM version in the bytecode + Compile / javacOptions ++= Seq("--target", Versions.minimumJVMVersion), + Compile / scalacOptions ++= Seq("--java-output-version", Versions.minimumJVMVersion), // Only publish compilation artifacts, no test artifacts Compile / publishArtifact := true, Test / publishArtifact := false, diff --git a/project/Versions.scala b/project/Versions.scala new file mode 100644 index 000000000000..3fba907e9d68 --- /dev/null +++ b/project/Versions.scala @@ -0,0 +1,6 @@ +object Versions { + + /* The Minimum JVM version the artifact should be able to use */ + val minimumJVMVersion = "17" + +}