Skip to content

Commit 9d47089

Browse files
authored
Merge pull request #2465 from Gedochao/maintenance/scala-native-improvements
Bump Scala Native to 0.4.16 & log platform version
2 parents aabbb04 + 7b103f1 commit 9d47089

File tree

7 files changed

+56
-15
lines changed

7 files changed

+56
-15
lines changed

modules/integration/src/test/scala/scala/cli/integration/RunScalaJsTestDefinitions.scala

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,4 +265,22 @@ trait RunScalaJsTestDefinitions { _: RunTestDefinitions =>
265265
expect(output == "H")
266266
}
267267
}
268+
269+
test("js defaults & toolkit latest") {
270+
val msg = "Hello"
271+
TestInputs(
272+
os.rel / "script.sc" ->
273+
s"""//> using toolkit latest
274+
|//> using platform "scala-js"
275+
|import scala.scalajs.js
276+
|val console = js.Dynamic.global.console
277+
|val jsonString = "{\\"msg\\": \\"$msg\\"}"
278+
|val json: ujson.Value = ujson.read(jsonString)
279+
|console.log(json("msg").str)
280+
|""".stripMargin
281+
).fromRoot { root =>
282+
val result = os.proc(TestUtil.cli, "run", "script.sc").call(cwd = root)
283+
expect(result.out.trim() == msg)
284+
}
285+
}
268286
}

modules/integration/src/test/scala/scala/cli/integration/RunScalaNativeTestDefinitions.scala

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,4 +300,17 @@ trait RunScalaNativeTestDefinitions { _: RunTestDefinitions =>
300300
expect(output2 == "Hello from Main2")
301301
}
302302
}
303+
304+
test("native defaults & toolkit latest") {
305+
TestInputs(
306+
os.rel / "script.sc" ->
307+
"""//> using toolkit latest
308+
|//> using platform "scala-native"
309+
|println(os.pwd)
310+
|""".stripMargin
311+
).fromRoot { root =>
312+
val result = os.proc(TestUtil.cli, "run", "script.sc").call(cwd = root)
313+
expect(result.out.trim() == root.toString)
314+
}
315+
}
303316
}

modules/options/src/main/scala/scala/build/options/BuildOptions.scala

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,19 @@ final case class BuildOptions(
5656
value(scalaParams) match {
5757
case Some(scalaParams0) =>
5858
val platform0 = platform.value match {
59-
case Platform.JVM => "JVM"
60-
case Platform.JS => "Scala.js"
61-
case Platform.Native => "Scala Native"
59+
case Platform.JVM =>
60+
val jvmIdSuffix =
61+
javaOptions.jvmIdOpt
62+
.orElse(Some(javaHome().value.version.toString))
63+
.map(" (" + _ + ")").getOrElse("")
64+
s"JVM$jvmIdSuffix"
65+
case Platform.JS =>
66+
val scalaJsVersion = scalaJsOptions.version.getOrElse(Constants.scalaJsVersion)
67+
s"Scala.js $scalaJsVersion"
68+
case Platform.Native =>
69+
val scalaNativeVersion =
70+
scalaNativeOptions.version.getOrElse(Constants.scalaNativeVersion)
71+
s"Scala Native $scalaNativeVersion"
6272
}
6373
Seq(s"Scala ${scalaParams0.scalaVersion}", platform0)
6474
case None =>

project/deps.sc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ object Deps {
9191
def jsoniterScala = "2.23.2"
9292
def jsoniterScalaJava8 = "2.13.5.2"
9393
def scalaMeta = "4.8.11"
94-
def scalaNative = "0.4.15"
94+
def scalaNative = "0.4.16"
9595
def scalaPackager = "0.1.29"
9696
def signingCli = "0.2.2"
9797
def signingCliJvmVersion = 17

website/docs/reference/cli-options.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1337,7 +1337,7 @@ Enable Scala Native. To show more options for Scala Native pass `--help-native`
13371337

13381338
### `--native-version`
13391339

1340-
Set the Scala Native version (0.4.15 by default).
1340+
Set the Scala Native version (0.4.16 by default).
13411341

13421342
### `--native-mode`
13431343

website/docs/reference/scala-command/cli-options.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,7 @@ Enable Scala Native. To show more options for Scala Native pass `--help-native`
826826

827827
`SHOULD have` per Scala Runner specification
828828

829-
Set the Scala Native version (0.4.15 by default).
829+
Set the Scala Native version (0.4.16 by default).
830830

831831
### `--native-mode`
832832

website/docs/reference/scala-command/runner-specification.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ Enable Scala Native. To show more options for Scala Native pass `--help-native`
168168

169169
**--native-version**
170170

171-
Set the Scala Native version (0.4.15 by default).
171+
Set the Scala Native version (0.4.16 by default).
172172

173173
**--native-mode**
174174

@@ -911,7 +911,7 @@ Enable Scala Native. To show more options for Scala Native pass `--help-native`
911911

912912
**--native-version**
913913

914-
Set the Scala Native version (0.4.15 by default).
914+
Set the Scala Native version (0.4.16 by default).
915915

916916
**--native-mode**
917917

@@ -1458,7 +1458,7 @@ Enable Scala Native. To show more options for Scala Native pass `--help-native`
14581458

14591459
**--native-version**
14601460

1461-
Set the Scala Native version (0.4.15 by default).
1461+
Set the Scala Native version (0.4.16 by default).
14621462

14631463
**--native-mode**
14641464

@@ -2031,7 +2031,7 @@ Enable Scala Native. To show more options for Scala Native pass `--help-native`
20312031

20322032
**--native-version**
20332033

2034-
Set the Scala Native version (0.4.15 by default).
2034+
Set the Scala Native version (0.4.16 by default).
20352035

20362036
**--native-mode**
20372037

@@ -2623,7 +2623,7 @@ Enable Scala Native. To show more options for Scala Native pass `--help-native`
26232623

26242624
**--native-version**
26252625

2626-
Set the Scala Native version (0.4.15 by default).
2626+
Set the Scala Native version (0.4.16 by default).
26272627

26282628
**--native-mode**
26292629

@@ -3191,7 +3191,7 @@ Enable Scala Native. To show more options for Scala Native pass `--help-native`
31913191

31923192
**--native-version**
31933193

3194-
Set the Scala Native version (0.4.15 by default).
3194+
Set the Scala Native version (0.4.16 by default).
31953195

31963196
**--native-mode**
31973197

@@ -3796,7 +3796,7 @@ Enable Scala Native. To show more options for Scala Native pass `--help-native`
37963796

37973797
**--native-version**
37983798

3799-
Set the Scala Native version (0.4.15 by default).
3799+
Set the Scala Native version (0.4.16 by default).
38003800

38013801
**--native-mode**
38023802

@@ -4452,7 +4452,7 @@ Enable Scala Native. To show more options for Scala Native pass `--help-native`
44524452

44534453
**--native-version**
44544454

4455-
Set the Scala Native version (0.4.15 by default).
4455+
Set the Scala Native version (0.4.16 by default).
44564456

44574457
**--native-mode**
44584458

@@ -5339,7 +5339,7 @@ Enable Scala Native. To show more options for Scala Native pass `--help-native`
53395339

53405340
**--native-version**
53415341

5342-
Set the Scala Native version (0.4.15 by default).
5342+
Set the Scala Native version (0.4.16 by default).
53435343

53445344
**--native-mode**
53455345

0 commit comments

Comments
 (0)