Skip to content

Commit

Permalink
Update Scala to 3.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Gedochao committed Feb 16, 2024
1 parent 6b7a100 commit 8782247
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 16 deletions.
3 changes: 3 additions & 0 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,9 @@ trait CliIntegration extends SbtModule with ScalaCliPublishModule with HasTests
| def scala3 = "${Scala.scala3}"
| def defaultScala = "${Scala.defaultUser}"
| def defaultScalafmtVersion = "${Deps.scalafmtCli.dep.version}"
| def maxAmmoniteScala212Version = "${Scala.maxAmmoniteScala212Version}"
| def maxAmmoniteScala213Version = "${Scala.maxAmmoniteScala213Version}"
| def maxAmmoniteScala3Version = "${Scala.maxAmmoniteScala3Version}"
| def scalaJsVersion = "${Scala.scalaJs}"
| def scalaJsCliVersion = "${Scala.scalaJsCli}"
| def scalaNativeVersion = "${Deps.nativeTools.dep.version}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,23 @@ abstract class ReplTestDefinitions(val scalaVersionOpt: Option[String])
"scala.util.Properties.versionNumberString"
else "dotty.tools.dotc.config.Properties.simpleVersionString"

def expectedAmmoniteVersion: String =
actualScalaVersion match {
case s
if s.startsWith("2.12") &&
Constants.maxAmmoniteScala212Version.coursierVersion < s.coursierVersion =>
Constants.maxAmmoniteScala212Version
case s
if s.startsWith("2.13") &&
Constants.maxAmmoniteScala213Version.coursierVersion < s.coursierVersion =>
Constants.maxAmmoniteScala213Version
case s
if s.startsWith("3") &&
Constants.maxAmmoniteScala3Version.coursierVersion < s.coursierVersion =>
Constants.maxAmmoniteScala3Version
case s => s
}

test("default dry run") {
TestInputs.empty.fromRoot { root =>
os.proc(TestUtil.cli, "repl", extraOptions, "--repl-dry-run").call(cwd = root)
Expand All @@ -38,7 +55,7 @@ abstract class ReplTestDefinitions(val scalaVersionOpt: Option[String])
root
)
val output = res.out.trim()
expect(output == s"Hello from Scala $actualScalaVersion")
expect(output == s"Hello from Scala $expectedAmmoniteVersion")
}
}

Expand Down Expand Up @@ -97,7 +114,15 @@ abstract class ReplTestDefinitions(val scalaVersionOpt: Option[String])
ammArgs
).call(cwd = root)
val lines = res.out.trim().linesIterator.toVector
expect(lines == Seq(s"Hello from Scala $actualScalaVersion", "Hello from ScalaPy"))
val actualMaxAmmoniteVersion =
if (actualScalaVersion.startsWith("2.12")) Constants.maxAmmoniteScala212Version
else if (actualScalaVersion.startsWith("2.12")) Constants.maxAmmoniteScala213Version
else Constants.maxAmmoniteScala3Version
val expectedAmmoniteVersion =
if (actualMaxAmmoniteVersion.coursierVersion < actualScalaVersion.coursierVersion)
actualMaxAmmoniteVersion
else actualScalaVersion
expect(lines == Seq(s"Hello from Scala $expectedAmmoniteVersion", "Hello from ScalaPy"))
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package scala.cli

import coursier.core.Version

import java.util.concurrent.CompletableFuture

import scala.concurrent.{Future, Promise}
Expand All @@ -20,4 +22,8 @@ package object integration {
}
}

implicit class VersionString(private val s: String) {
def coursierVersion: Version = Version(s)
}

}
4 changes: 2 additions & 2 deletions project/deps.sc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ object Scala {
def scala212 = "2.12.18"
def scala213 = "2.13.12"
def runnerScala3 = "3.0.2" // the newest version that is compatible with all Scala 3.x versions
def scala3 = "3.3.1"
def scala3 = "3.4.0"
def scala3Lts = "3.3" // the full version should be resolved later

// The Scala version used to build the CLI itself.
Expand Down Expand Up @@ -41,7 +41,7 @@ object Scala {

def maxAmmoniteScala212Version = scala212
def maxAmmoniteScala213Version = scala213
def maxAmmoniteScala3Version = scala3
def maxAmmoniteScala3Version = "3.3.1"
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 @@ -1469,7 +1469,7 @@ Available in commands:

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

Set the Scala version (3.3.1 by default)
Set the Scala version (3.4.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 @@ -954,7 +954,7 @@ Aliases: `-S`, `--scala`

`MUST have` per Scala Runner specification

Set the Scala version (3.3.1 by default)
Set the Scala version (3.4.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 @@ -86,7 +86,7 @@ Aliases: `-P` ,`--plugin`

**--scala-version**

Set the Scala version (3.3.1 by default)
Set the Scala version (3.4.0 by default)

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

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

**--scala-version**

Set the Scala version (3.3.1 by default)
Set the Scala version (3.4.0 by default)

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

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

**--scala-version**

Set the Scala version (3.3.1 by default)
Set the Scala version (3.4.0 by default)

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

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

**--scala-version**

Set the Scala version (3.3.1 by default)
Set the Scala version (3.4.0 by default)

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

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

**--scala-version**

Set the Scala version (3.3.1 by default)
Set the Scala version (3.4.0 by default)

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

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

**--scala-version**

Set the Scala version (3.3.1 by default)
Set the Scala version (3.4.0 by default)

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

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

**--scala-version**

Set the Scala version (3.3.1 by default)
Set the Scala version (3.4.0 by default)

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

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

**--scala-version**

Set the Scala version (3.3.1 by default)
Set the Scala version (3.4.0 by default)

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

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

**--scala-version**

Set the Scala version (3.3.1 by default)
Set the Scala version (3.4.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 @@ -20,5 +20,6 @@ it is recommended to update scala-cli.
| 0.1.20 - 1.0.0-RC2 | 3.2.2 | 2.13.10 | 2.12.17 |
| 1.0.0 - 1.0.1 | 3.3.0 | 2.13.10 | 2.12.17 |
| 1.0.1 - 1.0.4 | 3.3.0 | 2.13.11 | 2.12.18 |
| 1.0.5 - current | 3.3.1 | 2.13.12 | 2.12.18 |
| 1.0.5 - 1.1.3 | 3.3.1 | 2.13.12 | 2.12.18 |
| 1.2.0 - current | 3.4.0 | 2.13.12 | 2.12.18 |

0 comments on commit 8782247

Please sign in to comment.