Skip to content

Commit a477cd5

Browse files
committed
Polish
1 parent 02a1424 commit a477cd5

File tree

2 files changed

+33
-45
lines changed

2 files changed

+33
-45
lines changed

dist/bin/dotr

Lines changed: 33 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/usr/bin/env bash
22

3-
IFS=""
43
# Try to autodetect real location of the script
54

65
if [ -z "$PROG_HOME" ] ; then
@@ -30,54 +29,45 @@ fi
3029

3130
source "$PROG_HOME/bin/common"
3231

33-
CLASS_PATH=".$PSEP$DOTTY_LIB$PSEP$SCALA_LIB"
34-
35-
addResidual () {
36-
residual_args+=("$1")
37-
}
38-
39-
addCustomClassPath () {
40-
classpath_args+=("$1:")
41-
}
42-
32+
declare -a residual_args
4333
run_repl=false
34+
CLASS_PATH=""
4435

4536
while [[ $# -gt 0 ]]; do
46-
key=$1
47-
case $key in
48-
-repl)
49-
run_repl=true
50-
shift
51-
;;
52-
-classpath)
53-
addCustomClassPath "$2"
54-
shift
55-
shift
56-
;;
57-
-d)
58-
DEBUG="$DEBUG_STR"
59-
shift
60-
;;
61-
*)
62-
addResidual "$1"
63-
shift
64-
;;
37+
case "$1" in
38+
-repl)
39+
run_repl=true
40+
shift
41+
;;
42+
-classpath)
43+
CLASS_PATH="$2"
44+
shift
45+
shift
46+
;;
47+
-d)
48+
DEBUG="$DEBUG_STR"
49+
shift
50+
;;
51+
*)
52+
residual_args+=("$1")
53+
shift
54+
;;
6555

6656
esac
6757
done
6858

69-
if [ $run_repl == true ]; then
70-
echo "Starting dotty REPL"
71-
if [ -z $classpath_args ]; then
72-
classpath_args=""
73-
else
74-
classpath_args="-classpath \"${classpath_args[*]}\""
75-
fi
76-
eval "$PROG_HOME/bin/dotc $classpath_args -repl ${residual_args[@]}"
77-
elif [ -z $residual_args ]; then
78-
echo "Starting dotty REPL..."
79-
eval "$PROG_HOME/bin/dotc -repl"
59+
if [ $run_repl == true ] || [ ${#residual_args[@]} -eq 0 ]; then
60+
if [ "$CLASS_PATH" ]; then
61+
cp_arg="-classpath $CLASS_PATH"
62+
fi
63+
echo "Starting dotty REPL"
64+
eval "$PROG_HOME/bin/dotc $cp_arg -repl ${residual_args[@]}"
8065
else
81-
CLASS_PATH="${classpath_args[*]}$CLASS_PATH"
82-
eval exec "\"$JAVACMD\"" "$DEBUG" "-classpath \"$CLASS_PATH\"" "${residual_args[@]}"
66+
cp_arg="-classpath $DOTTY_LIB$PSEP$SCALA_LIB"
67+
if [ -z "$CLASS_PATH" ]; then
68+
cp_arg+="$PSEP."
69+
else
70+
cp_arg+="$PSEP$CLASS_PATH"
71+
fi
72+
eval exec "\"$JAVACMD\"" "$DEBUG" "$cp_arg" "${residual_args[@]}"
8373
fi

project/scripts/sbtBootstrappedTests

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
# check that benchmarks can run
44
./project/scripts/sbt "dotty-bench-bootstrapped/jmh:run 1 1 tests/pos/alias.scala"
55

6-
76
# setup for `dotc`/`dotr` script tests
87
./project/scripts/sbt dist-bootstrapped/pack
98

@@ -12,7 +11,6 @@ echo "testing sbt dotc and dotr"
1211
mkdir out/scriptedtest0
1312
./bin/dotc tests/pos/sbtDotrTest.scala -d out/scriptedtest0
1413

15-
# FIXME #3477
1614
./bin/dotr -classpath out/scriptedtest0 dotrtest.Test" > sbtdotr1.out
1715
if grep -e "dotr test ok" sbtdotr1.out; then
1816
echo "output ok"

0 commit comments

Comments
 (0)