Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Scala 3 Next to 3.5.0 #3093

Merged
merged 2 commits into from
Aug 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -1003,6 +1003,7 @@ trait CliIntegration extends SbtModule with ScalaCliPublishModule with HasTests
| def scala3Lts = "${Scala.scala3Lts}"
| def scala3NextRc = "${Scala.scala3NextRc}"
| def scala3Next = "${Scala.scala3Next}"
| def scala3NextAnnounced = "${Scala.scala3NextAnnounced}"
| def defaultScala = "${Scala.defaultUser}"
| def defaultScalafmtVersion = "${Deps.scalafmtCli.dep.version}"
| def maxAmmoniteScala212Version = "${Scala.maxAmmoniteScala212Version}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1967,13 +1967,42 @@ abstract class RunTestDefinitions
}
}

if (!actualScalaVersion.contains("RC"))
test("offline mode should fail on missing artifacts") {
if (!actualScalaVersion.contains("RC")) {
val actualAnnouncedScalaVersion = actualScalaVersion match {
case _
if actualScalaVersion == Constants.scala3Next &&
Constants.scala3Next != Constants.scala3NextAnnounced =>
Gedochao marked this conversation as resolved.
Show resolved Hide resolved
// if the version isn't public yet, Coursier won't be able to install it
Constants.scala3NextAnnounced
case s => s
}

test(
s"offline mode should fail on missing artifacts (with Scala $actualAnnouncedScalaVersion)"
) {
// Kill bloop deamon to test scalac fallback
os.proc(TestUtil.cli, "--power", "bloop", "exit")
.call(cwd = os.pwd)

val depScalaVersion = actualScalaVersion match {
// ensure extra options use an announced Scala version
val customExtraOptions: Seq[String] =
if (
scalaVersionOpt.isEmpty &&
Constants.scala3Next != Constants.scala3NextAnnounced
)
extraOptions ++ Seq("--scala", actualAnnouncedScalaVersion)
else if (
actualScalaVersion == Constants.scala3Next &&
actualScalaVersion != actualAnnouncedScalaVersion
)
extraOptions
.map {
case opt if opt == Constants.scala3Next => actualAnnouncedScalaVersion
case opt => opt
}
else extraOptions

val depScalaVersion = actualAnnouncedScalaVersion match {
case sv if sv.startsWith("2.12") => "2.12"
case sv if sv.startsWith("2.13") => "2.13"
case _ => "3"
Expand Down Expand Up @@ -2008,7 +2037,7 @@ abstract class RunTestDefinitions
TestUtil.cli,
"--power",
"NoDeps.scala",
extraOptions,
customExtraOptions,
"--offline",
"--cache",
cachePath.toString
Expand All @@ -2020,19 +2049,23 @@ abstract class RunTestDefinitions
expect(emptyCacheWalkSize == os.walk(cachePath).size)

// Download the artifacts for scala
os.proc(TestUtil.cs, "install", s"scala:$actualScalaVersion")
os.proc(TestUtil.cs, "install", s"scala:$actualAnnouncedScalaVersion")
.call(cwd = root, env = extraEnv)
os.proc(TestUtil.cs, "install", s"scalac:$actualScalaVersion")
os.proc(TestUtil.cs, "install", s"scalac:$actualAnnouncedScalaVersion")
.call(cwd = root, env = extraEnv)
(if (actualScalaVersion.startsWith("3")) Some("scala3-sbt-bridge")
(if (actualAnnouncedScalaVersion.startsWith("3")) Some("scala3-sbt-bridge")
else if (
actualScalaVersion.startsWith("2.13.") &&
actualScalaVersion.coursierVersion >= "2.13.12".coursierVersion
actualAnnouncedScalaVersion.startsWith("2.13.") &&
actualAnnouncedScalaVersion.coursierVersion >= "2.13.12".coursierVersion
)
Some("scala2-sbt-bridge")
else None)
.foreach { bridgeArtifactName =>
os.proc(TestUtil.cs, "fetch", s"org.scala-lang:$bridgeArtifactName:$actualScalaVersion")
os.proc(
TestUtil.cs,
"fetch",
s"org.scala-lang:$bridgeArtifactName:$actualAnnouncedScalaVersion"
)
.call(cwd = root, env = extraEnv)
}

Expand All @@ -2046,7 +2079,7 @@ abstract class RunTestDefinitions
TestUtil.cli,
"--power",
"NoDeps.scala",
extraOptions,
customExtraOptions,
"--offline",
"--cache",
cachePath.toString,
Expand Down Expand Up @@ -2076,7 +2109,7 @@ abstract class RunTestDefinitions
"--power",
cliOption,
"WithDeps.scala",
extraOptions,
customExtraOptions,
"--cache",
cachePath.toString
)
Expand All @@ -2098,7 +2131,7 @@ abstract class RunTestDefinitions
TestUtil.cli,
"--power",
"WithDeps.scala",
extraOptions,
customExtraOptions,
"--offline",
"--cache",
cachePath.toString,
Expand All @@ -2118,6 +2151,7 @@ abstract class RunTestDefinitions
expect(withDependencyCacheWalkSize == os.walk(cachePath).size)
}
}
}

test("JVM id is printed with compilation info correctly") {
val msg = "Hello"
Expand Down
17 changes: 10 additions & 7 deletions project/deps.sc
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ object Scala {
def scala213 = "2.13.14"
def runnerScala3 = "3.0.2" // the newest version that is compatible with all Scala 3.x versions
def scala3LtsPrefix = "3.3" // used for the LTS version tags
def scala3Lts = s"$scala3LtsPrefix.3" // the LTS version currently used in the build
def scala3Next = "3.4.2" // the newest/next version of Scala
def scala3NextRc = "3.5.0-RC7" // the latest RC version of Scala Next
def scala3Lts = s"$scala3LtsPrefix.3" // the LTS version currently used in the build
def scala3Next = "3.5.0" // the newest/next version of Scala
def scala3NextAnnounced = "3.4.2" // the newest/next version of Scala that's been announced
Gedochao marked this conversation as resolved.
Show resolved Hide resolved
def scala3NextRc = "3.5.0-RC7" // the latest RC version of Scala Next

// The Scala version used to build the CLI itself.
def defaultInternal = sys.props.get("scala.version.internal").getOrElse(scala3Lts)
Expand Down Expand Up @@ -38,19 +39,21 @@ object Scala {
val max31 = 3
val max32 = 2
val max33 = patchVer(scala3Lts)
val max34 = patchVer(scala3Next)
val max34 = 3
val max35 = patchVer(scala3Next)
(8 until max212).map(i => s"2.12.$i") ++ Seq(scala212) ++
(0 until max213).map(i => s"2.13.$i") ++ Seq(scala213) ++
(0 to max30).map(i => s"3.0.$i") ++
(0 to max31).map(i => s"3.1.$i") ++
(0 to max32).map(i => s"3.2.$i") ++
(0 until max33).map(i => s"3.3.$i") ++
(0 until max34).map(i => s"3.4.$i") ++ Seq(scala3Next)
(0 to max33).map(i => s"3.3.$i") ++
(0 to max34).map(i => s"3.4.$i") ++
(0 until max35).map(i => s"3.5.$i") ++ Seq(scala3Next)
}

def maxAmmoniteScala212Version = scala212
def maxAmmoniteScala213Version = scala213
def maxAmmoniteScala3Version = scala3Next
def maxAmmoniteScala3Version = scala3NextAnnounced
lazy val listMaxAmmoniteScalaVersion =
Seq(maxAmmoniteScala212Version, maxAmmoniteScala213Version, maxAmmoniteScala3Version)
lazy val listAllAmmonite = {
Expand Down
2 changes: 1 addition & 1 deletion website/docs/reference/cli-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -1533,7 +1533,7 @@ Available in commands:

Aliases: `-S`, `--scala`

Set the Scala version (3.4.2 by default)
Set the Scala version (3.5.0 by default)

### `--scala-binary-version`

Expand Down
2 changes: 1 addition & 1 deletion website/docs/reference/scala-command/cli-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -996,7 +996,7 @@ Aliases: `-S`, `--scala`

`MUST have` per Scala Runner specification

Set the Scala version (3.4.2 by default)
Set the Scala version (3.5.0 by default)

### `--scala-binary-version`

Expand Down
18 changes: 9 additions & 9 deletions website/docs/reference/scala-command/runner-specification.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ Aliases: `-P` ,`--plugin`

**--scala-version**

Set the Scala version (3.4.2 by default)
Set the Scala version (3.5.0 by default)

Aliases: `-S` ,`--scala`

Expand Down Expand Up @@ -861,7 +861,7 @@ Aliases: `-P` ,`--plugin`

**--scala-version**

Set the Scala version (3.4.2 by default)
Set the Scala version (3.5.0 by default)

Aliases: `-S` ,`--scala`

Expand Down Expand Up @@ -1450,7 +1450,7 @@ Aliases: `-P` ,`--plugin`

**--scala-version**

Set the Scala version (3.4.2 by default)
Set the Scala version (3.5.0 by default)

Aliases: `-S` ,`--scala`

Expand Down Expand Up @@ -2059,7 +2059,7 @@ Aliases: `-P` ,`--plugin`

**--scala-version**

Set the Scala version (3.4.2 by default)
Set the Scala version (3.5.0 by default)

Aliases: `-S` ,`--scala`

Expand Down Expand Up @@ -2687,7 +2687,7 @@ Aliases: `-P` ,`--plugin`

**--scala-version**

Set the Scala version (3.4.2 by default)
Set the Scala version (3.5.0 by default)

Aliases: `-S` ,`--scala`

Expand Down Expand Up @@ -3303,7 +3303,7 @@ Aliases: `-P` ,`--plugin`

**--scala-version**

Set the Scala version (3.4.2 by default)
Set the Scala version (3.5.0 by default)

Aliases: `-S` ,`--scala`

Expand Down Expand Up @@ -3938,7 +3938,7 @@ Aliases: `-P` ,`--plugin`

**--scala-version**

Set the Scala version (3.4.2 by default)
Set the Scala version (3.5.0 by default)

Aliases: `-S` ,`--scala`

Expand Down Expand Up @@ -4636,7 +4636,7 @@ Aliases: `-P` ,`--plugin`

**--scala-version**

Set the Scala version (3.4.2 by default)
Set the Scala version (3.5.0 by default)

Aliases: `-S` ,`--scala`

Expand Down Expand Up @@ -5569,7 +5569,7 @@ Aliases: `-P` ,`--plugin`

**--scala-version**

Set the Scala version (3.4.2 by default)
Set the Scala version (3.5.0 by default)

Aliases: `-S` ,`--scala`

Expand Down
3 changes: 2 additions & 1 deletion website/docs/reference/scala-versions.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ it is recommended to update scala-cli.
| 1.2.0 - 1.2.1 | 3.4.0 | 2.13.13 | 2.12.19 |
| 1.2.1 - 1.3.0 | 3.4.1 | 2.13.13 | 2.12.19 |
| 1.3.1 | 3.4.1 | 2.13.14 | 2.12.19 |
| 1.3.2 - current | 3.4.2 | 2.13.14 | 2.12.19 |
| 1.3.2 - 1.4.3 | 3.4.2 | 2.13.14 | 2.12.19 |
| 1.5.0 - current | 3.5.0 | 2.13.14 | 2.12.19 |

Loading