Skip to content

Fix #3477: Add custom classpath to dotr script #3493

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 37 additions & 12 deletions dist/bin/dotr
Original file line number Diff line number Diff line change
Expand Up @@ -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
28 changes: 13 additions & 15 deletions project/scripts/sbtBootstrappedTests
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,20 @@
# 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

# check that `dotc` compiles and `dotr` runs it
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
Expand All @@ -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