Skip to content

Commit ecb47df

Browse files
committed
Introduce build-level vals for the default Scala versions.
This avoids repeating them in several places the build, potentially creating mismatches.
1 parent 799f50d commit ecb47df

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

project/Build.scala

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,13 @@ object Build {
242242
isGeneratingForIDE
243243
}
244244

245+
import MultiScalaProject.{
246+
Default2_11ScalaVersion,
247+
Default2_12ScalaVersion,
248+
Default2_13ScalaVersion,
249+
DefaultScalaVersion
250+
}
251+
245252
val scalastyleCheck = taskKey[Unit]("Run scalastyle")
246253

247254
val fetchScalaSource = taskKey[File](
@@ -258,7 +265,7 @@ object Build {
258265
val previousBinaryCrossVersion = CrossVersion.binaryWith("sjs1_", "")
259266

260267
val scalaVersionsUsedForPublishing: Set[String] =
261-
Set("2.11.12", "2.12.14", "2.13.6")
268+
Set(Default2_11ScalaVersion, Default2_12ScalaVersion, Default2_13ScalaVersion)
262269
val newScalaBinaryVersionsInThisRelease: Set[String] =
263270
Set()
264271

@@ -870,7 +877,7 @@ object Build {
870877
MyScalaJSPlugin
871878
).settings(
872879
commonSettings,
873-
scalaVersion := "2.12.14",
880+
scalaVersion := DefaultScalaVersion,
874881
fatalWarningsSettings,
875882
name := "Scala.js linker private library",
876883
publishArtifact in Compile := false,
@@ -1062,7 +1069,7 @@ object Build {
10621069
name := "Scala.js sbt plugin",
10631070
normalizedName := "sbt-scalajs",
10641071
sbtPlugin := true,
1065-
crossScalaVersions := Seq("2.12.14"),
1072+
crossScalaVersions := Seq(DefaultScalaVersion),
10661073
scalaVersion := crossScalaVersions.value.head,
10671074
sbtVersion := "1.0.0",
10681075
scalaBinaryVersion :=
@@ -1682,23 +1689,23 @@ object Build {
16821689

16831690
MyScalaJSPlugin.expectedSizes := {
16841691
scalaVersion.value match {
1685-
case "2.11.12" =>
1692+
case Default2_11ScalaVersion =>
16861693
Some(ExpectedSizes(
16871694
fastLink = 520000 to 521000,
16881695
fullLink = 108000 to 109000,
16891696
fastLinkGz = 66000 to 67000,
16901697
fullLinkGz = 28000 to 29000,
16911698
))
16921699

1693-
case "2.12.14" =>
1700+
case Default2_12ScalaVersion =>
16941701
Some(ExpectedSizes(
16951702
fastLink = 782000 to 783000,
16961703
fullLink = 150000 to 151000,
16971704
fastLinkGz = 92000 to 93000,
16981705
fullLinkGz = 36000 to 37000,
16991706
))
17001707

1701-
case "2.13.6" =>
1708+
case Default2_13ScalaVersion =>
17021709
Some(ExpectedSizes(
17031710
fastLink = 777000 to 778000,
17041711
fullLink = 169000 to 170000,

project/MultiScalaProject.scala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,15 @@ object MultiScalaProject {
8383
"2.13" -> Seq("2.13.0", "2.13.1", "2.13.2", "2.13.3", "2.13.4", "2.13.5", "2.13.6"),
8484
)
8585

86+
val Default2_11ScalaVersion = versions("2.11").last
87+
val Default2_12ScalaVersion = versions("2.12").last
88+
val Default2_13ScalaVersion = versions("2.13").last
89+
90+
/** The default Scala version is the default 2.12 Scala version, because it
91+
* must work for sbt plugins.
92+
*/
93+
val DefaultScalaVersion = Default2_12ScalaVersion
94+
8695
private final val ideVersion = "2.12"
8796

8897
private def projectID(id: String, major: String) = id + major.replace('.', '_')

0 commit comments

Comments
 (0)