File tree 2 files changed +18
-8
lines changed
2 files changed +18
-8
lines changed Original file line number Diff line number Diff line change @@ -93,11 +93,11 @@ case "$1" in
93
93
-no-colors) unset colors && shift ;;
94
94
-with-compiler) jvm_cp_args=" $PSEP$DOTTY_COMP " && shift ;;
95
95
96
- # break out -D and -J options and add them to JAVA_OPTS as well
97
- # so they reach the JVM in time to do some good. The -D options
96
+ # break out -D and -J options and add them to java_args so
97
+ # they reach the JVM in time to do some good. The -D options
98
98
# will be available as system properties.
99
- -D* ) addJava " $1 " && addScala " $1 " && shift ;;
100
- -J* ) addJava " ${1: 2} " && addScala " $1 " && shift ;;
99
+ -D* ) addJava " $1 " && shift ;;
100
+ -J* ) addJava " ${1: 2} " && shift ;;
101
101
* ) addResidual " $1 " && shift ;;
102
102
esac
103
103
done
Original file line number Diff line number Diff line change @@ -31,6 +31,10 @@ addJvmOptions () {
31
31
jvm_options+=(" $1 " )
32
32
}
33
33
34
+ addDotcOptions () {
35
+ java_options+=(" $1 " )
36
+ }
37
+
34
38
source " $PROG_HOME /bin/common"
35
39
36
40
declare -a residual_args
@@ -40,6 +44,12 @@ with_compiler=false
40
44
class_path_count=0
41
45
CLASS_PATH=" "
42
46
47
+ # Little hack to check if all arguments are options
48
+ all_params=" $* "
49
+ truncated_params=" ${*# -} "
50
+ # options_indicator != 0 if at least one parameter is not an option
51
+ options_indicator=$(( ${# all_params} - ${# truncated_params} - $# ))
52
+
43
53
while [[ $# -gt 0 ]]; do
44
54
case " $1 " in
45
55
-repl)
@@ -65,7 +75,8 @@ while [[ $# -gt 0 ]]; do
65
75
shift
66
76
;;
67
77
-J* )
68
- addJvmOptions " -${1: 2} "
78
+ addJvmOptions " ${1: 2} "
79
+ addDotcOptions " ${1} "
69
80
shift ;;
70
81
* )
71
82
residual_args+=(" $1 " )
@@ -74,13 +85,12 @@ while [[ $# -gt 0 ]]; do
74
85
75
86
esac
76
87
done
77
-
78
- if [ $execute_repl == true ] || ([ $execute_run == false ] && [ ${# residual_args[@]} -eq 0 ]); then
88
+ if [ $execute_repl == true ] || ([ $execute_run == false ] && [ $options_indicator == 0 ]); then
79
89
if [ " $CLASS_PATH " ]; then
80
90
cp_arg=" -classpath \" $CLASS_PATH \" "
81
91
fi
82
92
echo " Starting dotty REPL..."
83
- eval " \" $PROG_HOME /bin/dotc\" $cp_arg -repl ${residual_args[@]} "
93
+ eval " \" $PROG_HOME /bin/dotc\" $cp_arg ${java_options[@]} -repl ${residual_args[@]} "
84
94
elif [ $execute_repl == true ] || [ ${# residual_args[@]} -ne 0 ]; then
85
95
cp_arg=" $DOTTY_LIB$PSEP$SCALA_LIB "
86
96
if [ -z " $CLASS_PATH " ]; then
You can’t perform that action at this time.
0 commit comments