Skip to content

Commit 9032701

Browse files
committed
Set minimum JDK version for -release flag to java 17
1 parent 669713b commit 9032701

File tree

7 files changed

+19
-9
lines changed

7 files changed

+19
-9
lines changed

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

Lines changed: 12 additions & 5 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
)
@@ -621,11 +629,10 @@ object projects:
621629
lazy val fs2 = SbtCommunityProject(
622630
project = "fs2",
623631
sbtTestCommand =
624-
val subprojects = List("coreJVM", "coreJS")
625632
List(
626-
subprojects.map(name => s"""set $name/Compile/scalacOptions := ($name/Compile/scalacOptions).value.filterNot(opt => opt == "-release" || opt == "8")"""),
627-
List("coreJVM/test; coreJS/test;")
628-
).flatten.mkString("; "),
633+
removeRelease8("coreJVM", "coreJS"),
634+
"coreJVM/test; coreJS/test;"
635+
).mkString("; "),
629636
sbtPublishCommand = "coreJVM/publishLocal; coreJS/publishLocal",
630637
scalacOptions = SbtCommunityProject.scalacOptions.filter(_ != "-Wsafe-init"),
631638
)

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,17 @@ 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] =
1719
if scala.util.Properties.isJavaAtLeast("9") then
1820
val jdkVersion = JDK9Reflectors.runtimeVersionMajor(JDK9Reflectors.runtimeVersion()).intValue()
1921
val maxVersion = Math.min(jdkVersion, maxTargetVersion)
20-
(minTargetVersion to maxVersion).toList.map(_.toString)
21-
else List(minTargetVersion).map(_.toString)
22+
(minReleaseVersion to maxVersion).toList.map(_.toString)
23+
else List(minReleaseVersion).map(_.toString)
2224

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

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ import dotty.tools.pc.base.BaseCompletionSuite
44

55
import org.junit.Test
66
import org.junit.Before
7+
import org.junit.Ignore
78
import java.nio.file.Path
89
import dotty.tools.pc.utils.JRE
910

10-
class CompletionRelease8Suite extends BaseCompletionSuite:
11+
@Ignore class CompletionRelease8Suite extends BaseCompletionSuite:
1112

1213
override protected def scalacOptions(classpath: Seq[Path]): Seq[String] =
1314
"-release:8" +: super.scalacOptions(classpath)

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:8")
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)