Skip to content

Commit 443f0f3

Browse files
authored
Require JDK 17+ (#24146)
This is paving the way for #24109. As part of this: * the minimum version for `-release`/`-java-output-version` flag is set to 17 * managed community build tests are done on JDK 17 * some community-build projects are temporarily removed * some that were using -release 8 option now have that option removed * compilation tests using `-release 8` were disabled * presentation compiler tests using `-release 8` and `-release 11` were removed * releases are done on JDK 17
2 parents 3a21370 + 78c4d97 commit 443f0f3

File tree

11 files changed

+50
-94
lines changed

11 files changed

+50
-94
lines changed

.github/workflows/ci.yaml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -192,11 +192,11 @@ jobs:
192192
)"
193193

194194
steps:
195-
######################################################################################
196-
## WARNING: DO NOT CHANGE THE JAVA VERSION HERE. SCALA IS DISTRIBUTED USING JAVA 8. ##
197-
######################################################################################
198-
- name: Set JDK 8 as default
199-
run: echo "/usr/lib/jvm/java-8-openjdk-amd64/bin" >> $GITHUB_PATH
195+
##############################################################################################
196+
## WARNING: DO NOT CHANGE THE JAVA VERSION HERE. SCALA 3.8.0+ IS DISTRIBUTED USING JAVA 17. ##
197+
##############################################################################################
198+
- name: Set JDK 17 as default
199+
run: echo "/usr/lib/jvm/java-17-openjdk-amd64/bin" >> $GITHUB_PATH
200200
- name: Reset existing repo
201201
run: |
202202
git config --global --add safe.directory $GITHUB_WORKSPACE
@@ -249,11 +249,11 @@ jobs:
249249
)"
250250

251251
steps:
252-
######################################################################################
253-
## WARNING: DO NOT CHANGE THE JAVA VERSION HERE. SCALA IS DISTRIBUTED USING JAVA 8. ##
254-
######################################################################################
255-
- name: Set JDK 8 as default
256-
run: echo "/usr/lib/jvm/java-8-openjdk-amd64/bin" >> $GITHUB_PATH
252+
##############################################################################################
253+
## WARNING: DO NOT CHANGE THE JAVA VERSION HERE. SCALA 3.8.0+ IS DISTRIBUTED USING JAVA 17. ##
254+
##############################################################################################
255+
- name: Set JDK 17 as default
256+
run: echo "/usr/lib/jvm/java-17-openjdk-amd64/bin" >> $GITHUB_PATH
257257
- name: Reset existing repo
258258
run: |
259259
git config --global --add safe.directory $GITHUB_WORKSPACE
@@ -306,11 +306,11 @@ jobs:
306306
)"
307307

308308
steps:
309-
######################################################################################
310-
## WARNING: DO NOT CHANGE THE JAVA VERSION HERE. SCALA IS DISTRIBUTED USING JAVA 8. ##
311-
######################################################################################
312-
- name: Set JDK 8 as default
313-
run: echo "/usr/lib/jvm/java-8-openjdk-amd64/bin" >> $GITHUB_PATH
309+
##############################################################################################
310+
## WARNING: DO NOT CHANGE THE JAVA VERSION HERE. SCALA 3.8.0+ IS DISTRIBUTED USING JAVA 17. ##
311+
##############################################################################################
312+
- name: Set JDK 17 as default
313+
run: echo "/usr/lib/jvm/java-17-openjdk-amd64/bin" >> $GITHUB_PATH
314314
- name: Reset existing repo
315315
run: |
316316
git config --global --add safe.directory $GITHUB_WORKSPACE
@@ -407,11 +407,11 @@ jobs:
407407
SONATYPE_USER: ${{ secrets.SONATYPE_USER_ORGSCALALANG }}
408408

409409
steps:
410-
######################################################################################
411-
## WARNING: DO NOT CHANGE THE JAVA VERSION HERE. SCALA IS DISTRIBUTED USING JAVA 8. ##
412-
######################################################################################
413-
- name: Set JDK 8 as default
414-
run: echo "/usr/lib/jvm/java-8-openjdk-amd64/bin" >> $GITHUB_PATH
410+
##############################################################################################
411+
## WARNING: DO NOT CHANGE THE JAVA VERSION HERE. SCALA 3.8.0+ IS DISTRIBUTED USING JAVA 17. ##
412+
##############################################################################################
413+
- name: Set JDK 17 as default
414+
run: echo "/usr/lib/jvm/java-17-openjdk-amd64/bin" >> $GITHUB_PATH
415415
- name: Reset existing repo
416416
run: |
417417
git config --global --add safe.directory $GITHUB_WORKSPACE

community-build/src/scala/dotty/communitybuild/projects.scala

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,11 @@ object projects:
127127
s""";set $project/Compile/doc/sources ++= ($project/Compile/doc/dotty.tools.sbtplugin.DottyPlugin.autoImport.tastyFiles).value ;$project/doc"""
128128
).mkString(" ")
129129

130+
private def removeRelease8(projects: String*): String =
131+
projects.map(project =>
132+
s"""set $project/Compile/scalacOptions := ($project/Compile/scalacOptions).value.filterNot(opt => opt == "-release" || opt == "8")"""
133+
).mkString("; ")
134+
130135
private def aggregateDoc(in: String)(projects: String*) =
131136
val tastyFiles =
132137
(in +: projects).map(p => s"($p/Compile/doc/dotty.tools.sbtplugin.DottyPlugin.autoImport.tastyFiles).value").mkString(" ++ ")
@@ -445,7 +450,10 @@ object projects:
445450

