@@ -18,29 +18,17 @@ import scala.util.Properties.isWin
18
18
19
19
def scalaJsCliVersion = " 1.1.1-sc5"
20
20
def scala213 = " 2.13.10"
21
- def latestScalaJsVersion = " 1.13.0"
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 {
21
+ def scalaJsVersion = " 1.13.0"
22
+ object cli extends Cli
23
+ trait Cli extends ScalaModule with ScalaJsCliPublishModule {
27
24
def scalaVersion = scala213
28
25
def artifactName = " scalajs" + super .artifactName()
29
26
def ivyDeps = super .ivyDeps() ++ Seq (
30
- ivy " org.scala-js::scalajs-linker: $scalaJsVersion0 " ,
27
+ ivy " org.scala-js::scalajs-linker: $scalaJsVersion " ,
31
28
ivy " com.github.scopt::scopt:4.1.0 "
32
29
)
33
- def millSourcePath = super .millSourcePath / os.up
34
-
35
30
def mainClass = Some (" org.scalajs.cli.Scalajsld" )
36
31
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
-
44
32
def transitiveJars : T [Agg [PathRef ]] = {
45
33
46
34
def allModuleDeps (todo : List [JavaModule ]): List [JavaModule ] = {
@@ -73,7 +61,6 @@ class Cli(val scalaJsVersion0: String) extends ScalaModule with ScalaJsCliPublis
73
61
else None
74
62
75
63
import coursier .launcher .{
76
- AssemblyGenerator ,
77
64
BootstrapGenerator ,
78
65
ClassPathEntry ,
79
66
Parameters ,
@@ -107,9 +94,8 @@ class Cli(val scalaJsVersion0: String) extends ScalaModule with ScalaJsCliPublis
107
94
}
108
95
}
109
96
110
- class ScalaJsCliNativeImage ( val scalaJsVersion0 : String ) extends ScalaModule with NativeImage {
97
+ trait ScalaJsCliNativeImage extends ScalaModule with NativeImage {
111
98
def scalaVersion = scala213
112
- def scalaJsVersion = scalaJsVersion0
113
99
114
100
def nativeImageClassPath = T {
115
101
runClasspath()
@@ -127,7 +113,7 @@ class ScalaJsCliNativeImage(val scalaJsVersion0: String) extends ScalaModule wit
127
113
def nativeImageGraalVmJvmId = s " graalvm-java17: $graalVmVersion"
128
114
def nativeImageName = " scala-js-ld"
129
115
def moduleDeps () = Seq (
130
- cli(scalaJsVersion0)
116
+ cli
131
117
)
132
118
def compileIvyDeps = super .compileIvyDeps() ++ Seq (
133
119
ivy " org.graalvm.nativeimage:svm: $graalVmVersion"
@@ -146,13 +132,13 @@ class ScalaJsCliNativeImage(val scalaJsVersion0: String) extends ScalaModule wit
146
132
}
147
133
}
148
134
149
- object native extends Cross [ ScalaJsCliNativeImage ]( scalaJsVersions : _* )
135
+ object native extends ScalaJsCliNativeImage
150
136
151
137
def native0 = native
152
138
153
139
def csDockerVersion = " 2.1.0-M5-18-gfebf9838c"
154
140
155
- class ScalaJsCliStaticNativeImage ( scalaJsVersion0 : String ) extends ScalaJsCliNativeImage (scalaJsVersion0) {
141
+ trait ScalaJsCliStaticNativeImage extends ScalaJsCliNativeImage {
156
142
def nameSuffix = " -static"
157
143
def buildHelperImage = T {
158
144
os.proc(" docker" , " build" , " -t" , " scala-cli-base-musl:latest" , " ." )
@@ -173,9 +159,9 @@ class ScalaJsCliStaticNativeImage(scalaJsVersion0: String) extends ScalaJsCliNat
173
159
super .writeNativeImageScript(scriptDest, imageDest)()
174
160
}
175
161
}
176
- object `native-static` extends Cross [ ScalaJsCliStaticNativeImage ]( scalaJsVersions : _* )
162
+ object `native-static` extends ScalaJsCliStaticNativeImage
177
163
178
- class ScalaJsCliMostlyStaticNativeImage ( scalaJsVersion0 : String ) extends ScalaJsCliNativeImage (scalaJsVersion0) {
164
+ trait ScalaJsCliMostlyStaticNativeImage extends ScalaJsCliNativeImage {
179
165
def nameSuffix = " -mostly-static"
180
166
def nativeImageDockerParams = Some (
181
167
NativeImage .linuxMostlyStaticParams(
@@ -184,10 +170,9 @@ class ScalaJsCliMostlyStaticNativeImage(scalaJsVersion0: String) extends ScalaJs
184
170
)
185
171
)
186
172
}
187
- object `native-mostly-static` extends Cross [ ScalaJsCliMostlyStaticNativeImage ]( scalaJsVersions : _* )
173
+ object `native-mostly-static` extends ScalaJsCliMostlyStaticNativeImage
188
174
189
- object tests extends Cross [Tests ](scalaJsVersions : _* )
190
- class Tests (val scalaJsVersion0 : String ) extends ScalaModule {
175
+ object tests extends ScalaModule {
191
176
def scalaVersion = scala213
192
177
193
178
object test extends Tests {
@@ -206,7 +191,7 @@ class Tests(val scalaJsVersion0: String) extends ScalaModule {
206
191
val launcher = launcherTask().path
207
192
val extraArgs = Seq (
208
193
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 "
210
195
)
211
196
args ++ extraArgs
212
197
}
@@ -219,31 +204,13 @@ class Tests(val scalaJsVersion0: String) extends ScalaModule {
219
204
def test (args : String * ) =
220
205
jvm(args : _* )
221
206
def jvm (args : String * ) =
222
- new TestHelper (cli(scalaJsVersion0) .standaloneLauncher).test(args : _* )
207
+ new TestHelper (cli.standaloneLauncher).test(args : _* )
223
208
def native (args : String * ) =
224
- new TestHelper (native0(scalaJsVersion0) .nativeImage).test(args : _* )
209
+ new TestHelper (native0.nativeImage).test(args : _* )
225
210
def nativeStatic (args : String * ) =
226
- new TestHelper (`native-static`(scalaJsVersion0) .nativeImage).test(args : _* )
211
+ new TestHelper (`native-static`.nativeImage).test(args : _* )
227
212
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 : _* )
247
214
}
248
215
}
249
216
0 commit comments