Skip to content

Commit a35121d

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

File tree

6 files changed

+20
-9
lines changed

6 files changed

+20
-9
lines changed

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

Lines changed: 13 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(" ++ ")
@@ -446,7 +451,11 @@ object projects:
446451
lazy val discipline = SbtCommunityProject(
447452
project = "discipline",
448453
sbtTestCommand = "coreJVM/test;coreJS/test",
449-
sbtPublishCommand = "set every credentials := Nil;coreJVM/publishLocal;coreJS/publishLocal",
454+
sbtPublishCommand =
455+
List(
456+
removeRelease8("coreJVM", "coreJS"),
457+
"set every credentials := Nil;coreJVM/publishLocal;coreJS/publishLocal"
458+
).mkString("; "),
450459
scalacOptions = SbtCommunityProject.scalacOptions.filter(_ != "-Wsafe-init"),
451460
)
452461

@@ -621,11 +630,10 @@ object projects:
621630
lazy val fs2 = SbtCommunityProject(
622631
project = "fs2",
623632
sbtTestCommand =
624-
val subprojects = List("coreJVM", "coreJS")
625633
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("; "),
634+
removeRelease8("coreJVM", "coreJS"),
635+
"coreJVM/test; coreJS/test;"
636+
).mkString("; "),
629637
sbtPublishCommand = "coreJVM/publishLocal; coreJS/publishLocal",
630638
scalacOptions = SbtCommunityProject.scalacOptions.filter(_ != "-Wsafe-init"),
631639
)

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.

0 commit comments

Comments
 (0)