Skip to content

Commit 41b4594

Browse files
committed
Bump mill to 0.12.10
1 parent 43424d7 commit 41b4594

File tree

6 files changed

+108
-92
lines changed

6 files changed

+108
-92
lines changed

.mill-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.11.13
1+
0.12.10

build.sc renamed to build.mill.scala

Lines changed: 92 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
1-
import $ivy.`io.github.alexarchambault.mill::mill-native-image::0.1.31-1`
2-
import $ivy.`io.github.alexarchambault.mill::mill-native-image-upload:0.1.31-1`
1+
package build
32

4-
import $file.publish, publish.{finalPublishVersion, publishSonatype => publishSonatype0}
3+
import $packages._
54

5+
import $ivy.`io.github.alexarchambault.mill::mill-native-image::0.1.31-1`
6+
import $ivy.`io.github.alexarchambault.mill::mill-native-image-upload:0.1.31-1`
7+
import build.project.publish
8+
import build.project.publish.{finalPublishVersion, publishSonatype => publishSonatype0}
69
import io.github.alexarchambault.millnativeimage.NativeImage
710
import io.github.alexarchambault.millnativeimage.upload.Upload
8-
import mill._, scalalib._
11+
import mill._
12+
import scalalib._
913

1014
import java.io.File
15+
import scala.annotation.unused
1116

