Skip to content

Commit

Permalink
Add Scala 3 aliases, limit release, adjust target
Browse files Browse the repository at this point in the history
  • Loading branch information
som-snytt committed Mar 28, 2022
1 parent 9036bd4 commit f84aa78
Showing 1 changed file with 6 additions and 3 deletions.
Expand Up @@ -69,8 +69,11 @@ trait StandardScalaSettings { _: MutableSettings =>
if (releaseValue.map(_.toInt < setting.value.toInt).getOrElse(false)) errorFn("-release cannot be less than -target")
}
.withAbbreviation("--target")
.withAbbreviation("--Xtarget")
.withAbbreviation("-Xtarget")
.withAbbreviation("-Xunchecked-java-output-version")
.withDeprecationMessage("Use -release instead to compile against the correct platform API.")
def targetValue: String = target.valueSetByUser.orElse(releaseValue).getOrElse(target.value)
def targetValue: String = releaseValue.getOrElse(target.value)
val unchecked = BooleanSetting ("-unchecked", "Enable additional warnings where generated code depends on assumptions. See also -Wconf.") withAbbreviation "--unchecked" withPostSetHook { s =>
if (s.value) Wconf.tryToSet(List(s"cat=unchecked:w"))
else Wconf.tryToSet(List(s"cat=unchecked:s"))
Expand All @@ -84,6 +87,7 @@ trait StandardScalaSettings { _: MutableSettings =>
// Support passe prefixes of -target values:
// - `jvm-` (from back when we also had `msil`)
// - `1.` (from back when Java 2 was a possibility)
// Otherwise, `-release` could be `IntSetting`.
private def normalizeTarget(in: String): String = {
val jvmish = raw"jvm-(\d*)".r
in match {
Expand All @@ -95,9 +99,8 @@ trait StandardScalaSettings { _: MutableSettings =>
}

object StandardScalaSettings {
// not final in case some separately compiled client code wanted to depend on updated values
val MinTargetVersion = 8
val MaxTargetVersion = 18
val MaxTargetVersion = javaSpecVersion.toInt

private val AllTargetVersions = (MinTargetVersion to MaxTargetVersion).map(_.toString).to(List)
}

0 comments on commit f84aa78

Please sign in to comment.