diff --git a/dist/bin/dotr b/dist/bin/dotr index c2563808e67b..568f201f38ad 100755 --- a/dist/bin/dotr +++ b/dist/bin/dotr @@ -29,20 +29,45 @@ fi source "$PROG_HOME/bin/common" -CLASS_PATH=".$PSEP$DOTTY_LIB$PSEP$SCALA_LIB" +declare -a residual_args +run_repl=false +CLASS_PATH="" -# -d must be the first option -case "$1" in - -d) DEBUG="$DEBUG_STR" && shift ;; -esac +while [[ $# -gt 0 ]]; do + case "$1" in + -repl) + run_repl=true + shift + ;; + -classpath) + CLASS_PATH="$2" + shift + shift + ;; + -d) + DEBUG="$DEBUG_STR" + shift + ;; + *) + residual_args+=("$1") + shift + ;; -first_arg="$1" + esac +done -if [ -z "$1" ]; then - echo "Starting dotty REPL..." - eval "$PROG_HOME/bin/dotc -repl" -elif [[ ${first_arg:0:1} == "-" ]]; then - eval "$PROG_HOME/bin/dotc -repl $@" +if [ $run_repl == true ] || [ ${#residual_args[@]} -eq 0 ]; then + if [ "$CLASS_PATH" ]; then + cp_arg="-classpath $CLASS_PATH" + fi + echo "Starting dotty REPL" + eval "$PROG_HOME/bin/dotc $cp_arg -repl ${residual_args[@]}" else - eval exec "\"$JAVACMD\"" "$DEBUG" "-classpath \"$CLASS_PATH\"" $@ + cp_arg="-classpath $DOTTY_LIB$PSEP$SCALA_LIB" + if [ -z "$CLASS_PATH" ]; then + cp_arg+="$PSEP." + else + cp_arg+="$PSEP$CLASS_PATH" + fi + eval exec "\"$JAVACMD\"" "$DEBUG" "$cp_arg" "${residual_args[@]}" fi diff --git a/project/scripts/sbtBootstrappedTests b/project/scripts/sbtBootstrappedTests index 9704a0bd1a83..a306916fdf00 100755 --- a/project/scripts/sbtBootstrappedTests +++ b/project/scripts/sbtBootstrappedTests @@ -3,7 +3,6 @@ # check that benchmarks can run ./project/scripts/sbt "dotty-bench-bootstrapped/jmh:run 1 1 tests/pos/alias.scala" - # setup for `dotc`/`dotr` script tests ./project/scripts/sbt dist-bootstrapped/pack @@ -11,13 +10,13 @@ echo "testing sbt dotc and dotr" mkdir out/scriptedtest0 ./bin/dotc tests/pos/sbtDotrTest.scala -d out/scriptedtest0 -# FIXME #3477 -#./bin/dotr -classpath out/scriptedtest0 dotrtest.Test" > sbtdotr1.out -#if grep -e "dotr test ok" sbtdotr1.out; then -# echo "output ok" -#else -# exit -1 -#fi + +./bin/dotr -classpath out/scriptedtest0 dotrtest.Test" > sbtdotr1.out +if grep -e "dotr test ok" sbtdotr1.out; then + echo "output ok" +else + exit -1 +fi # check that `dotc` compiles and `dotr` runs it @@ -26,10 +25,9 @@ mkdir out/scriptedtest1 mkdir out/scriptedtest2 ./bin/dotc tests/pos/sbtDotrTest.scala -d out/scriptedtest1/ ./bin/dotc -from-tasty -classpath out/scriptedtest1/ -d out/scriptedtest2/ dotrtest.Test -# FIXME #3477 -#./bin/dotr -classpath out/scriptedtest2/ dotrtest.Test" > sbtdotr2.out -#if grep -e "dotr test ok" sbtdotr2.out; then -# echo "output ok" -#else -# exit -1 -#fi +./bin/dotr -classpath out/scriptedtest2/ dotrtest.Test" > sbtdotr2.out +if grep -e "dotr test ok" sbtdotr2.out; then + echo "output ok" +else + exit -1 +fi