1217
object Deps {
1318
object Versions {
@@ -35,14 +40,14 @@ object Deps {
3540

3641
object Scala {
3742
def scala213 = "2.13.16"
38-
def scala3 = "3.3.5"
43+
def scala3 = "3.3.6"
3944
}
4045

4146
def ghOrg = "VirtusLab"
4247
def ghName = "scala-cli-signing"
4348
trait ScalaCliSigningPublish extends PublishModule {
4449
import mill.scalalib.publish._
45-
def pomSettings = PomSettings(
50+
def pomSettings: Target[PomSettings] = PomSettings(
4651
description = artifactName(),
4752
organization = "org.virtuslab.scala-cli-signing",
4853
url = s"https://github.com/$ghOrg/$ghName",
@@ -52,63 +57,64 @@ trait ScalaCliSigningPublish extends PublishModule {
5257
Developer("alexarchambault", "Alex Archambault", "https://github.com/alexarchambault")
5358
)
5459
)
55-
def publishVersion = finalPublishVersion()
60+
def publishVersion: Target[String] = finalPublishVersion()
5661
}
5762

5863
object shared extends Cross[Shared](Scala.scala213, Scala.scala3)
5964
trait Shared extends CrossScalaModule with ScalaCliSigningPublish {
60-
override val crossScalaVersion = crossValue
61-
def ivyDeps = super.ivyDeps() ++ Seq(
65+
override val crossScalaVersion: String = crossValue
66+
def ivyDeps: Target[Agg[Dep]] = super.ivyDeps() ++ Seq(
6267
Deps.jsoniterCore,
6368
Deps.osLib
6469
)
65-
def compileIvyDeps = super.ivyDeps() ++ Seq(
70+
def compileIvyDeps: Target[Agg[Dep]] = super.ivyDeps() ++ Seq(
6671
Deps.jsoniterMacros
6772
)
6873
}
6974

7075
trait CliNativeImage extends NativeImage {
71-
def nativeImagePersist = System.getenv("CI") != null
72-
def nativeImageGraalVmJvmId = Deps.graalVmId
73-
def nativeImageName = "scala-cli-signing"
74-
def nativeImageClassPath = `native-cli`.runClasspath()
75-
def nativeImageMainClass = T {
76+
def nativeImagePersist: Boolean = System.getenv("CI") != null
77+
def nativeImageGraalVmJvmId: Target[String] = Deps.graalVmId
78+
def nativeImageName = "scala-cli-signing"
79+
def nativeImageClassPath: Target[Seq[PathRef]] = `native-cli`.runClasspath()
80+
def nativeImageMainClass: Target[String] = T {
7681
`native-cli`.mainClass().getOrElse(sys.error("no main class found"))
7782
}
78-
def nativeImageOptions = super.nativeImageOptions() ++ Seq(
83+
def nativeImageOptions: Target[Seq[String]] = super.nativeImageOptions() ++ Seq(
7984
"--no-fallback",
8085
"--rerun-class-initialization-at-runtime=org.bouncycastle.jcajce.provider.drbg.DRBG$Default,org.bouncycastle.jcajce.provider.drbg.DRBG$NonceAndIV"
8186
)
8287

8388
def nameSuffix = ""
84-
def copyToArtifacts(directory: String = "artifacts/") = T.command {
85-
val _ = Upload.copyLauncher(
86-
nativeImage().path,
87-
directory,
88-
"scala-cli-signing",
89+
90+
@unused
91+
def copyToArtifacts(directory: String = "artifacts/"): Command[Unit] = Task.Command {
92+
val _ = Upload.copyLauncher0(
93+
nativeLauncher = nativeImage().path,
94+
directory = directory,
95+
name = "scala-cli-signing",
8996
compress = true,
90-
suffix = nameSuffix
97+
suffix = nameSuffix,
98+
workspace = Task.workspace
9199
)
92100
}
93101
}
94102

95103
object cli extends Cross[Cli](Scala.scala213, Scala.scala3)
96104
trait Cli extends CrossScalaModule with ScalaCliSigningPublish {
97105
self =>
98-
override val crossScalaVersion = crossValue
99-
def ivyDeps = super.ivyDeps() ++ Seq(
106+
override val crossScalaVersion: String = crossValue
107+
def ivyDeps: Target[Agg[Dep]] = super.ivyDeps() ++ Seq(
100108
Deps.bouncycastle,
101109
Deps.bouncycastleUtils,
102110
Deps.caseApp,
103111
Deps.coursierPublish // we can probably get rid of that one
104112
)
105-
def moduleDeps = Seq(
106-
shared()
107-
)
108-
def mainClass = Some("scala.cli.signing.ScalaCliSigning")
113+
def moduleDeps: Seq[Shared] = Seq(shared())
114+
def mainClass: Target[Option[String]] = Some("scala.cli.signing.ScalaCliSigning")
109115

110116
object test extends ScalaTests with TestModule.Munit {
111-
def ivyDeps = super.ivyDeps() ++ Agg(
117+
def ivyDeps: Target[Agg[Dep]] = super.ivyDeps() ++ Agg(
112118
Deps.expecty,
113119
Deps.munit,
114120
Deps.jsoniterMacros
@@ -117,25 +123,25 @@ trait Cli extends CrossScalaModule with ScalaCliSigningPublish {
117123
super.forkArgs() ++ Seq("-Xmx512m", "-Xms128m", "--add-opens=java.base/java.util=ALL-UNNAMED")
118124
}
119125

120-
override def scalaVersion = crossScalaVersion
126+
override def scalaVersion: Target[String] = crossScalaVersion
121127
}
122128
}
123129
object `native-cli` extends ScalaModule with ScalaCliSigningPublish { self =>
124-
private def scalaVer = Scala.scala3
125-
def scalaVersion = scalaVer
126-
def ivyDeps = super.ivyDeps() ++ Seq(
130+
private def scalaVer: String = Scala.scala3
131+
def scalaVersion: Target[String] = scalaVer
132+
def ivyDeps: Target[Agg[Dep]] = super.ivyDeps() ++ Seq(
127133
Deps.svm
128134
)
129-
def moduleDeps = Seq(
135+
def moduleDeps: Seq[Cli] = Seq(
130136
cli(scalaVer)
131137
)
132138

133-
def mainClass = cli(scalaVer).mainClass()
139+
def mainClass: Target[Option[String]] = cli(scalaVer).mainClass()
134140

135141
object `base-image` extends CliNativeImage
136142
object `static-image` extends CliNativeImage {
137143
private def helperImageName = "scala-cli-signing-musl"
138-
def nativeImageDockerParams = T {
144+
def nativeImageDockerParams: Target[Option[NativeImage.DockerParams]] = T {
139145
buildHelperImage()
140146
Some(
141147
NativeImage.linuxStaticParams(
@@ -144,20 +150,21 @@ object `native-cli` extends ScalaModule with ScalaCliSigningPublish { self =>
144150
)
145151
)
146152
}
147-
def buildHelperImage = T {
153+
def buildHelperImage: Target[Unit] = Task {
148154
os.proc("docker", "build", "-t", helperImageName, ".")
149155
.call(cwd = os.pwd / "project" / "musl-image", stdout = os.Inherit)
150156
()
151157
}
152-
def writeNativeImageScript(scriptDest: String, imageDest: String = "") = T.command {
153-
buildHelperImage()
154-
super.writeNativeImageScript(scriptDest, imageDest)()
155-
}
158+
def writeNativeImageScript(scriptDest: String, imageDest: String = ""): Command[Unit] =
159+
Task.Command {
160+
buildHelperImage()
161+
super.writeNativeImageScript(scriptDest, imageDest)()
162+
}
156163
def nameSuffix = "-static"
157164
}
158165

159166
object `mostly-static-image` extends CliNativeImage {
160-
def nativeImageDockerParams = Some(
167+
def nativeImageDockerParams: Target[Option[NativeImage.DockerParams]] = Some(
161168
NativeImage.linuxMostlyStaticParams(
162169
Deps.ubuntuDockerVersion,
163170
s"https://github.com/coursier/coursier/releases/download/v${Deps.coursierVersion}/cs-x86_64-pc-linux.gz"
@@ -167,15 +174,15 @@ object `native-cli` extends ScalaModule with ScalaCliSigningPublish { self =>
167174
}
168175
}
169176

170-
def tmpDirBase = T.persistent {
171-
PathRef(T.dest / "working-dir")
177+
def tmpDirBase: Target[PathRef] = Task(persistent = true) {
178+
PathRef(Task.dest / "working-dir")
172179
}
173180

174181
trait CliTests extends ScalaModule {
175-
def testLauncher: T[PathRef]
176-
def cliKind: T[String]
182+
def testLauncher: Target[PathRef]
183+
def cliKind: Target[String]
177184

178-
override def scalaVersion = Scala.scala3
185+
override def scalaVersion: Target[String] = Scala.scala3
179186

180187
def prefix = "integration-"
181188
private def updateRef(name: String, ref: PathRef): PathRef = {
@@ -185,45 +192,45 @@ trait CliTests extends ScalaModule {
185192
)
186193
PathRef(os.Path(rawPath))
187194
}
188-
private def mainArtifactName = T(artifactName())
189-
def modulesPath = T {
195+
private def mainArtifactName: Target[String] = Task(artifactName())
196+
def modulesPath: Target[PathRef] = Task {
190197
val name = mainArtifactName().stripPrefix(prefix)
191198
val baseIntegrationPath = os.Path(millSourcePath.toString.stripSuffix(name))
192199
val p = os.Path(
193200
baseIntegrationPath.toString.stripSuffix(baseIntegrationPath.baseName)
194201
)
195202
PathRef(p)
196203
}
197-
def sources = T.sources {
204+
def sources: Target[Seq[PathRef]] = Task.Sources {
198205
val mainPath = PathRef(modulesPath().path / "integration" / "src" / "main" / "scala")
199206
super.sources() ++ Seq(mainPath)
200207
}
201-
def resources = T.sources {
208+
def resources: Target[Seq[PathRef]] = Task.Sources {
202209
val mainPath = PathRef(modulesPath().path / "integration" / "src" / "main" / "resources")
203210
super.resources() ++ Seq(mainPath)
204211
}
205212

206213
trait Tests extends ScalaTests with TestModule.Munit {
207-
def ivyDeps = super.ivyDeps() ++ Agg(
214+
def ivyDeps: Target[Agg[Dep]] = super.ivyDeps() ++ Agg(
208215
Deps.expecty,
209216
Deps.munit,
210217
Deps.osLib
211218
)
212-
def testFramework = "munit.Framework"
213-
def forkArgs = super.forkArgs() ++ Seq("-Xmx512m", "-Xms128m")
214-
def forkEnv = super.forkEnv() ++ Seq(
219+
def testFramework = "munit.Framework"
220+
def forkArgs: Target[Seq[String]] = super.forkArgs() ++ Seq("-Xmx512m", "-Xms128m")
221+
def forkEnv: Target[Map[String, String]] = super.forkEnv() ++ Seq(
215222
"SIGNING_CLI" -> testLauncher().path.toString,
216223
"SIGNING_CLI_KIND" -> cliKind(),
217224
"SIGNING_CLI_TMP" -> tmpDirBase().path.toString
218225
)
219226

220-
def sources = T.sources {
227+
def sources: Target[Seq[PathRef]] = Task.Sources {
221228
val name = mainArtifactName().stripPrefix(prefix)
222229
super.sources().flatMap { ref =>
223230
Seq(updateRef(name, ref), ref)
224231
}
225232
}
226-
def resources = T.sources {
233+
def resources: Target[Seq[PathRef]] = Task.Sources {
227234
val name = mainArtifactName().stripPrefix(prefix)
228235
super.resources().flatMap { ref =>
229236
Seq(updateRef(name, ref), ref)
@@ -235,35 +242,37 @@ trait CliTests extends ScalaModule {
235242
object `jvm-integration` extends Cross[JvmIntegration](Scala.scala213, Scala.scala3)
236243
trait JvmIntegration extends CrossScalaModule with CliTests { self =>
237244
scalaVersion
238-
override val crossScalaVersion = crossValue
239-
def testLauncher = cli(crossScalaVersion).launcher()
240-
def cliKind = "jvm"
245+
override val crossScalaVersion: String = crossValue
246+
def testLauncher: Target[PathRef] = cli(crossScalaVersion).launcher()
247+
def cliKind = "jvm"
241248

242249
object test extends Tests
243250
}
251+
244252
object `native-integration` extends Module {
245253
object native extends CliTests {
246-
def testLauncher = `native-cli`.`base-image`.nativeImage()
247-
def cliKind = "native"
254+
def testLauncher: Target[PathRef] = `native-cli`.`base-image`.nativeImage()
255+
def cliKind = "native"
248256

249257
object test extends Tests
250258
}
251259
object static extends CliTests {
252-
def testLauncher = `native-cli`.`static-image`.nativeImage()
253-
def cliKind = "native-static"
260+
def testLauncher: Target[PathRef] = `native-cli`.`static-image`.nativeImage()
261+
def cliKind = "native-static"
254262

255263
object test extends Tests
256264
}
257265
object `mostly-static` extends CliTests {
258-
def testLauncher = `native-cli`.`mostly-static-image`.nativeImage()
259-
def cliKind = "native-mostly-static"
266+
def testLauncher: Target[PathRef] = `native-cli`.`mostly-static-image`.nativeImage()
267+
def cliKind = "native-mostly-static"
260268

261269
object test extends Tests
262270
}
263271
}
264272

265273
object ci extends Module {
266-
def upload(directory: String = "artifacts/") = T.command {
274+
@unused
275+
def upload(directory: String = "artifacts/"): Command[Unit] = Task.Command {
267276
val version = finalPublishVersion()
268277

269278
val path = os.Path(directory, os.pwd)
@@ -276,23 +285,26 @@ object ci extends Module {
276285
else ("v" + version, false)
277286

278287
Upload.upload(
279-
ghOrg,
280-
ghName,
281-
ghToken,
282-
tag,
288+
ghOrg = ghOrg,
289+
ghProj = ghName,
290+
ghToken = ghToken,
291+
tag = tag,
283292
dryRun = false,
284293
overwrite = overwriteAssets
285294
)(launchers: _*)
286295
}
287296

288-
def publishSonatype(tasks: mill.main.Tasks[PublishModule.PublishData]) = T.command {
289-
publishSonatype0(
290-
data = define.Target.sequence(tasks.value)(),
291-
log = T.ctx().log
292-
)
293-
}
297+
@unused
298+
def publishSonatype(tasks: mill.main.Tasks[PublishModule.PublishData]): Command[Unit] =
299+
Task.Command {
300+
publishSonatype0(
301+
data = define.Target.sequence(tasks.value)(),
302+
log = Task.ctx().log
303+
)
304+
}
294305

295-
def copyJvm(jvm: String = Deps.graalVmId, dest: String = "jvm") = T.command {
306+
@unused
307+
def copyJvm(jvm: String = Deps.graalVmId, dest: String = "jvm"): Command[os.Path] = Task.Command {
296308
import sys.process._
297309
val command = os.proc(
298310
"cs",
@@ -303,9 +315,9 @@ object ci extends Module {
303315
"--ttl",
304316
"0"
305317
)
306-
val baseJavaHome = os.Path(command.call().out.text().trim, os.pwd)
318+
val baseJavaHome = os.Path(command.call().out.text().trim, Task.workspace)
307319
System.err.println(s"Initial Java home $baseJavaHome")
308-
val destJavaHome = os.Path(dest, os.pwd)
320+
val destJavaHome = os.Path(dest, Task.workspace)
309321
os.copy(baseJavaHome, destJavaHome, createFolders = true)
310322
System.err.println(s"New Java home $destJavaHome")
311323
destJavaHome

mill

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
set -e
3434

3535
if [ -z "${DEFAULT_MILL_VERSION}" ] ; then
36-
DEFAULT_MILL_VERSION="0.11.13"
36+
DEFAULT_MILL_VERSION="0.12.10"
3737
fi
3838

3939

mill.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ rem but I don't think we need to support them in 2019
3535
setlocal enabledelayedexpansion
3636

3737
if [!DEFAULT_MILL_VERSION!]==[] (
38-
set "DEFAULT_MILL_VERSION=0.11.13"
38+
set "DEFAULT_MILL_VERSION=0.12.10"
3939
)
4040

4141
if [!GITHUB_RELEASE_CDN!]==[] (

project/package.mill.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package build.project

0 commit comments

Comments
 (0)