446451
lazy val discipline = SbtCommunityProject(
447452
project = "discipline",
448-
sbtTestCommand = "coreJVM/test;coreJS/test",
453+
sbtTestCommand = List(
454+
removeRelease8("core.jvm", "core.js"),
455+
"coreJVM/test;coreJS/test"
456+
).mkString("; "),
449457
sbtPublishCommand = "set every credentials := Nil;coreJVM/publishLocal;coreJS/publishLocal",
450458
scalacOptions = SbtCommunityProject.scalacOptions.filter(_ != "-Wsafe-init"),
451459
)
@@ -544,7 +552,12 @@ object projects:
544552

545553
lazy val scissLucre = SbtCommunityProject(
546554
project = "Lucre",
547-
sbtTestCommand = "adjunctJVM/test;baseJVM/test;confluentJVM/test;coreJVM/test;dataJVM/test;exprJVM/test;geomJVM/test;lucre-bdb/test;testsJVM/test",
555+
sbtTestCommand =
556+
val subprojects = List("adjunct.jvm", "base.jvm", "confluent.jvm", "core.jvm", "data.jvm", "expr.jvm", "geom.jvm", "bdb", "tests.jvm")
557+
List(
558+
subprojects.map(name => s"""set ($name/Compile/compile/scalacOptions) := ($name/Compile/compile/scalacOptions).value.filterNot(opt => opt == "-release" || opt == "8")"""),
559+
List("adjunctJVM/test;baseJVM/test;confluentJVM/test;coreJVM/test;dataJVM/test;exprJVM/test;geomJVM/test;lucre-bdb/test;testsJVM/test")
560+
).flatten.mkString("; "),
548561
extraSbtArgs = List("-Dde.sciss.lucre.ShortTests=true"),
549562
sbtPublishCommand = "adjunctJVM/publishLocal;baseJVM/publishLocal;confluentJVM/publishLocal;coreJVM/publishLocal;dataJVM/publishLocal;exprJVM/publishLocal;geomJVM/publishLocal;lucre-bdb/publishLocal",
550563
)
@@ -615,7 +628,11 @@ object projects:
615628

616629
lazy val fs2 = SbtCommunityProject(
617630
project = "fs2",
618-
sbtTestCommand = "coreJVM/test; coreJS/test", // io/test requires JDK9+
631+
sbtTestCommand =
632+
List(
633+
removeRelease8("coreJVM", "coreJS"), // io/test currently fails JDK9+
634+
"coreJVM/test; coreJS/test;"
635+
).mkString("; "),
619636
sbtPublishCommand = "coreJVM/publishLocal; coreJS/publishLocal",
620637
scalacOptions = SbtCommunityProject.scalacOptions.filter(_ != "-Wsafe-init"),
621638
)

community-build/test/scala/dotty/communitybuild/CommunityBuildTest.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ end CommunityBuildTestB
5858
@Category(Array(classOf[TestCategory]))
5959
class CommunityBuildTestC:
6060
@Test def akka = projects.akka.run()
61-
@Test def betterfiles = projects.betterfiles.run()
61+
// Disabled because `javax.xml.bind` is not available since java 11
62+
// @Test def betterfiles = projects.betterfiles.run()
6263
@Test def cask = projects.cask.run()
6364
// Temporarily disabled until problem discovered in comments to #9449 is fixed
6465
// @Test def dottyCpsAsync = projects.dottyCpsAsync.run()
@@ -75,7 +76,8 @@ class CommunityBuildTestC:
7576
@Test def oslib = projects.oslib.run()
7677
// @Test def oslibWatch = projects.oslibWatch.run()
7778
@Test def parboiled2 = projects.parboiled2.run()
78-
@Test def playJson = projects.playJson.run()
79+
// Disabled because `javax.xml.bind` is not available since java 11
80+
// @Test def playJson = projects.playJson.run()
7981
@Test def pprint = projects.pprint.run()
8082
//@Test def protoquill = projects.protoquill.run()
8183
@Test def requests = projects.requests.run()

compiler/src/dotty/tools/dotc/config/ScalaSettingsProperties.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ object ScalaSettingsProperties:
1010
private lazy val minTargetVersion = classfileVersionMap.keysIterator.min
1111
private lazy val maxTargetVersion = classfileVersionMap.keysIterator.max
1212

13+
private val minReleaseVersion = 17
14+
1315
def supportedTargetVersions: List[String] =
1416
(minTargetVersion to maxTargetVersion).toList.map(_.toString)
1517

1618
def supportedReleaseVersions: List[String] =
17-
if scala.util.Properties.isJavaAtLeast("9") then
18-
val jdkVersion = JDK9Reflectors.runtimeVersionMajor(JDK9Reflectors.runtimeVersion()).intValue()
19-
val maxVersion = Math.min(jdkVersion, maxTargetVersion)
20-
(minTargetVersion to maxVersion).toList.map(_.toString)
21-
else List(minTargetVersion).map(_.toString)
19+
val jdkVersion = JDK9Reflectors.runtimeVersionMajor(JDK9Reflectors.runtimeVersion()).intValue()
20+
val maxVersion = Math.min(jdkVersion, maxTargetVersion)
21+
(minReleaseVersion to maxVersion).toList.map(_.toString)
2222

2323
def supportedScalaReleaseVersions: List[String] =
2424
ScalaRelease.values.toList.map(_.show)

presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionRelease11Suite.scala

Lines changed: 0 additions & 32 deletions
This file was deleted.

presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionRelease8Suite.scala

Lines changed: 0 additions & 31 deletions
This file was deleted.

sbt-test/sbt-dotty/scaladoc-regressions/build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ lazy val i20476 = project
66

77
lazy val i18231 = project
88
.in(file("i18231"))
9-
.settings(scalacOptions += "-release:8")
9+
.settings(scalacOptions += "-release:17")
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)