Skip to content

Commit

Permalink
Merge pull request #13 from alexarchambault/develop
Browse files Browse the repository at this point in the history
Checking stuff
  • Loading branch information
alexarchambault authored Sep 26, 2022
2 parents eb423ac + df6a769 commit 7bbda03
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
6 changes: 3 additions & 3 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class ScalaJsCliNativeImage(val scalaJsVersion0: String) extends ScalaModule wit
System.err.println(s"Testing ${path.relativeTo(os.pwd)}")
val cwd = T.dest / "workdir"
os.makeDir.all(cwd)
os.proc(bash, os.pwd / "scripts" / "test-cli.sh", path)
os.proc(bash, os.pwd / "scripts" / "test-cli.sh", path, scalaJsVersion)
.call(cwd = cwd, stdin = os.Inherit, stdout = os.Inherit)
}
}
Expand Down Expand Up @@ -339,7 +339,7 @@ object ci extends Module {
if (version.endsWith("-SNAPSHOT")) ("launchers", true)
else ("v" + version, false)

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

def testCli() = {
Expand All @@ -353,7 +353,7 @@ object ci extends Module {
System.err.println(s"Testing Scala.JS $scalaJsVer")
val cwd = workDir / scalaJsVer
os.makeDir.all(cwd)
os.proc(bash, os.pwd / "scripts" / "test-cli.sh", launcher.path)
os.proc(bash, os.pwd / "scripts" / "test-cli.sh", launcher.path, scalaJsVer)
.call(cwd = cwd, stdin = os.Inherit, stdout = os.Inherit)
}
}
Expand Down
15 changes: 8 additions & 7 deletions scripts/test-cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
set -ev

launcher="$1"
scalaJsVersion="$2"

if [ "$launcher" == "" ]; then
echo "Usage: $0 launcher" 1>&2
if [ "$launcher" == "" -o "$scalaJsVersion" == "" ]; then
echo "Usage: $0 launcher scala-js-version" 1>&2
exit 1
fi

echo "Using launcher $launcher"
echo "Using launcher $launcher, Scala.JS $scalaJsVersion"

fail() {
echo "$1" >&2
Expand All @@ -29,11 +30,11 @@ object Foo {
EOF

cs launch scalac:2.13.6 -- \
-classpath "$(cs fetch --intransitive org.scala-js::scalajs-library:1.9.0)" \
-Xplugin:"$(cs fetch --intransitive org.scala-js:scalajs-compiler_2.13.6:1.9.0)" \
-classpath "$(cs fetch --intransitive org.scala-js::scalajs-library:$scalaJsVersion)" \
-Xplugin:"$(cs fetch --intransitive org.scala-js:scalajs-compiler_2.13.6:$scalaJsVersion)" \
-d bin foo.scala

"$launcher" --stdlib "$(cs fetch --intransitive org.scala-js::scalajs-library:1.9.0)" -s -o test.js -mm Foo.main bin 2> test_stderr.txt || cat test_stderr.txt
"$launcher" --stdlib "$(cs fetch --intransitive org.scala-js::scalajs-library:$scalaJsVersion)" -s -o test.js -mm Foo.main bin 2> test_stderr.txt || cat test_stderr.txt
grep -Fxq "Warning: using a single file as output (--output) is deprecated since Scala.js 1.3.0. Use --outputDir instead." test_stderr.txt \
|| fail "expected warning. Got: $(cat test_stderr.txt)"
test -s test.js || fail "scalajsld: empty output"
Expand All @@ -47,7 +48,7 @@ EOF
diff got-legacy.run want-legacy.run

mkdir test-output
"$launcher" --stdlib "$(cs fetch --intransitive org.scala-js::scalajs-library:1.9.0)" -s --outputDir test-output --moduleSplitStyle SmallestModules --moduleKind CommonJSModule -mm Foo.main bin
"$launcher" --stdlib "$(cs fetch --intransitive org.scala-js::scalajs-library:$scalaJsVersion)" -s --outputDir test-output --moduleSplitStyle SmallestModules --moduleKind CommonJSModule -mm Foo.main bin
test "$(ls test-output/*.js| wc -w)" -gt "1" || fail "scalajsld: produced single js output file"

node test-output/main.js > got.run
Expand Down

0 comments on commit 7bbda03

Please sign in to comment.