Skip to content

Commit e2b013c

Browse files
alexarchambaultlwronski
authored andcommitted
Tweak things
1 parent b77ef54 commit e2b013c

File tree

8 files changed

+169
-148
lines changed

8 files changed

+169
-148
lines changed

.github/workflows/ci.yml

Lines changed: 119 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ on:
66
tags:
77
- "v*"
88
pull_request:
9-
branches:
10-
- master
9+
1110
jobs:
12-
build:
11+
test:
1312
runs-on: ubuntu-latest
1413
strategy:
1514
fail-fast: false
@@ -22,8 +21,10 @@ jobs:
2221
with:
2322
jvm: "temurin:17"
2423
- name: Test CLI
25-
run: ./scripts/test-cli.sh
24+
run: ./mill -i ci.testCli
25+
2626
publish:
27+
needs: test
2728
runs-on: ubuntu-latest
2829
if: github.event_name == 'push'
2930
steps:
@@ -34,9 +35,122 @@ jobs:
3435
- uses: VirtusLab/scala-cli-setup@0dab3c3ec860f0443d4d25a56a549f9f46204389
3536
with:
3637
jvm: "temurin:17"
37-
- run: ./mill -i ci.publishSonatype Cli.publishArtifacts
38+
- run: ./mill -i ci.publishSonatype __.publishArtifacts
3839
env:
3940
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
4041
PGP_SECRET: ${{ secrets.PGP_SECRET }}
4142
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
4243
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
44+
45+
generate-launchers:
46+
needs: test
47+
runs-on: ${{ matrix.os }}
48+
strategy:
49+
fail-fast: false
50+
matrix:
51+
os: [ubuntu-latest, windows-latest, macos-latest]
52+
scalaJsVersion: ["1.9.0", "1.10.0", "1.10.1"]
53+
steps:
54+
- uses: actions/checkout@v2
55+
with:
56+
fetch-depth: 0
57+
submodules: true
58+
- uses: coursier/[email protected]
59+
- uses: coursier/[email protected]
60+
with:
61+
jvm: temurin:17
62+
- run: |
63+
./mill -i "native[$scalaJsVersion].writeNativeImageScript" generate.sh "" && \
64+
./generate.sh && \
65+
./mill -i "native[$scalaJsVersion].testNative" && \
66+
./mill -i "native[$scalaJsVersion].copyToArtifacts" artifacts/
67+
if: runner.os != 'Windows'
68+
env:
69+
scalaJsVersion: ${{ matrix.scalaJsVersion }}
70+
- run: |
71+
@call ./mill.bat -i "native[%scalaJsVersion%].writeNativeImageScript" generate.bat ""
72+
@call generate.bat
73+
@call ./mill.bat -i "native[%scalaJsVersion%].testNative"
74+
@call ./mill.bat -i "native[%scalaJsVersion%].copyToArtifacts" artifacts/
75+
shell: cmd
76+
if: runner.os == 'Windows'
77+
env:
78+
scalaJsVersion: ${{ matrix.scalaJsVersion }}
79+
- uses: actions/[email protected]
80+
with:
81+
name: launcher-${{ matrix.os }}
82+
path: artifacts/
83+
if-no-files-found: error
84+
retention-days: 1
85+
- run: ./mill -i ci.upload artifacts/
86+
if: github.event_name == 'push'
87+
env:
88+
UPLOAD_GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
89+
90+
generate-static-launcher:
91+
needs: test
92+
runs-on: ubuntu-latest
93+
strategy:
94+
fail-fast: false
95+
matrix:
96+
scalaJsVersion: ["1.9.0", "1.10.0", "1.10.1"]
97+
steps:
98+
- uses: actions/checkout@v2
99+
with:
100+
fetch-depth: 0
101+
submodules: true
102+
- uses: coursier/[email protected]
103+
- uses: coursier/[email protected]
104+
with:
105+
jvm: temurin:17
106+
- run: |
107+
./mill -i "native-static[$scalaJsVersion].writeNativeImageScript" generate.sh "" && \
108+
./generate.sh && \
109+
./mill -i "native-static[$scalaJsVersion].testNative" && \
110+
./mill -i "native-static[$scalaJsVersion].copyToArtifacts" artifacts/
111+
env:
112+
scalaJsVersion: ${{ matrix.scalaJsVersion }}
113+
- uses: actions/[email protected]
114+
with:
115+
name: launcher-${{ matrix.os }}-static
116+
path: artifacts/
117+
if-no-files-found: error
118+
retention-days: 1
119+
- run: ./mill -i upload artifacts/
120+
if: github.event_name == 'push'
121+
env:
122+
UPLOAD_GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
123+
124+
generate-mostly-static-launcher:
125+
needs: test
126+
runs-on: ubuntu-latest
127+
strategy:
128+
fail-fast: false
129+
matrix:
130+
scalaJsVersion: ["1.9.0", "1.10.0", "1.10.1"]
131+
steps:
132+
- uses: actions/checkout@v2
133+
with:
134+
fetch-depth: 0
135+
submodules: true
136+
- uses: coursier/[email protected]
137+
- uses: coursier/[email protected]
138+
with:
139+
jvm: temurin:17
140+
- run: |
141+
./mill -i "native-mostly-static[$scalaJsVersion].writeNativeImageScript" generate.sh "" && \
142+
./generate.sh && \
143+
./mill -i "native-mostly-static[$scalaJsVersion].testNative" && \
144+
./mill -i "native-mostly-static[$scalaJsVersion].copyToArtifacts" artifacts/
145+
env:
146+
scalaJsVersion: ${{ matrix.scalaJsVersion }}
147+
- uses: actions/[email protected]
148+
with:
149+
name: launcher-${{ matrix.os }}-mostly-static
150+
path: artifacts/
151+
if-no-files-found: error
152+
retention-days: 1
153+
- run: ./mill -i upload artifacts/
154+
if: github.event_name == 'push'
155+
env:
156+
UPLOAD_GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/launchers.yml

