Skip to content

Commit 2adc3a5

Browse files
authored
Bump Mill to 1.0.6 (was 0.12.17) (#4019)
1 parent 76cb16f commit 2adc3a5

11 files changed

Lines changed: 410 additions & 322 deletions

File tree

.github/scripts/check-cross-version-deps.sc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ val modules =
1111

1212
for { module <- modules } {
1313
println(s"Checking for $module...")
14-
val depRegex = "\\[\\d+]\\s+[│└├─\\S\\s]+\\s([\\w.-]+):([\\w.-]+):([\\w\\s\\S.-]+)".r
14+
val depRegex = "[│└├─\\S\\s]+\\s([\\w.-]+):([\\w.-]+):([\\w\\s\\S.-]+)".r
1515
val scalaDepSuffixRegex = "^(.+?)(_[23](?:\\.\\d{2})?)?$".r
16-
val deps = os.proc(os.pwd / "mill", "-i", s"$module.ivyDepsTree")
16+
val deps = os.proc(os.pwd / "mill", "-i", s"$module.showMvnDepsTree")
1717
.call(cwd = os.pwd)
1818
.out
1919
.lines()

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1455,7 +1455,7 @@ jobs:
14551455
- name: Check native-image config format
14561456
run: ./mill -i __.checkNativeImageConfFormat
14571457
- name: Check Ammonite availability
1458-
run: ./mill -i 'dummy.amm[_].resolvedRunIvyDeps'
1458+
run: ./mill -i 'dummy.amm[_].resolvedRunMvnDeps'
14591459
- name: Check for cross Scala version conflicts
14601460
run: .github/scripts/check-cross-version-deps.sc
14611461
- name: Scalafix check

.mill-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.12.17
1+
1.0.6

build.mill.scala

Lines changed: 217 additions & 178 deletions
Large diffs are not rendered by default.

mill

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export USE_NATIVE_IMAGE_JAVA_PLATFORM_MODULE_SYSTEM=false
8484
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)"
8585

8686
if [[ $IS_WINDOWS ]]; then
87-
exec "$DIR/millw" "$@"
87+
exec "$DIR/mill.bat" "$@"
8888
else
8989
exec "$DIR/millw" $COMMAND
9090
fi

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

Lines changed: 37 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -54,34 +54,38 @@ abstract class ExportMillTestDefinitions extends ScalaCliSuite
5454
expect(output.filterNot(_.isWhitespace) == "[\"-deprecation\"]")
5555
}
5656

