File tree Expand file tree Collapse file tree 1 file changed +24
-5
lines changed Expand file tree Collapse file tree 1 file changed +24
-5
lines changed Original file line number Diff line number Diff line change @@ -27,21 +27,32 @@ if [ -z "$PROG_HOME" ] ; then
27
27
cd " $saveddir "
28
28
fi
29
29
30
+ addJvmOptions () {
31
+ jvm_options+=(" $1 " )
32
+ }
33
+
30
34
source " $PROG_HOME /bin/common"
31
35
32
36
declare -a residual_args
33
- run_repl=false
37
+ execute_repl=false
38
+ execute_run=false
34
39
with_compiler=false
40
+ class_path_count=0
35
41
CLASS_PATH=" "
36
42
37
43
while [[ $# -gt 0 ]]; do
38
44
case " $1 " in
39
45
-repl)
40
- run_repl=true
46
+ execute_repl=true
47
+ shift
48
+ ;;
49
+ -run)
50
+ execute_run=true
41
51
shift
42
52
;;
43
53
-classpath)
44
54
CLASS_PATH=" $2 "
55
+ class_path_count+=1
45
56
shift
46
57
shift
47
58
;;
@@ -53,6 +64,9 @@ while [[ $# -gt 0 ]]; do
53
64
DEBUG=" $DEBUG_STR "
54
65
shift
55
66
;;
67
+ -J* )
68
+ addJvmOptions " -${1: 2} "
69
+ shift ;;
56
70
* )
57
71
residual_args+=(" $1 " )
58
72
shift
@@ -61,21 +75,26 @@ while [[ $# -gt 0 ]]; do
61
75
esac
62
76
done
63
77
64
- if [ $run_repl == true ] || [ ${# residual_args[@]} -eq 0 ]; then
78
+ if [ $execute_repl == true ] || ( [ $execute_run == false ] && [ $ {# residual_args[@]} -eq 0 ]) ; then
65
79
if [ " $CLASS_PATH " ]; then
66
80
cp_arg=" -classpath \" $CLASS_PATH \" "
67
81
fi
68
82
echo " Starting dotty REPL..."
69
83
eval " \" $PROG_HOME /bin/dotc\" $cp_arg -repl ${residual_args[@]} "
70
- else
84
+ elif [ $execute_repl == true ] || [ ${ # residual_args[@]} -ne 0 ] ; then
71
85
cp_arg=" $DOTTY_LIB$PSEP$SCALA_LIB "
72
86
if [ -z " $CLASS_PATH " ]; then
73
87
cp_arg+=" $PSEP ."
74
88
else
75
89
cp_arg+=" $PSEP$CLASS_PATH "
76
90
fi
91
+ if [ $class_path_count > 1 ]; then
92
+ echo " warning: multiple classpaths are found, dotr only use the last one."
93
+ fi
77
94
if [ $with_compiler == true ]; then
78
95
cp_arg+=" $PSEP$DOTTY_COMP$PSEP$DOTTY_INTF$PSEP$SCALA_ASM "
79
96
fi
80
- eval exec " \" $JAVACMD \" " " $DEBUG " " -classpath \" $cp_arg \" " " ${residual_args[@]} "
97
+ eval exec " \" $JAVACMD \" " " $DEBUG " " -classpath \" $cp_arg \" " " ${jvm_options[@]} " " ${residual_args[@]} "
98
+ else
99
+ echo " warning: command option is not correct."
81
100
fi
You can’t perform that action at this time.
0 commit comments