Skip to content

Commit 989e963

Browse files
authored
Merge pull request #1358 from romanowski/fix-lazy-vals
Compile runners with 3.0.2
2 parents 5ab4899 + ab53e44 commit 989e963

File tree

3 files changed

+33
-15
lines changed

3 files changed

+33
-15
lines changed

build.sc

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ object scalaparse extends ScalaParse
4747
object directives extends Directives
4848
object core extends Core
4949
object `build-module` extends Build
50-
object runner extends Cross[Runner](Scala.all: _*)
51-
object `test-runner` extends Cross[TestRunner](Scala.all: _*)
50+
object runner extends Cross[Runner](Scala.runnerScalaVersions: _*)
51+
object `test-runner` extends Cross[TestRunner](Scala.runnerScalaVersions: _*)
5252
object `bloop-rifle` extends Cross[BloopRifle](Scala.all: _*)
5353
object `tasty-lib` extends Cross[TastyLib](Scala.all: _*)
5454
// Runtime classes used within native image on Scala 3 replacing runtime from Scala
@@ -298,16 +298,16 @@ trait Core extends ScalaCliSbtModule with ScalaCliPublishModule with HasTests
298298
def constantsFile = T.persistent {
299299
val dir = T.dest / "constants"
300300
val dest = dir / "Constants.scala"
301-
val testRunnerMainClass = `test-runner`(Scala.defaultInternal)
301+
val testRunnerMainClass = `test-runner`(Scala.runnerScala3)
302302
.mainClass()
303303
.getOrElse(sys.error("No main class defined for test-runner"))
304-
val runnerMainClass = runner(Scala.defaultInternal)
304+
val runnerMainClass = runner(Scala.runnerScala3)
305305
.mainClass()
306306
.getOrElse(sys.error("No main class defined for runner"))
307307
val detailedVersionValue =
308308
if (`local-repo`.developingOnStubModules) s"""Some("${vcsState()}")"""
309309
else "None"
310-
val testRunnerOrganization = `test-runner`(Scala.defaultInternal)
310+
val testRunnerOrganization = `test-runner`(Scala.runnerScala3)
311311
.pomSettings()
312312
.organization
313313
val code =
@@ -331,13 +331,13 @@ trait Core extends ScalaCliSbtModule with ScalaCliPublishModule with HasTests
331331
| def stubsVersion = "${stubs.publishVersion()}"
332332
|
333333
| def testRunnerOrganization = "$testRunnerOrganization"
334-
| def testRunnerModuleName = "${`test-runner`(Scala.defaultInternal).artifactName()}"
335-
| def testRunnerVersion = "${`test-runner`(Scala.defaultInternal).publishVersion()}"
334+
| def testRunnerModuleName = "${`test-runner`(Scala.runnerScala3).artifactName()}"
335+
| def testRunnerVersion = "${`test-runner`(Scala.runnerScala3).publishVersion()}"
336336
| def testRunnerMainClass = "$testRunnerMainClass"
337337
|
338-
| def runnerOrganization = "${runner(Scala.defaultInternal).pomSettings().organization}"
339-
| def runnerModuleName = "${runner(Scala.defaultInternal).artifactName()}"
340-
| def runnerVersion = "${runner(Scala.defaultInternal).publishVersion()}"
338+
| def runnerOrganization = "${runner(Scala.runnerScala3).pomSettings().organization}"
339+
| def runnerModuleName = "${runner(Scala.runnerScala3).artifactName()}"
340+
| def runnerVersion = "${runner(Scala.runnerScala3).publishVersion()}"
341341
| def runnerMainClass = "$runnerMainClass"
342342
|
343343
| def semanticDbPluginOrganization = "${Deps.scalametaTrees.dep.module.organization.value}"
@@ -527,7 +527,7 @@ trait Build extends ScalaCliSbtModule with ScalaCliPublishModule with HasTests
527527
scalaparse,
528528
directives,
529529
`scala-cli-bsp`,
530-
`test-runner`(scalaVer),
530+
`test-runner`(Scala.scala213), // Depending on version compiled with Scala 3 pulls older stdlib
531531
`tasty-lib`(scalaVer)
532532
)
533533
def scalacOptions = T {
@@ -668,8 +668,7 @@ trait Cli extends SbtModule with ProtoBuildModule with CliLaunchers
668668
def moduleDeps = Seq(
669669
`build-module`,
670670
`cli-options`,
671-
`test-runner`(myScalaVersion),
672-
`scala3-graal`(myScalaVersion)
671+
`scala3-graal`(Scala.scala3)
673672
)
674673

675674
def repositories = super.repositories ++ customRepositories
@@ -1071,12 +1070,12 @@ object `local-repo` extends LocalRepo {
10711070
stubs
10721071
)
10731072
val crossModules = for {
1074-
sv <- Scala.all
1073+
sv <- Scala.runnerScalaVersions
10751074
proj <- Seq(runner, `test-runner`)
10761075
} yield proj(sv)
10771076
javaModules ++ crossModules
10781077
}
1079-
def version = runner(Scala.defaultInternal).publishVersion()
1078+
def version = runner(Scala.runnerScala3).publishVersion()
10801079
}
10811080

10821081
// Helper CI commands

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2219,6 +2219,23 @@ abstract class RunTestDefinitions(val scalaVersionOpt: Option[String])
22192219
}
22202220
}
22212221

2222+
if (actualScalaVersion.startsWith("3"))
2223+
test("should throw exception for code compiled by scala 3.1.3") {
2224+
val exceptionMsg = "Throw exception in Scala"
2225+
val inputs = TestInputs(
2226+
os.rel / "hello.sc" ->
2227+
s"""//> using scala "3.1.3"
2228+
|throw new Exception("$exceptionMsg")""".stripMargin
2229+
)
2230+
2231+
inputs.fromRoot { root =>
2232+
val res =
2233+
os.proc(TestUtil.cli, "hello.sc").call(cwd = root, mergeErrIntoOut = true, check = false)
2234+
val output = res.out.trim()
2235+
expect(output.contains(exceptionMsg))
2236+
}
2237+
}
2238+
22222239
private def maybeScalapyPrefix =
22232240
if (actualScalaVersion.startsWith("2.13.")) ""
22242241
else "import me.shadaj.scalapy.py" + System.lineSeparator()

project/deps.sc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ import scala.util.Properties
66
object Scala {
77
def scala212 = "2.12.16"
88
def scala213 = "2.13.8"
9+
def runnerScala3 = "3.0.2" // the newest version that is compatible with all Scala 3.x versions
910
def scala3 = "3.2.0"
1011
val allScala2 = Seq(scala213, scala212)
1112
val all = allScala2 ++ Seq(scala3)
1213
val mainVersions = Seq(scala3, scala213)
14+
val runnerScalaVersions = runnerScala3 +: allScala2
1315

1416
def scalaJs = "1.10.1"
1517

0 commit comments

Comments
 (0)