Lines changed: 0 additions & 114 deletions
This file was deleted.

.gitignore

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
1-
target/
21
/.bsp/
3-
/pack/
4-
/cli-test/
5-
out/
2+
out/

build.sc

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,23 @@ import mill.scalalib._
1111
import coursier.core.Version
1212

1313
import scala.concurrent.duration._
14+
import scala.util.Properties.isWin
1415

1516

1617
def scalaJsCliVersion = "1.1.1-sc5"
1718
def scala213 = "2.13.8"
1819
def latestScalaJsVersion = "1.10.1"
1920
def scalaJsVersions = Seq("1.9.0", "1.10.0", latestScalaJsVersion)
2021

21-
object cli extends Cli(latestScalaJsVersion)
22+
object cli extends Cross[Cli](scalaJsVersions: _*)
2223

2324
class Cli(val scalaJsVersion0: String) extends ScalaModule with ScalaJsCliPublishModule {
2425
def scalaVersion = scala213
2526
def ivyDeps = super.ivyDeps() ++ Seq(
2627
ivy"org.scala-js::scalajs-linker:$scalaJsVersion0",
2728
ivy"com.github.scopt::scopt:4.1.0"
2829
)
29-
def millSourcePath = super.millSourcePath / os.up / "cli"
30+
def millSourcePath = super.millSourcePath / os.up
3031

3132
def mainClass = Some("org.scalajs.cli.Scalajsld")
3233

@@ -75,7 +76,6 @@ class Cli(val scalaJsVersion0: String) extends ScalaModule with ScalaJsCliPublis
7576
Parameters,
7677
Preamble
7778
}
78-
import scala.util.Properties.isWin
7979
val cp = jarClassPath().map(_.path)
8080
val mainClass0 = mainClass().getOrElse(sys.error("No main class"))
8181

@@ -124,7 +124,7 @@ class ScalaJsCliNativeImage(val scalaJsVersion0: String) extends ScalaModule wit
124124
def nativeImageGraalVmJvmId = s"graalvm-java17:$graalVmVersion"
125125
def nativeImageName = "scala-js-ld"
126126
def moduleDeps() = Seq(
127-
new Cli(scalaJsVersion0)
127+
cli(scalaJsVersion0)
128128
)
129129
def compileIvyDeps = super.compileIvyDeps() ++ Seq(
130130
ivy"org.graalvm.nativeimage:svm:$graalVmVersion"
@@ -141,6 +141,15 @@ class ScalaJsCliNativeImage(val scalaJsVersion0: String) extends ScalaModule wit
141141
suffix = nameSuffix
142142
)
143143
}
144+
145+
def testNative() = T.command {
146+
val path = nativeImage().path
147+
System.err.println(s"Testing ${path.relativeTo(os.pwd)}")
148+
val cwd = T.dest / "workdir"
149+
os.makeDir.all(cwd)
150+
os.proc(bash, os.pwd / "scripts" / "test-cli.sh", path)
151+
.call(cwd = cwd, stdin = os.Inherit, stdout = os.Inherit)
152+
}
144153
}
145154

146155
object native extends Cross[ScalaJsCliNativeImage](scalaJsVersions: _*)
@@ -331,12 +340,25 @@ object ci extends Module {
331340

332341
Upload.upload("scala-cli", "scala-js-cli-native-image", ghToken, tag, dryRun = false, overwrite = overwriteAssets)(launchers: _*)
333342
}
334-
}
335343

336-
def copyTo(task: mill.main.Tasks[PathRef], dest: os.Path) = T.command {
337-
if (task.value.length > 1)
338-
sys.error("Expected a single task")
339-
val ref = task.value.head()
340-
os.makeDir.all(dest / os.up)
341-
os.copy.over(ref.path, dest)
344+
def testCli() = {
345+
val tasks = scalaJsVersions.map { scalaJsVer =>
346+
cli(scalaJsVer).standaloneLauncher.map((scalaJsVer, _))
347+
}
348+
T.command {
349+
val workDir = T.dest
350+
val launchers = T.sequence(tasks)()
351+
for ((scalaJsVer, launcher) <- launchers) {
352+
System.err.println(s"Testing Scala.JS $scalaJsVer")
353+
val cwd = workDir / scalaJsVer
354+
os.makeDir.all(cwd)
355+
os.proc(bash, os.pwd / "scripts" / "test-cli.sh", launcher.path)
356+
.call(cwd = cwd, stdin = os.Inherit, stdout = os.Inherit)
357+
}
358+
}
359+
}
342360
}
361+
362+
private def bash =
363+
if (isWin) Seq("bash.exe")
364+
else Nil
File renamed without changes.
File renamed without changes.

cli/src/main/scala/org/scalajs/cli/internal/ModuleSplitStyle.scala renamed to cli/src/org/scalajs/cli/internal/ModuleSplitStyle.scala

File renamed without changes.

0 commit comments

Comments
 (0)