diff --git a/dist/bin/dotc b/dist/bin/dotc index a91f70fcc06a..a9c8e9bc63c2 100755 --- a/dist/bin/dotc +++ b/dist/bin/dotc @@ -92,11 +92,11 @@ case "$1" in -no-colors) unset colors && shift ;; -with-compiler) jvm_cp_args="$PSEP$DOTTY_COMP" && shift ;; - # break out -D and -J options and add them to JAVA_OPTS as well - # so they reach the JVM in time to do some good. The -D options + # break out -D and -J options and add them to java_args so + # they reach the JVM in time to do some good. The -D options # will be available as system properties. - -D*) addJava "$1" && addScala "$1" && shift ;; - -J*) addJava "${1:2}" && addScala "$1" && shift ;; + -D*) addJava "$1" && shift ;; + -J*) addJava "${1:2}" && shift ;; *) addResidual "$1" && shift ;; esac done diff --git a/dist/bin/dotr b/dist/bin/dotr index 4cb4787901e6..800eae98c10b 100755 --- a/dist/bin/dotr +++ b/dist/bin/dotr @@ -31,6 +31,10 @@ addJvmOptions () { jvm_options+=("$1") } +addDotcOptions () { + java_options+=("$1") +} + source "$PROG_HOME/bin/common" declare -a residual_args @@ -40,6 +44,12 @@ with_compiler=false class_path_count=0 CLASS_PATH="" +# Little hack to check if all arguments are options +all_params="$*" +truncated_params="${*#-}" +# options_indicator != 0 if at least one parameter is not an option +options_indicator=$(( ${#all_params} - ${#truncated_params} - $# )) + while [[ $# -gt 0 ]]; do case "$1" in -repl) @@ -65,7 +75,8 @@ while [[ $# -gt 0 ]]; do shift ;; -J*) - addJvmOptions "-${1:2}" + addJvmOptions "${1:2}" + addDotcOptions "${1}" shift ;; *) residual_args+=("$1") @@ -74,13 +85,12 @@ while [[ $# -gt 0 ]]; do esac done - -if [ $execute_repl == true ] || ([ $execute_run == false ] && [ ${#residual_args[@]} -eq 0 ]); then +if [ $execute_repl == true ] || ([ $execute_run == false ] && [ $options_indicator == 0 ]); then if [ "$CLASS_PATH" ]; then cp_arg="-classpath \"$CLASS_PATH\"" fi echo "Starting dotty REPL..." - eval "\"$PROG_HOME/bin/dotc\" $cp_arg -repl ${residual_args[@]}" + eval "\"$PROG_HOME/bin/dotc\" $cp_arg ${java_options[@]} -repl ${residual_args[@]}" elif [ $execute_repl == true ] || [ ${#residual_args[@]} -ne 0 ]; then cp_arg="$DOTTY_LIB$PSEP$SCALA_LIB" if [ -z "$CLASS_PATH" ]; then