Skip to content

Commit d733914

Browse files
committed
Cross compile the runner module against Scala 3 Next versions
1 parent 3c5970b commit d733914

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

build.mill.scala

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ object directives extends Cross[Directives](Scala.scala3MainVersions)
104104
object core extends Cross[Core](Scala.scala3MainVersions) with CrossScalaDefaultToInternal
105105
object `build-module` extends Cross[Build](Scala.scala3MainVersions)
106106
with CrossScalaDefaultToInternal
107-
object runner extends Runner
107+
object runner extends Cross[Runner](Scala.runnerScalaVersions) with CrossScalaDefaultToRunner
108108
object `test-runner` extends TestRunner
109109
object `tasty-lib` extends Cross[TastyLib](Scala.scala3MainVersions)
110110
with CrossScalaDefaultToInternal
@@ -439,7 +439,7 @@ trait Core extends ScalaCliCrossSbtModule
439439
val testRunnerMainClass = `test-runner`
440440
.mainClass()
441441
.getOrElse(sys.error("No main class defined for test-runner"))
442-
val runnerMainClass = build.runner
442+
val runnerMainClass = build.runner(crossScalaVersion)
443443
.mainClass()
444444
.getOrElse(sys.error("No main class defined for runner"))
445445
val detailedVersionValue =
@@ -469,9 +469,9 @@ trait Core extends ScalaCliCrossSbtModule
469469
| def testRunnerVersion = "${`test-runner`.publishVersion()}"
470470
| def testRunnerMainClass = "$testRunnerMainClass"
471471
|
472-
| def runnerOrganization = "${build.runner.pomSettings().organization}"
473-
| def runnerModuleName = "${build.runner.artifactName()}"
474-
| def runnerVersion = "${build.runner.publishVersion()}"
472+
| def runnerOrganization = "${build.runner(crossScalaVersion).pomSettings().organization}"
473+
| def runnerModuleName = "${build.runner(crossScalaVersion).artifactName()}"
474+
| def runnerVersion = "${build.runner(crossScalaVersion).publishVersion()}"
475475
| def runnerScala30LegacyVersion = "${Cli.runnerScala30LegacyVersion}"
476476
| def runnerScala2LegacyVersion = "${Cli.runnerScala2LegacyVersion}"
477477
| def runnerMainClass = "$runnerMainClass"
@@ -1258,17 +1258,17 @@ trait CliIntegrationDocker extends SbtModule with ScalaCliPublishModule with Has
12581258
)
12591259
}
12601260

1261-
trait Runner extends SbtModule
1261+
trait Runner extends CrossSbtModule
12621262
with ScalaCliPublishModule
12631263
with ScalaCliScalafixModule {
1264-
override def scalaVersion: T[String] = Scala.runnerScala3
12651264
override def scalacOptions: T[Seq[String]] = Task {
12661265
super.scalacOptions() ++ Seq("-release", "8", "-deprecation")
12671266
}
12681267
override def mainClass: T[Option[String]] = Some("scala.cli.runner.Runner")
12691268
override def sources: T[Seq[PathRef]] = Task.Sources {
1270-
val scala3DirName = if (scalaVersion().contains("-RC")) "scala-3-unstable" else "scala-3-stable"
1271-
val extraDirs = Seq(PathRef(moduleDir / "src" / "main" / scala3DirName))
1269+
val scala3DirName =
1270+
if (crossScalaVersion.contains("-RC")) "scala-3-unstable" else "scala-3-stable"
1271+
val extraDirs = Seq(PathRef(moduleDir / "src" / "main" / scala3DirName))
12721272
super.sources() ++ extraDirs
12731273
}
12741274
}
@@ -1320,9 +1320,10 @@ object `local-repo` extends LocalRepo {
13201320
*/
13211321
def developingOnStubModules = false
13221322

1323-
override def stubsModules: Seq[PublishLocalNoFluff] = Seq(runner, `test-runner`)
1323+
override def stubsModules: Seq[PublishLocalNoFluff] =
1324+
Seq(runner(Scala.runnerScala3), `test-runner`)
13241325

1325-
override def version: T[String] = runner.publishVersion()
1326+
override def version: T[String] = runner(Scala.runnerScala3).publishVersion()
13261327
}
13271328

13281329
// Helper CI commands

project/deps/package.mill.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ object Scala {
3232
val allScala3 = Seq(scala3Lts, scala3Next, scala3NextAnnounced, scala3NextRc).distinct
3333
val all = (allScala2 ++ allScala3 ++ defaults).distinct
3434
val scala3MainVersions = (defaults ++ allScala3).distinct
35-
val runnerScalaVersions = Seq(runnerScala3, scala3MainVersions).distinct
35+
val runnerScalaVersions = (Seq(runnerScala3) ++ scala3MainVersions).distinct
3636

3737
def scalaJs = "1.20.1"
3838
def scalaJsCli = scalaJs // this must be compatible with the Scala.js version

0 commit comments

Comments
 (0)