57-
def jvmTestCompilerPlugin(mainClass: String, exportArgs: Seq[String]): Unit =
58-
ExportTestProjects.jvmTest(actualScalaVersion, mainClass).withMillJvmOpts.fromRoot { root =>
59-
exportCommand(exportArgs :+ "."*).call(cwd = root, stdout = os.Inherit)
60-
locally {
61-
// scalacPluginIvyDeps
62-
val res =
63-
buildToolCommand(
64-
root,
65-
Some(mainClass),
66-
"--disable-ticker",
67-
"show",
68-
s"$millDefaultProjectName.scalacPluginIvyDeps"
69-
)
70-
.call(cwd = root / outputDir)
71-
val output = res.out.text(Charset.defaultCharset())
72-
expect(output.contains("com.olegpy"))
73-
expect(output.contains("better-monadic-for"))
74-
}
75-
locally {
76-
// test
77-
val res =
78-
buildToolCommand(root, Some(mainClass), s"$millDefaultProjectName.test").call(cwd =
79-
root / outputDir
80-
)
81-
val output = res.out.text(Charset.defaultCharset())
82-
expect(output.contains("1 succeeded"))
57+
def jvmTestCompilerPlugin(mainClass: String, exportArgs: Seq[String]): Unit = {
58+
val message = "Hello"
59+
ExportTestProjects.jvmTestWithCompilerPlugin(
60+
scalaVersion = actualScalaVersion,
61+
mainClassName = mainClass,
62+
message = message
63+
)
64+
.withMillJvmOpts.fromRoot { root =>
65+
exportCommand(exportArgs :+ "."*).call(cwd = root, stdout = os.Inherit)
66+
locally {
67+
val millDepsCommand =
68+
if millVersion.startsWith("1.") then "scalacPluginMvnDeps" else "scalacPluginIvyDeps"
69+
val res =
70+
buildToolCommand(
71+
root,
72+
Some(mainClass),
73+
"show",
74+
s"$millDefaultProjectName.$millDepsCommand"
75+
)
76+
.call(cwd = root / outputDir)
77+
val output = res.out.text(Charset.defaultCharset())
78+
expect(output.contains("hearth-cross-quotes"))
79+
}
80+
locally {
81+
val res =
82+
buildToolCommand(root, Some(mainClass), s"$millDefaultProjectName.run")
83+
.call(cwd = root / outputDir)
84+
val output = res.out.text(Charset.defaultCharset())
85+
expect(output.contains(message))
86+
}
8387
}
84-
}
88+
}
8589

8690
if runExportTests then {
8791
test(s"JVM custom project name$commonTestDescriptionSuffix") {
@@ -100,6 +104,12 @@ abstract class ExportMillTestDefinitions extends ScalaCliSuite
100104
jvmTestScalacOptions(className = "Hello", exportArgs = defaultExportCommandArgs)
101105
}
102106
}
107+
if !actualScalaVersion.startsWith("2.12") then
108+
test(s"JVM with a compiler plugin$commonTestDescriptionSuffix") {
109+
TestUtil.retryOnCi() {
110+
jvmTestCompilerPlugin(mainClass = "Hello", exportArgs = defaultExportCommandArgs)
111+
}
112+
}
103113
}
104114
}
105115

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

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ import scala.cli.integration.Constants.munitVersion
66

