1- import $ivy .`de.tototec::de.tobiasroeser.mill.vcs.version::0.3 .0`
2- import $ivy .`io.github.alexarchambault.mill::mill-native-image::0.1.23 `
1+ import $ivy .`de.tototec::de.tobiasroeser.mill.vcs.version::0.4 .0`
2+ import $ivy .`io.github.alexarchambault.mill::mill-native-image::0.1.25 `
33import $ivy .`io.github.alexarchambault.mill::mill-native-image-upload:0.1.19`
44import $ivy .`io.get-coursier::coursier-launcher:2.1.0-M2`
55
@@ -17,30 +17,18 @@ import scala.util.Properties.isWin
1717
1818
1919def scalaJsCliVersion = " 1.1.1-sc5"
20- def scala213 = " 2.13.10"
21- def latestScalaJsVersion = " 1.13.1"
22- def scalaJsVersions = Seq (" 1.9.0" , " 1.10.0" , " 1.10.1" , " 1.11.0" , " 1.12.0" , latestScalaJsVersion)
23-
24- object cli extends Cross [Cli ](scalaJsVersions : _* )
25-
26- class Cli (val scalaJsVersion0 : String ) extends ScalaModule with ScalaJsCliPublishModule {
20+ def scala213 = " 2.13.11"
21+ def scalaJsVersion = " 1.13.1"
22+ object cli extends Cli
23+ trait Cli extends ScalaModule with ScalaJsCliPublishModule {
2724 def scalaVersion = scala213
2825 def artifactName = " scalajs" + super .artifactName()
2926 def ivyDeps = super .ivyDeps() ++ Seq (
30- ivy " org.scala-js::scalajs-linker: $scalaJsVersion0 " ,
27+ ivy " org.scala-js::scalajs-linker: $scalaJsVersion " ,
3128 ivy " com.github.scopt::scopt:4.1.0 "
3229 )
33- def millSourcePath = super .millSourcePath / os.up
34-
3530 def mainClass = Some (" org.scalajs.cli.Scalajsld" )
3631
37- def sources = T .sources {
38- val extra =
39- if (Version (scalaJsVersion0) == Version (" 1.9.0" )) millSourcePath / " scala-js-1.9"
40- else millSourcePath / " scala-js-1.10+"
41- super .sources() ++ Seq (PathRef (extra))
42- }
43-
4432 def transitiveJars : T [Agg [PathRef ]] = {
4533
4634 def allModuleDeps (todo : List [JavaModule ]): List [JavaModule ] = {
@@ -73,7 +61,6 @@ class Cli(val scalaJsVersion0: String) extends ScalaModule with ScalaJsCliPublis
7361 else None
7462
7563 import coursier .launcher .{
76- AssemblyGenerator ,
7764 BootstrapGenerator ,
7865 ClassPathEntry ,
7966 Parameters ,
@@ -107,9 +94,8 @@ class Cli(val scalaJsVersion0: String) extends ScalaModule with ScalaJsCliPublis
10794 }
10895}
10996
110- class ScalaJsCliNativeImage ( val scalaJsVersion0 : String ) extends ScalaModule with NativeImage {
97+ trait ScalaJsCliNativeImage extends ScalaModule with NativeImage {
11198 def scalaVersion = scala213
112- def scalaJsVersion = scalaJsVersion0
11399
114100 def nativeImageClassPath = T {
115101 runClasspath()
@@ -123,11 +109,11 @@ class ScalaJsCliNativeImage(val scalaJsVersion0: String) extends ScalaModule wit
123109 )
124110 }
125111 def nativeImagePersist = System .getenv(" CI" ) != null
126- def graalVmVersion = " 22.3.1 "
112+ def graalVmVersion = " 22.3.2 "
127113 def nativeImageGraalVmJvmId = s " graalvm-java17: $graalVmVersion"
128114 def nativeImageName = " scala-js-ld"
129115 def moduleDeps () = Seq (
130- cli(scalaJsVersion0)
116+ cli
131117 )
132118 def compileIvyDeps = super .compileIvyDeps() ++ Seq (
133119 ivy " org.graalvm.nativeimage:svm: $graalVmVersion"
@@ -139,20 +125,20 @@ class ScalaJsCliNativeImage(val scalaJsVersion0: String) extends ScalaModule wit
139125 val _ = Upload .copyLauncher(
140126 nativeImage().path,
141127 directory,
142- s " scala-js-ld- $scalaJsVersion " ,
128+ s " scala-js-ld " ,
143129 compress = true ,
144130 suffix = nameSuffix
145131 )
146132 }
147133}
148134
149- object native extends Cross [ ScalaJsCliNativeImage ]( scalaJsVersions : _* )
135+ object native extends ScalaJsCliNativeImage
150136
151137def native0 = native
152138
153139def csDockerVersion = " 2.1.0-M5-18-gfebf9838c"
154140
155- class ScalaJsCliStaticNativeImage ( scalaJsVersion0 : String ) extends ScalaJsCliNativeImage (scalaJsVersion0) {
141+ trait ScalaJsCliStaticNativeImage extends ScalaJsCliNativeImage {
156142 def nameSuffix = " -static"
157143 def buildHelperImage = T {
158144 os.proc(" docker" , " build" , " -t" , " scala-cli-base-musl:latest" , " ." )
@@ -173,9 +159,9 @@ class ScalaJsCliStaticNativeImage(scalaJsVersion0: String) extends ScalaJsCliNat
173159 super .writeNativeImageScript(scriptDest, imageDest)()
174160 }
175161}
176- object `native-static` extends Cross [ ScalaJsCliStaticNativeImage ]( scalaJsVersions : _* )
162+ object `native-static` extends ScalaJsCliStaticNativeImage
177163
178- class ScalaJsCliMostlyStaticNativeImage ( scalaJsVersion0 : String ) extends ScalaJsCliNativeImage (scalaJsVersion0) {
164+ trait ScalaJsCliMostlyStaticNativeImage extends ScalaJsCliNativeImage {
179165 def nameSuffix = " -mostly-static"
180166 def nativeImageDockerParams = Some (
181167 NativeImage .linuxMostlyStaticParams(
@@ -184,16 +170,15 @@ class ScalaJsCliMostlyStaticNativeImage(scalaJsVersion0: String) extends ScalaJs
184170 )
185171 )
186172}
187- object `native-mostly-static` extends Cross [ ScalaJsCliMostlyStaticNativeImage ]( scalaJsVersions : _* )
173+ object `native-mostly-static` extends ScalaJsCliMostlyStaticNativeImage
188174
189- object tests extends Cross [Tests ](scalaJsVersions : _* )
190- class Tests (val scalaJsVersion0 : String ) extends ScalaModule {
175+ object tests extends ScalaModule {
191176 def scalaVersion = scala213
192177
193- object test extends Tests {
178+ object test extends ScalaTests {
194179 def ivyDeps = super .ivyDeps() ++ Seq (
195180 ivy " org.scalameta::munit:0.7.29 " ,
196- ivy " com.lihaoyi::os-lib:0.9.0 " ,
181+ ivy " com.lihaoyi::os-lib:0.9.1 " ,
197182 ivy " com.lihaoyi::pprint:0.8.1 "
198183 )
199184 def testFramework = " munit.Framework"
@@ -206,7 +191,7 @@ class Tests(val scalaJsVersion0: String) extends ScalaModule {
206191 val launcher = launcherTask().path
207192 val extraArgs = Seq (
208193 s " -Dtest.scala-js-cli.path= $launcher" ,
209- s " -Dtest.scala-js-cli.scala-js-version= $scalaJsVersion0 "
194+ s " -Dtest.scala-js-cli.scala-js-version= $scalaJsVersion "
210195 )
211196 args ++ extraArgs
212197 }
@@ -219,41 +204,23 @@ class Tests(val scalaJsVersion0: String) extends ScalaModule {
219204 def test (args : String * ) =
220205 jvm(args : _* )
221206 def jvm (args : String * ) =
222- new TestHelper (cli(scalaJsVersion0) .standaloneLauncher).test(args : _* )
207+ new TestHelper (cli.standaloneLauncher).test(args : _* )
223208 def native (args : String * ) =
224- new TestHelper (native0(scalaJsVersion0) .nativeImage).test(args : _* )
209+ new TestHelper (native0.nativeImage).test(args : _* )
225210 def nativeStatic (args : String * ) =
226- new TestHelper (`native-static`(scalaJsVersion0) .nativeImage).test(args : _* )
211+ new TestHelper (`native-static`.nativeImage).test(args : _* )
227212 def nativeMostlyStatic (args : String * ) =
228- new TestHelper (`native-mostly-static`(scalaJsVersion0).nativeImage).test(args : _* )
229-
230- private def updateRef (ref : PathRef ): PathRef = {
231- val rawPath = ref.path.toString.replace(
232- File .separator + scalaJsVersion0 + File .separator,
233- File .separator
234- )
235- PathRef (os.Path (rawPath))
236- }
237- def sources = T .sources {
238- super .sources().flatMap { ref =>
239- Seq (updateRef(ref), ref)
240- }
241- }
242- def resources = T .sources {
243- super .resources().flatMap { ref =>
244- Seq (updateRef(ref), ref)
245- }
246- }
213+ new TestHelper (`native-mostly-static`.nativeImage).test(args : _* )
247214 }
248215}
249216
250- def ghOrg = " scala-cli "
217+ def ghOrg = " virtuslab "
251218def ghName = " scala-js-cli"
252219trait ScalaJsCliPublishModule extends PublishModule {
253220 import mill .scalalib .publish ._
254221 def pomSettings = PomSettings (
255222 description = artifactName(),
256- organization = " io.github.alexarchambault.tmp " ,
223+ organization = " org.virtuslab.scala-cli " ,
257224 url = s " https://github.com/ $ghOrg/ $ghName" ,
258225 licenses = Seq (License .`BSD-3-Clause`),
259226 versionControl = VersionControl .github(ghOrg, ghName),
@@ -357,8 +324,8 @@ object ci extends Module {
357324 set.head
358325 }
359326 val publisher = new scalalib.publish.SonatypePublisher (
360- uri = " https://s01. oss.sonatype.org/service/local" ,
361- snapshotUri = " https://s01. oss.sonatype.org/content/repositories/snapshots" ,
327+ uri = " https://oss.sonatype.org/service/local" ,
328+ snapshotUri = " https://oss.sonatype.org/content/repositories/snapshots" ,
362329 credentials = credentials,
363330 signed = true ,
364331 // format: off
@@ -395,7 +362,9 @@ object ci extends Module {
395362 if (version.endsWith(" -SNAPSHOT" )) (" launchers" , true )
396363 else (" v" + version, false )
397364
398- Upload .upload(" scala-cli" , " scala-js-cli" , ghToken, tag, dryRun = false , overwrite = overwriteAssets)(launchers : _* )
365+ Upload .upload(ghOrg, ghName, ghToken, tag, dryRun = false , overwrite = overwriteAssets)(launchers : _* )
366+ if (version != scalaJsVersion && ! version.endsWith(" -SNAPSHOT" )) // when we release `0.13.0.1` we should also update native launchers in tag `0.13.0`
367+ Upload .upload(ghOrg, ghName, ghToken, s " v $scalaJsVersion" , dryRun = false , overwrite = true )(launchers : _* )
399368 }
400369}
401370
0 commit comments