Skip to content

Commit 39dd7ea

Browse files
committed
Default exported Mill launchers to the main branch & add the --use-latest-mill-launchers toggle
1 parent 4c8bfb9 commit 39dd7ea

4 files changed

Lines changed: 27 additions & 2 deletions

File tree

modules/cli/src/main/scala/scala/cli/commands/export0/Export.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,13 @@ object Export extends ScalaCommand[ExportOptions] {
9999
cache: FileCache[Task],
100100
projectName: Option[String],
101101
millVersion: String,
102+
useLatestLaunchers: Boolean = true,
102103
logger: Logger
103104
): MillProjectDescriptor = {
105+
val launcherTag = if useLatestLaunchers then "main" else millVersion
104106
val launcherArtifacts = Seq(
105-
os.rel / "mill" -> s"https://github.com/com-lihaoyi/mill/raw/$millVersion/mill",
106-
os.rel / "mill.bat" -> s"https://github.com/com-lihaoyi/mill/raw/$millVersion/mill.bat"
107+
os.rel / "mill" -> s"https://github.com/com-lihaoyi/mill/raw/$launcherTag/mill",
108+
os.rel / "mill.bat" -> s"https://github.com/com-lihaoyi/mill/raw/$launcherTag/mill.bat"
107109
)
108110
val launcherTasks = launcherArtifacts.map {
109111
case (path, url) =>
@@ -274,6 +276,7 @@ object Export extends ScalaCommand[ExportOptions] {
274276
cache = options.shared.coursierCache,
275277
projectName = options.project,
276278
millVersion = options.millVersion.getOrElse(Constants.millVersion),
279+
useLatestLaunchers = options.useLatestMillLaunchers.getOrElse(true),
277280
logger = logger
278281
)
279282
else if shouldExportToMaven then

modules/cli/src/main/scala/scala/cli/commands/export0/ExportOptions.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ final case class ExportOptions(
6262
)
6363
millVersion: Option[String] = None,
6464
@Group(HelpGroup.BuildToolExport.toString)
65+
@Tag(tags.restricted)
66+
@HelpMessage(
67+
s"If set, latest Mill launchers from the main branch will be used, rather than the ones for the used version tag (true by default)"
68+
)
69+
useLatestMillLaunchers: Option[Boolean] = None,
70+
@Group(HelpGroup.BuildToolExport.toString)
6571
@Tag(tags.experimental)
6672
@HelpMessage(
6773
s"Version of Maven Compiler Plugin to be used for the export (${Constants.defaultMavenVersion} by default)"

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import os.RelPath
55

66
import java.nio.charset.Charset
77

8+
import scala.util.Properties
9+
810
abstract class ExportMillTestDefinitions extends ScalaCliSuite
911
with TestScalaVersionArgs
1012
with ExportCommonTestDefinitions
@@ -104,6 +106,16 @@ abstract class ExportMillTestDefinitions extends ScalaCliSuite
104106
jvmTestScalacOptions(className = "Hello", exportArgs = defaultExportCommandArgs)
105107
}
106108
}
109+
if (!Properties.isMac || TestUtil.isM1) && !Properties.isWin then
110+
// TODO enable this for intel Macs when Mill is bumped to 1.1.0 stable or newer: https://github.com/com-lihaoyi/mill/issues/6632
111+
test(s"JVM scalac options with disabled latest launchers$commonTestDescriptionSuffix") {
112+
TestUtil.retryOnCi() {
113+
jvmTestScalacOptions(
114+
className = "Hello",
115+
exportArgs = defaultExportCommandArgs ++ Seq("--use-latest-mill-launchers=false")
116+
)
117+
}
118+
}
107119
if !actualScalaVersion.startsWith("2.12") then
108120
test(s"JVM with a compiler plugin$commonTestDescriptionSuffix") {
109121
TestUtil.retryOnCi() {

website/docs/reference/cli-options.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,10 @@ Version of SBT to be used for the export (1.11.7 by default)
390390

391391
Version of Mill to be used for the export (1.0.6 by default)
392392

393+
### `--use-latest-mill-launchers`
394+
395+
If set, latest Mill launchers from the main branch will be used, rather than the ones for the used version tag (true by default)
396+
393397
### `--mvn-version`
394398

395399
Version of Maven Compiler Plugin to be used for the export (3.8.1 by default)

0 commit comments

Comments
 (0)