77
object ExportTestProjects {
88
def jvmTest(scalaVersion: String, mainClassName: String): TestInputs = {
9-
109
val mainFile =
11-
if (scalaVersion.startsWith("3."))
10+
if scalaVersion.startsWith("3.") then
1211
s"""//> using scala $scalaVersion
1312
|//> using resourceDir ./input
1413
|//> using dep org.scala-lang::scala3-compiler:$scalaVersion
@@ -69,6 +68,24 @@ object ExportTestProjects {
6968
)
7069
}
7170

71+
def jvmTestWithCompilerPlugin(
72+
scalaVersion: String,
73+
mainClassName: String,
74+
message: String
75+
): TestInputs =
76+
TestInputs(
77+
os.rel / s"$mainClassName.scala" -> s"""//> using scala $scalaVersion
78+
|//> using option -deprecation
79+
|//> using plugin com.kubuszok::hearth-cross-quotes:0.2.0
80+
|
81+
|object $mainClassName {
82+
| def main(args: Array[String]): Unit = {
83+
| println("$message")
84+
| }
85+
|}
86+
|""".stripMargin
87+
)
88+
7289
def jsTest(scalaVersion: String): TestInputs = {
7390

7491
val testFile =

project/deps/package.mill.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
package build.project.deps
2+
23
import coursier.version.Version
3-
import mill._
4+
import mill.*
45
import mill.api.BuildInfo
5-
import scalalib._
6+
import scalalib.*
67

78
object Cli {
89
def runnerScala30LegacyVersion =
@@ -143,9 +144,8 @@ object Deps {
143144
def javaClassName = "0.1.9"
144145
def bloop = "2.0.17"
145146
def sbtVersion = "1.11.7"
146-
def mill012Version =
147-
if (BuildInfo.millVersion.startsWith("0.12.")) BuildInfo.millVersion else "0.12.17"
148-
def mill10Version =
147+
def mill012Version = "0.12.17"
148+
def mill10Version =
149149
if (BuildInfo.millVersion.startsWith("1.0.")) BuildInfo.millVersion else "1.0.6"
150150
def mavenVersion = "3.8.1"
151151
def mavenScalaCompilerPluginVersion = "4.9.1"

project/publish/package.mill.scala

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
package build.project.publish
2-
import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::0.4.0`
3-
import $ivy.`org.eclipse.jgit:org.eclipse.jgit:7.3.0.202506031305-r`
2+
43
import build.project.settings
54
import com.lumidion.sonatype.central.client.core.{PublishingType, SonatypeCredentials}
65
import settings.{PublishLocalNoFluff, workspaceDirName}
7-
import de.tobiasroeser.mill.vcs.version._
8-
import mill._
9-
import mill.api.BuildCtx
6+
import mill.*
107
import mill.javalib.publish.Artifact
11-
import scalalib._
8+
import mill.util.{Tasks, VcsVersion}
9+
import scalalib.*
1210
import org.eclipse.jgit.api.Git
11+
import mill.api.{BuildCtx, ModuleCtx, Task}
1312

1413
import java.nio.charset.Charset
15-
import scala.concurrent.duration._
16-
import scala.jdk.CollectionConverters._
14+
import scala.concurrent.duration.*
15+
import scala.jdk.CollectionConverters.*
1716

18-
lazy val (ghOrg: String, ghName: String) = {
17+
def gh: (ghOrg: String, ghName: String) = {
1918
def default = ("VirtusLab", "scala-cli")
2019
val isCI = System.getenv("CI") != null
2120
if (isCI) {
@@ -63,7 +62,9 @@ lazy val (ghOrg: String, ghName: String) = {
6362
default
6463
}
6564

66-
private def computePublishVersion(state: VcsState, simple: Boolean): String =
65+
lazy val (ghOrg: String, ghName: String) = gh
66+
67+
private def computePublishVersion(state: VcsVersion.State, simple: Boolean): String =
6768
if (state.commitsSinceLastTag > 0)
6869
if (simple) {
6970
val versionOrEmpty = state.lastTag
@@ -141,19 +142,20 @@ trait ScalaCliPublishModule extends SonatypeCentralPublishModule with PublishLoc
141142
)
142143
)
143144
override def publishVersion: T[String] = finalPublishVersion()
144-
override def sourceJar: T[PathRef] = Task {
145-
import mill.util.Jvm.createJar
146-
val allSources0 = allSources().map(_.path).filter(os.exists).toSet
147-
val jar = Task.dest / "sources.jar"
148-
createJar(
149-
jar = jar,
150-
inputPaths = allSources0 ++ resources().map(_.path).filter(os.exists),
151-
manifest = manifest(),
152-
fileFilter = (input, relPath) =>
153-
!allSources0(input) ||
154-
(!relPath.segments.contains(".scala") && !relPath.segments.contains(workspaceDirName))
155-
)
156-
PathRef(jar)
145+
146+
override def sourceJar: T[PathRef] = Task {
147+
PathRef {
148+
import mill.util.Jvm.createJar
149+
val allSources0 = allSources().map(_.path).filter(os.exists)
150+
createJar(
151+
jar = Task.dest / "out.jar",
152+
inputPaths = allSources0 ++ resources().map(_.path).filter(os.exists),
153+
manifest = manifest(),
154+
fileFilter = (input, relPath) =>
155+
!allSources0.toSet(input) ||
156+
(!relPath.segments.contains(".scala") && !relPath.segments.contains(workspaceDirName))
157+
)
158+
}
157159
}
158160
}
159161

@@ -215,7 +217,7 @@ def publishSonatype(
215217
publisher.publishAll(
216218
publishingType = publishingType,
217219
singleBundleName = finalBundleName,
218-
artifacts = artifacts: _*
220+
artifacts = artifacts*
219221
)
220222
}
221223

0 commit comments

Comments
 (0)