File tree Expand file tree Collapse file tree 2 files changed +58
-21
lines changed Expand file tree Collapse file tree 2 files changed +58
-21
lines changed Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
3
+ IFS=" "
3
4
# Try to autodetect real location of the script
4
5
5
6
if [ -z " $PROG_HOME " ] ; then
@@ -31,18 +32,52 @@ source "$PROG_HOME/bin/common"
31
32
32
33
CLASS_PATH=" .$PSEP$DOTTY_LIB$PSEP$SCALA_LIB "
33
34
34
- # -d must be the first option
35
- case " $1 " in
36
- -d) DEBUG=" $DEBUG_STR " && shift ;;
37
- esac
35
+ addResidual () {
36
+ residual_args+=(" $1 " )
37
+ }
38
38
39
- first_arg=" $1 "
39
+ addCustomClassPath () {
40
+ classpath_args+=(" $1 :" )
41
+ }
40
42
41
- if [ -z " $1 " ]; then
43
+ run_repl=false
44
+
45
+ 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
+ ;;
65
+
66
+ esac
67
+ done
68
+
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
42
78
echo " Starting dotty REPL..."
43
79
eval " $PROG_HOME /bin/dotc -repl"
44
- elif [[ ${first_arg: 0: 1} == " -" ]]; then
45
- eval " $PROG_HOME /bin/dotc -repl $@ "
46
80
else
47
- eval exec " \" $JAVACMD \" " " $DEBUG " " -classpath \" $CLASS_PATH \" " $@
81
+ CLASS_PATH=" ${classpath_args[*]} $CLASS_PATH "
82
+ eval exec " \" $JAVACMD \" " " $DEBUG " " -classpath \" $CLASS_PATH \" " " ${residual_args[@]} "
48
83
fi
Original file line number Diff line number Diff line change 11
11
echo " testing sbt dotc and dotr"
12
12
mkdir out/scriptedtest0
13
13
./bin/dotc tests/pos/sbtDotrTest.scala -d out/scriptedtest0
14
+
14
15
# FIXME #3477
15
- # ./bin/dotr -classpath out/scriptedtest0 dotrtest.Test" > sbtdotr1.out
16
- # if grep -e "dotr test ok" sbtdotr1.out; then
17
- # echo "output ok"
18
- # else
19
- # exit -1
20
- # fi
16
+ ./bin/dotr -classpath out/scriptedtest0 dotrtest.Test" > sbtdotr1.out
17
+ if grep -e " dotr test ok" sbtdotr1.out; then
18
+ echo " output ok"
19
+ else
20
+ exit -1
21
+ fi
21
22
22
23
23
24
# check that ` dotc` compiles and ` dotr` runs it
@@ -26,10 +27,11 @@ mkdir out/scriptedtest1
26
27
mkdir out/scriptedtest2
27
28
./bin/dotc tests/pos/sbtDotrTest.scala -d out/scriptedtest1/
28
29
./bin/dotc -tasty -classpath out/scriptedtest1/ -d out/scriptedtest2/ dotrtest.Test
30
+
29
31
# FIXME #3477
30
- # ./bin/dotr -classpath out/scriptedtest2/ dotrtest.Test" > sbtdotr2.out
31
- # if grep -e "dotr test ok" sbtdotr2.out; then
32
- # echo "output ok"
33
- # else
34
- # exit -1
35
- # fi
32
+ ./bin/dotr -classpath out/scriptedtest2/ dotrtest.Test" > sbtdotr2.out
33
+ if grep -e " dotr test ok" sbtdotr2.out; then
34
+ echo " output ok"
35
+ else
36
+ exit -1
37
+ fi
You can’t perform that action at this time.
0 commit comments