Skip to content

Commit 84b2e66

Browse files
committed
fix project/scripts/bootstrappedOnlyCmdTests for new scala launcher
1 parent 0e1b381 commit 84b2e66

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

project/scripts/bootstrappedOnlyCmdTests

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,28 +18,37 @@ grep -qe "val a: scala.Int = 3" "$tmp"
1818
# setup for `scalac`/`scala` script tests
1919
"$SBT" dist/pack
2020

21+
echo "capturing scala version from dist/target/pack/VERSION"
22+
IFS=':=' read -ra versionProps < "$ROOT/dist/target/pack/VERSION" # temporarily set IFS to ':=' to split versionProps
23+
[ ${#versionProps[@]} -eq 3 ] && \
24+
[ ${versionProps[0]} = "version" ] && \
25+
[ -n ${versionProps[2]} ] || die "Expected non-empty 'version' property in $ROOT/dist/target/pack/VERSION"
26+
scala_version=${versionProps[2]}
27+
2128
# check that `scalac` compiles and `scala` runs it
2229
echo "testing ./bin/scalac and ./bin/scala"
2330
clear_out "$OUT"
2431
./bin/scalac "$SOURCE" -d "$OUT"
25-
./bin/scala -classpath "$OUT" "$MAIN" > "$tmp"
32+
./bin/scala -classpath "$OUT" -M "$MAIN" > "$tmp"
2633
test "$EXPECTED_OUTPUT" = "$(cat "$tmp")"
2734

2835
# Test scaladoc based on compiled classes
2936
./bin/scaladoc -project Staging -d "$OUT1" "$OUT"
3037
clear_out "$OUT1"
3138

32-
# check that `scalac` and `scala` works for staging
39+
# check that `scalac` and `scala` works for staging.
40+
# TODO: scala3-staging should be automatically added by Scala CLI
41+
# - see: https://github.com/VirtusLab/scala-cli/issues/2879
3342
clear_out "$OUT"
3443
./bin/scalac tests/run-staging/i4044f.scala -d "$OUT"
35-
./bin/scala -with-compiler -classpath "$OUT" Test > "$tmp"
44+
./bin/scala -with-compiler -classpath "$OUT" --dep "org.scala-lang::scala3-staging:$scala_version" -M Test > "$tmp"
3645

3746
# check that `scalac -from-tasty` compiles and `scala` runs it
3847
echo "testing ./bin/scalac -from-tasty and scala -classpath"
3948
clear_out "$OUT1"
4049
./bin/scalac "$SOURCE" -d "$OUT"
4150
./bin/scalac -from-tasty -d "$OUT1" "$OUT/$TASTY"
42-
./bin/scala -classpath "$OUT1" "$MAIN" > "$tmp"
51+
./bin/scala -classpath "$OUT1" -M "$MAIN" > "$tmp"
4352
test "$EXPECTED_OUTPUT" = "$(cat "$tmp")"
4453

4554
# check that `sbt scalac -decompile` runs
@@ -90,10 +99,12 @@ clear_out "$OUT"
9099
./bin/scalac -help > "$tmp" 2>&1
91100
grep -qe "Usage: scalac <options> <source files>" "$tmp"
92101

102+
# TODO: JAVA launcher should be able to override "scala-cli" program name
103+
# - see: https://github.com/VirtusLab/scala-cli/issues/2838#issuecomment-2085130815
93104
./bin/scala -help > "$tmp" 2>&1
94-
grep -qe "Usage: scala <options> <source files>" "$tmp"
105+
grep -qe "See 'scala-cli <command> --help' to read about a specific subcommand." "$tmp"
95106

96-
./bin/scala -d hello.jar tests/run/hello.scala
107+
./bin/scala -d hello.jar tests/run/hello.scala --server=false
97108
ls hello.jar
98109

99110
echo "testing i12973"
@@ -102,14 +113,6 @@ clear_out "$OUT"
102113
echo "Bug12973().check" | TERM=dumb ./bin/scala -cp "$OUT/out.jar" > "$tmp" 2>&1
103114
grep -qe "Bug12973 is fixed" "$tmp"
104115

105-
echo "capturing scala version from dist/target/pack/VERSION"
106-
cwd=$(pwd)
107-
IFS=':=' read -ra versionProps < "$cwd/dist/target/pack/VERSION" # temporarily set IFS to ':=' to split versionProps
108-
[ ${#versionProps[@]} -eq 3 ] && \
109-
[ ${versionProps[0]} = "version" ] && \
110-
[ -n ${versionProps[2]} ] || die "Expected non-empty 'version' property in $cwd/dist/target/pack/VERSION"
111-
scala_version=${versionProps[2]}
112-
113116
echo "testing -sourcepath with incremental compile: inlining changed inline def into a def"
114117
# Here we will test that a changed inline method symbol loaded from the sourcepath (-sourcepath compiler option)
115118
# will have its `defTree` correctly set when its method body is required for inlining.

0 commit comments

Comments
 (0)