@@ -17,17 +17,17 @@ import scala.concurrent.duration._
17
17
import scala .util .Properties .isWin
18
18
19
19
object Versions {
20
- def scala213 = " 2.13.16"
21
- def scalaJsVersion = " 1.19.0"
22
- def jsoniterVersion = " 2.35.3"
20
+ def scala213 = " 2.13.16"
21
+ def scalaJsVersion = " 1.19.0"
22
+ def jsoniterVersion = " 2.35.3"
23
23
def scalaJsImportMapVersion = " 0.1.1"
24
- def graalVmVersion = " 22.3.1"
25
- def munitVersion = " 1.1.1"
26
- def osLibVersion = " 0.11.4"
27
- def pprintVersion = " 0.9.0"
28
- def coursierVersion = " 2.1.24"
29
- def scoptVersion = " 4.1.0"
30
- def ubuntuVersion = " 24.04"
24
+ def graalVmVersion = " 22.3.1"
25
+ def munitVersion = " 1.1.1"
26
+ def osLibVersion = " 0.11.4"
27
+ def pprintVersion = " 0.9.0"
28
+ def coursierVersion = " 2.1.24"
29
+ def scoptVersion = " 4.1.0"
30
+ def ubuntuVersion = " 24.04"
31
31
}
32
32
object cli extends Cli
33
33
trait Cli extends ScalaModule with ScalaJsCliPublishModule {
@@ -58,7 +58,7 @@ trait Cli extends ScalaModule with ScalaJsCliPublishModule {
58
58
def urlOf (path : os.Path ): Option [String ] =
59
59
if (path.startsWith(cachePath)) {
60
60
val segments = path.relativeTo(cachePath).segments
61
- val url = segments.head + " ://" + segments.tail.mkString(" /" )
61
+ val url = segments.head + " ://" + segments.tail.mkString(" /" )
62
62
Some (url)
63
63
}
64
64
else None
@@ -69,7 +69,7 @@ trait Cli extends ScalaModule with ScalaJsCliPublishModule {
69
69
Parameters ,
70
70
Preamble
71
71
}
72
- val cp = jarClassPath().map(_.path)
72
+ val cp = jarClassPath().map(_.path)
73
73
val mainClass0 = mainClass().getOrElse(sys.error(" No main class" ))
74
74
75
75
val dest = Task .ctx().dest / (if (isWin) " launcher.bat" else " launcher" )
@@ -81,7 +81,7 @@ trait Cli extends ScalaModule with ScalaJsCliPublishModule {
81
81
urlOf(path) match {
82
82
case None =>
83
83
val content = os.read.bytes(path)
84
- val name = path.last
84
+ val name = path.last
85
85
ClassPathEntry .Resource (name, os.mtime(path), content)
86
86
case Some (url) => ClassPathEntry .Url (url)
87
87
}
@@ -108,14 +108,14 @@ trait ScalaJsCliNativeImage extends ScalaModule with NativeImage {
108
108
" --no-fallback" ,
109
109
" -H:IncludeResources=org/scalajs/linker/backend/emitter/.*.sjsir" ,
110
110
" -H:IncludeResources=com/google/javascript/jscomp/js/polyfills.txt" ,
111
- " -H:IncludeResourceBundles=com.google.javascript.jscomp.parsing.ParserConfig" ,
111
+ " -H:IncludeResourceBundles=com.google.javascript.jscomp.parsing.ParserConfig"
112
112
)
113
113
}
114
- def nativeImagePersist : Boolean = System .getenv(" CI" ) != null
115
- def graalVmVersion : String = Versions .graalVmVersion
114
+ def nativeImagePersist : Boolean = System .getenv(" CI" ) != null
115
+ def graalVmVersion : String = Versions .graalVmVersion
116
116
def nativeImageGraalVmJvmId : Target [String ] = s " graalvm-java17: $graalVmVersion"
117
- def nativeImageName : Target [String ] = " scala-js-ld"
118
- def moduleDeps : Seq [JavaModule ] = Seq (cli)
117
+ def nativeImageName : Target [String ] = " scala-js-ld"
118
+ def moduleDeps : Seq [JavaModule ] = Seq (cli)
119
119
def compileIvyDeps : Target [Agg [Dep ]] =
120
120
super .compileIvyDeps() ++ Seq (ivy " org.graalvm.nativeimage:svm: $graalVmVersion" )
121
121
def nativeImageMainClass : Target [String ] = " org.scalajs.cli.Scalajsld"
@@ -156,10 +156,11 @@ trait ScalaJsCliStaticNativeImage extends ScalaJsCliNativeImage {
156
156
)
157
157
)
158
158
}
159
- def writeNativeImageScript (scriptDest : String , imageDest : String = " " ): Command [Unit ] = Task .Command {
160
- buildHelperImage()
161
- super .writeNativeImageScript(scriptDest, imageDest)()
162
- }
159
+ def writeNativeImageScript (scriptDest : String , imageDest : String = " " ): Command [Unit ] =
160
+ Task .Command {
161
+ buildHelperImage()
162
+ super .writeNativeImageScript(scriptDest, imageDest)()
163
+ }
163
164
}
164
165
object `native-static` extends ScalaJsCliStaticNativeImage
165
166
@@ -189,30 +190,42 @@ object tests extends ScalaModule {
189
190
override def test (args : String * ): Command [(String , Seq [TestResult ])] = jvm(args : _* )
190
191
191
192
private def testExtraArgs (launcher : os.Path ): Seq [String ] = Seq (
192
- s " -Dtest.scala-js-cli.path= ${ launcher} " ,
193
+ s " -Dtest.scala-js-cli.path= $launcher" ,
193
194
s " -Dtest.scala-js-cli.scala-js-version= ${Versions .scalaJsVersion}"
194
195
)
195
196
196
197
@ unused
197
198
def jvm (args : String * ): Command [(String , Seq [TestResult ])] = Task .Command {
198
- testTask(Task .Anon { args ++ testExtraArgs(cli.standaloneLauncher().path) }, Task .Anon (Seq .empty[String ]))()
199
+ testTask(
200
+ Task .Anon (args ++ testExtraArgs(cli.standaloneLauncher().path)),
201
+ Task .Anon (Seq .empty[String ])
202
+ )()
199
203
}
200
204
@ unused
201
205
def native (args : String * ): Command [(String , Seq [TestResult ])] = Task .Command {
202
- testTask(Task .Anon { args ++ testExtraArgs(native0.nativeImage().path) }, Task .Anon (Seq .empty[String ]))()
206
+ testTask(
207
+ Task .Anon (args ++ testExtraArgs(native0.nativeImage().path)),
208
+ Task .Anon (Seq .empty[String ])
209
+ )()
203
210
}
204
211
@ unused
205
212
def nativeStatic (args : String * ): Command [(String , Seq [TestResult ])] = Task .Command {
206
- testTask(Task .Anon { args ++ testExtraArgs(`native-static`.nativeImage().path) }, Task .Anon (Seq .empty[String ]))()
213
+ testTask(
214
+ Task .Anon (args ++ testExtraArgs(`native-static`.nativeImage().path)),
215
+ Task .Anon (Seq .empty[String ])
216
+ )()
207
217
}
208
218
@ unused
209
219
def nativeMostlyStatic (args : String * ): Command [(String , Seq [TestResult ])] = Task .Command {
210
- testTask(Task .Anon { args ++ testExtraArgs(`native-mostly-static`.nativeImage().path) }, Task .Anon (Seq .empty[String ]))()
220
+ testTask(
221
+ Task .Anon (args ++ testExtraArgs(`native-mostly-static`.nativeImage().path)),
222
+ Task .Anon (Seq .empty[String ])
223
+ )()
211
224
}
212
225
}
213
226
}
214
227
215
- def ghOrg = " virtuslab"
228
+ def ghOrg = " virtuslab"
216
229
def ghName = " scala-js-cli"
217
230
trait ScalaJsCliPublishModule extends PublishModule {
218
231
import mill .scalalib .publish ._
@@ -226,7 +239,7 @@ trait ScalaJsCliPublishModule extends PublishModule {
226
239
Developer (" alexarchambault" , " Alex Archambault" , " https://github.com/alexarchambault" ),
227
240
Developer (" sjrd" , " Sébastien Doeraene" , " https://github.com/sjrd" ),
228
241
Developer (" gzm0" , " Tobias Schlatter" , " https://github.com/gzm0" ),
229
- Developer (" nicolasstucki" , " Nicolas Stucki" , " https://github.com/nicolasstucki" ),
242
+ Developer (" nicolasstucki" , " Nicolas Stucki" , " https://github.com/nicolasstucki" )
230
243
)
231
244
)
232
245
def publishVersion : Target [String ] = finalPublishVersion()
@@ -247,7 +260,8 @@ def computePublishVersion(state: VcsState, simple: Boolean): String =
247
260
Some (tag.take(idx + 1 ) + (tag.drop(idx + 1 ).toInt + 1 ).toString + " -SNAPSHOT" )
248
261
else
249
262
None
250
- } else {
263
+ }
264
+ else {
251
265
val idx = tag.indexOf(" -" )
252
266
if (idx >= 0 ) Some (tag.take(idx) + " +" + tag.drop(idx + 1 ) + " -SNAPSHOT" )
253
267
else None
@@ -257,7 +271,8 @@ def computePublishVersion(state: VcsState, simple: Boolean): String =
257
271
Some (versionOrEmpty)
258
272
.filter(_.nonEmpty)
259
273
.getOrElse(state.format())
260
- } else {
274
+ }
275
+ else {
261
276
val rawVersion = os
262
277
.proc(" git" , " describe" , " --tags" )
263
278
.call()
@@ -292,29 +307,30 @@ def finalPublishVersion: Target[String] = {
292
307
293
308
object ci extends Module {
294
309
@ unused
295
- def publishSonatype (tasks : mill.main.Tasks [PublishModule .PublishData ]): Command [Unit ] = Task .Command {
296
- publishSonatype0(
297
- data = define.Target .sequence(tasks.value)(),
298
- log = Task .ctx().log
299
- )
300
- }
310
+ def publishSonatype (tasks : mill.main.Tasks [PublishModule .PublishData ]): Command [Unit ] =
311
+ Task .Command {
312
+ publishSonatype0(
313
+ data = define.Target .sequence(tasks.value)(),
314
+ log = Task .ctx().log
315
+ )
316
+ }
301
317
302
318
private def publishSonatype0 (
303
- data : Seq [PublishModule .PublishData ],
304
- log : mill.api.Logger
319
+ data : Seq [PublishModule .PublishData ],
320
+ log : mill.api.Logger
305
321
): Unit = {
306
322
307
323
val credentials = sys.env(" SONATYPE_USERNAME" ) + " :" + sys.env(" SONATYPE_PASSWORD" )
308
324
val pgpPassword = sys.env(" PGP_PASSPHRASE" )
309
- val timeout = 10 .minutes
325
+ val timeout = 10 .minutes
310
326
311
327
val artifacts = data.map { case PublishModule .PublishData (a, s) =>
312
328
(s.map { case (p, f) => (p.path, f) }, a)
313
329
}
314
330
315
331
val isRelease = {
316
332
val versions = artifacts.map(_._2.version).toSet
317
- val set = versions.map(! _.endsWith(" -SNAPSHOT" ))
333
+ val set = versions.map(! _.endsWith(" -SNAPSHOT" ))
318
334
assert(
319
335
set.size == 1 ,
320
336
s " Found both snapshot and non-snapshot versions: ${versions.toVector.sorted.mkString(" , " )}"
@@ -330,8 +346,10 @@ object ci extends Module {
330
346
" --detach-sign" ,
331
347
" --batch=true" ,
332
348
" --yes" ,
333
- " --pinentry-mode" , " loopback" ,
334
- " --passphrase" , pgpPassword,
349
+ " --pinentry-mode" ,
350
+ " loopback" ,
351
+ " --passphrase" ,
352
+ pgpPassword,
335
353
" --armor" ,
336
354
" --use-agent"
337
355
),
@@ -359,8 +377,24 @@ object ci extends Module {
359
377
if (version.endsWith(" -SNAPSHOT" )) (" launchers" , true )
360
378
else (" v" + version, false )
361
379
362
- Upload .upload(ghOrg, ghName, ghToken, tag, dryRun = false , overwrite = overwriteAssets)(launchers : _* )
363
- if (version != Versions .scalaJsVersion && ! version.endsWith(" -SNAPSHOT" )) // when we release `0.13.0.1` we should also update native launchers in tag `0.13.0`
364
- Upload .upload(ghOrg, ghName, ghToken, s " v ${Versions .scalaJsVersion}" , dryRun = false , overwrite = true )(launchers : _* )
380
+ Upload .upload(
381
+ ghOrg,
382
+ ghName,
383
+ ghToken,
384
+ tag,
385
+ dryRun = false ,
386
+ overwrite = overwriteAssets
387
+ )(launchers : _* )
388
+ if (
389
+ version != Versions .scalaJsVersion && ! version.endsWith(" -SNAPSHOT" )
390
+ ) // when we release `0.13.0.1` we should also update native launchers in tag `0.13.0`
391
+ Upload .upload(
392
+ ghOrg,
393
+ ghName,
394
+ ghToken,
395
+ s " v ${Versions .scalaJsVersion}" ,
396
+ dryRun = false ,
397
+ overwrite = true
398
+ )(launchers : _* )
365
399
}
366
400
}
0 commit comments