Skip to content

Commit c164f5f

Browse files
authored
chore: align the --source flag with the --target when compiling Java code (#23749)
2 parents 8d20b2a + 0a2dbf9 commit c164f5f

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

.github/workflows/ci.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,9 @@ jobs:
719719
- name: Cleanup
720720
run: .github/workflows/cleanup.sh
721721

722+
- name: Set JDK 17 as default
723+
run: echo "/usr/lib/jvm/java-17-openjdk-amd64/bin" >> $GITHUB_PATH
724+
722725
- name: Git Checkout
723726
uses: actions/checkout@v5
724727

@@ -859,7 +862,7 @@ jobs:
859862
scala3-${{ env.RELEASE_TAG }}*.zip \
860863
scala3-${{ env.RELEASE_TAG }}*.tar.gz \
861864
scala3-${{ env.RELEASE_TAG }}*.sha256 \
862-
scala3-${{ env.RELEASE_TAG }}.msi
865+
scala3-${{ env.RELEASE_TAG }}.msi
863866
864867
- name: Publish Release
865868
run: ./project/scripts/sbtPublish ";project scala3-bootstrapped ;publishSigned ;sonaUpload"

project/Build.scala

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1406,7 +1406,7 @@ object Build {
14061406
// NOTE: The only difference here is that we drop `-Werror` and semanticDB for now
14071407
Compile / scalacOptions := Seq("-deprecation", "-feature", "-unchecked", "-encoding", "UTF8", "-language:implicitConversions"),
14081408
// Make sure that the produced artifacts have the minimum JVM version in the bytecode
1409-
Compile / javacOptions ++= Seq("--target", Versions.minimumJVMVersion),
1409+
Compile / javacOptions ++= Seq("--release", Versions.minimumJVMVersion),
14101410
Compile / scalacOptions ++= Seq("--java-output-version", Versions.minimumJVMVersion),
14111411
// Add all the project's external dependencies
14121412
libraryDependencies ++= Seq(
@@ -1486,7 +1486,7 @@ object Build {
14861486
// NOTE: The only difference here is that we drop `-Werror` and semanticDB for now
14871487
Compile / scalacOptions := Seq("-deprecation", "-feature", "-unchecked", "-encoding", "UTF8", "-language:implicitConversions"),
14881488
// Make sure that the produced artifacts have the minimum JVM version in the bytecode
1489-
Compile / javacOptions ++= Seq("--target", Versions.minimumJVMVersion),
1489+
Compile / javacOptions ++= Seq("--release", Versions.minimumJVMVersion),
14901490
Compile / scalacOptions ++= Seq("--java-output-version", Versions.minimumJVMVersion),
14911491
// Add all the project's external dependencies
14921492
libraryDependencies ++= Seq(
@@ -1556,7 +1556,7 @@ object Build {
15561556
// NOTE: The only difference here is that we drop `-Werror` and semanticDB for now
15571557
Compile / scalacOptions := Seq("-deprecation", "-feature", "-unchecked", "-encoding", "UTF8", "-language:implicitConversions"),
15581558
// Make sure that the produced artifacts have the minimum JVM version in the bytecode
1559-
Compile / javacOptions ++= Seq("--target", Versions.minimumJVMVersion),
1559+
Compile / javacOptions ++= Seq("--release", Versions.minimumJVMVersion),
15601560
Compile / scalacOptions ++= Seq("--java-output-version", Versions.minimumJVMVersion),
15611561
// Packaging configuration of `scala3-staging`
15621562
Compile / packageBin / publishArtifact := true,
@@ -1613,7 +1613,7 @@ object Build {
16131613
// NOTE: The only difference here is that we drop `-Werror` and semanticDB for now
16141614
Compile / scalacOptions := Seq("-deprecation", "-feature", "-unchecked", "-encoding", "UTF8", "-language:implicitConversions"),
16151615
// Make sure that the produced artifacts have the minimum JVM version in the bytecode
1616-
Compile / javacOptions ++= Seq("--target", Versions.minimumJVMVersion),
1616+
Compile / javacOptions ++= Seq("--release", Versions.minimumJVMVersion),
16171617
Compile / scalacOptions ++= Seq("--java-output-version", Versions.minimumJVMVersion),
16181618
// Packaging configuration of `scala3-staging`
16191619
Compile / packageBin / publishArtifact := true,
@@ -1681,7 +1681,7 @@ object Build {
16811681
"-sourcepath", (Compile / sourceDirectories).value.map(_.getCanonicalPath).distinct.mkString(File.pathSeparator),
16821682
),
16831683
// Make sure that the produced artifacts have the minimum JVM version in the bytecode
1684-
Compile / javacOptions ++= Seq("--target", Versions.minimumJVMVersion),
1684+
Compile / javacOptions ++= Seq("--release", Versions.minimumJVMVersion),
16851685
Compile / scalacOptions ++= Seq("--java-output-version", Versions.minimumJVMVersion),
16861686
// Packaging configuration of the stdlib
16871687
Compile / packageBin / publishArtifact := true,
@@ -1762,7 +1762,7 @@ object Build {
17621762
"-sourcepath", (Compile / sourceDirectories).value.map(_.getCanonicalPath).distinct.mkString(File.pathSeparator),
17631763
),
17641764
// Make sure that the produced artifacts have the minimum JVM version in the bytecode
1765-
Compile / javacOptions ++= Seq("--target", Versions.minimumJVMVersion),
1765+
Compile / javacOptions ++= Seq("--release", Versions.minimumJVMVersion),
17661766
Compile / scalacOptions ++= Seq("--java-output-version", Versions.minimumJVMVersion),
17671767
// Packaging configuration of the stdlib
17681768
Compile / packageBin / publishArtifact := true,
@@ -2021,7 +2021,7 @@ object Build {
20212021
// NOTE: The only difference here is that we drop `-Werror` and semanticDB for now
20222022
Compile / scalacOptions := Seq("-deprecation", "-feature", "-unchecked", "-encoding", "UTF8", "-language:implicitConversions"),
20232023
// Make sure that the produced artifacts have the minimum JVM version in the bytecode
2024-
Compile / javacOptions ++= Seq("--target", Versions.minimumJVMVersion),
2024+
Compile / javacOptions ++= Seq("--release", Versions.minimumJVMVersion),
20252025
Compile / scalacOptions ++= Seq("--java-output-version", Versions.minimumJVMVersion),
20262026
// Add all the project's external dependencies
20272027
libraryDependencies ++= Seq(
@@ -2080,7 +2080,7 @@ object Build {
20802080
// NOTE: The only difference here is that we drop `-Werror` and semanticDB for now
20812081
Compile / scalacOptions := Seq("-deprecation", "-feature", "-unchecked", "-encoding", "UTF8", "-language:implicitConversions"),
20822082
// Make sure that the produced artifacts have the minimum JVM version in the bytecode
2083-
Compile / javacOptions ++= Seq("--target", Versions.minimumJVMVersion),
2083+
Compile / javacOptions ++= Seq("--release", Versions.minimumJVMVersion),
20842084
Compile / scalacOptions ++= Seq("--java-output-version", Versions.minimumJVMVersion),
20852085
// Add all the project's external dependencies
20862086
libraryDependencies ++= Seq(
@@ -2161,7 +2161,7 @@ object Build {
21612161
// TODO: Enable these flags when the new stdlib is explicitelly null checked
21622162
//Compile / scalacOptions ++= Seq("-Yexplicit-nulls", "-Wsafe-init"),
21632163
// Make sure that the produced artifacts have the minimum JVM version in the bytecode
2164-
Compile / javacOptions ++= Seq("--target", Versions.minimumJVMVersion),
2164+
Compile / javacOptions ++= Seq("--release", Versions.minimumJVMVersion),
21652165
Compile / scalacOptions ++= Seq("--java-output-version", Versions.minimumJVMVersion),
21662166
// Packaging configuration of the stdlib
21672167
Compile / packageBin / publishArtifact := true,
@@ -2282,7 +2282,7 @@ object Build {
22822282
// TODO: Enable these flags when the new stdlib is explicitelly null checked
22832283
//Compile / scalacOptions ++= Seq("-Yexplicit-nulls", "-Wsafe-init"),
22842284
// Make sure that the produced artifacts have the minimum JVM version in the bytecode
2285-
Compile / javacOptions ++= Seq("--target", Versions.minimumJVMVersion),
2285+
Compile / javacOptions ++= Seq("--release", Versions.minimumJVMVersion),
22862286
Compile / scalacOptions ++= Seq("--java-output-version", Versions.minimumJVMVersion),
22872287
// Packaging configuration of the stdlib
22882288
Compile / packageBin / publishArtifact := true,

0 commit comments

Comments
 (0)