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
2727 cd " $saveddir "
2828fi
2929
30+ addJvmOptions () {
31+ jvm_options+=(" $1 " )
32+ }
33+
3034source " $PROG_HOME /bin/common"
3135
3236declare -a residual_args
33- run_repl=false
37+ execute_repl=false
38+ execute_run=false
3439with_compiler=false
40+ class_path_count=0
3541CLASS_PATH=" "
3642
3743while [[ $# -gt 0 ]]; do
3844 case " $1 " in
3945 -repl)
40- run_repl=true
46+ execute_repl=true
47+ shift
48+ ;;
49+ -run)
50+ execute_run=true
4151 shift
4252 ;;
4353 -classpath)
4454 CLASS_PATH=" $2 "
55+ class_path_count+=1
4556 shift
4657 shift
4758 ;;
@@ -53,6 +64,9 @@ while [[ $# -gt 0 ]]; do
5364 DEBUG=" $DEBUG_STR "
5465 shift
5566 ;;
67+ -J* )
68+ addJvmOptions " -${1: 2} "
69+ shift ;;
5670 * )
5771 residual_args+=(" $1 " )
5872 shift
@@ -61,21 +75,26 @@ while [[ $# -gt 0 ]]; do
6175 esac
6276done
6377
64- if [ $run_repl == true ] || [ ${# residual_args[@]} -eq 0 ]; then
78+ if [ $execute_repl == true ] || ( [ $execute_run == false ] && [ $ {# residual_args[@]} -eq 0 ]) ; then
6579 if [ " $CLASS_PATH " ]; then
6680 cp_arg=" -classpath \" $CLASS_PATH \" "
6781 fi
6882 echo " Starting dotty REPL..."
6983 eval " \" $PROG_HOME /bin/dotc\" $cp_arg -repl ${residual_args[@]} "
70- else
84+ elif [ $execute_repl == true ] || [ ${ # residual_args[@]} -ne 0 ] ; then
7185 cp_arg=" $DOTTY_LIB$PSEP$SCALA_LIB "
7286 if [ -z " $CLASS_PATH " ]; then
7387 cp_arg+=" $PSEP ."
7488 else
7589 cp_arg+=" $PSEP$CLASS_PATH "
7690 fi
91+ if [ $class_path_count > 1 ]; then
92+ echo " warning: multiple classpaths are found, dotr only use the last one."
93+ fi
7794 if [ $with_compiler == true ]; then
7895 cp_arg+=" $PSEP$DOTTY_COMP$PSEP$DOTTY_INTF$PSEP$SCALA_ASM "
7996 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."
81100fi
You can’t perform that action at this time.
0 commit comments