diff --git a/dist/bin/common b/dist/bin/common index db30a383fadb..cb0908c97563 100755 --- a/dist/bin/common +++ b/dist/bin/common @@ -161,11 +161,8 @@ JLINE_TERMINAL=$(find_lib "*jline-terminal-3*") JLINE_TERMINAL_JNA=$(find_lib "*jline-terminal-jna-3*") [[ ${conemu-} ]] || JNA=$(find_lib "*jna-5*") -# debug -DEBUG_STR=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005 - -classpathArgs () { +compilerJavaClasspathArgs () { # echo "dotty-compiler: $DOTTY_COMP" # echo "dotty-interface: $DOTTY_INTF" # echo "dotty-library: $DOTTY_LIB" diff --git a/dist/bin/scala b/dist/bin/scala index 20fe48b50752..83e7720ef43d 100755 --- a/dist/bin/scala +++ b/dist/bin/scala @@ -98,9 +98,6 @@ while [[ $# -gt 0 ]]; do addScala "$1" shift ;; - -d|-debug) - DEBUG="${DEBUG_STR-}" - shift ;; -version) # defer to scalac, then exit shift @@ -116,8 +113,8 @@ while [[ $# -gt 0 ]]; do verbose=true addScala "-verbose" shift ;; - -run|-repl) - PROG_NAME="$ReplMain" + -run) + setExecuteMode 'run' shift ;; *) @@ -157,7 +154,7 @@ done #[ -n "${dump_args}" ] && dumpArgs ; exit 2 if [ -z "${execute_mode-}" ]; then # no script was specified, set run or repl mode - if [[ $options_indicator -eq 0 && "${residual_args[@]-}" == "" ]]; then + if [[ $options_indicator -eq 0 ]]; then setExecuteMode 'repl' else setExecuteMode 'run' @@ -179,7 +176,7 @@ script) else [[ $save_compiled == true ]] && rm -f $target_jar PROG_NAME=$ScriptingMain - classpathArgs # initialize jvm_cp_args with toolchain classpath + compilerJavaClasspathArgs # initialize jvm_cp_args with toolchain classpath scripting_string="-script $target_script ${script_args[@]}" # use eval instead of exec, to insure that onExit is subsequently called @@ -187,7 +184,6 @@ script) # $scripting_string must be last eval "\"$JAVACMD\"" \ ${JAVA_OPTS:-$default_java_opts} \ - "${DEBUG-}" \ "${java_args[@]}" \ "-classpath \"$jvm_cp_args\"" \ -Dscala.usejavacp=true \ @@ -210,20 +206,20 @@ repl) ;; run) - repl_cparg="$DOTTY_LIB$PSEP$SCALA_LIB" + run_cparg="$DOTTY_LIB$PSEP$SCALA_LIB" if [ -z "$CLASS_PATH" ]; then - repl_cparg+="$PSEP." + run_cparg+="$PSEP." else - repl_cparg+="$PSEP$CLASS_PATH" + run_cparg+="$PSEP$CLASS_PATH" fi if [ "$class_path_count" -gt 1 ]; then echo "warning: multiple classpaths are found, scala only use the last one." fi if [ $with_compiler == true ]; then - repl_cparg+="$PSEP$DOTTY_COMP$PSEP$TASTY_CORE$PSEP$DOTTY_INTF$PSEP$SCALA_ASM$PSEP$DOTTY_STAGING$PSEP$DOTTY_TASTY_INSPECTOR" + run_cparg+="$PSEP$DOTTY_COMP$PSEP$TASTY_CORE$PSEP$DOTTY_INTF$PSEP$SCALA_ASM$PSEP$DOTTY_STAGING$PSEP$DOTTY_TASTY_INSPECTOR" fi # exec here would prevent onExit from being called, leaving terminal in unusable state - eval "\"$JAVACMD\"" "${DEBUG-}" "-classpath \"$repl_cparg\"" "${java_args[@]}" "${residual_args[@]}" + eval "\"$JAVACMD\"" "-classpath \"$run_cparg\"" "${java_args[@]}" "${residual_args[@]}" scala_exit_status=$? ;; diff --git a/dist/bin/scalac b/dist/bin/scalac index 9d36cdf11f8b..fa93c41293bd 100755 --- a/dist/bin/scalac +++ b/dist/bin/scalac @@ -36,7 +36,6 @@ while [[ $# -gt 0 ]]; do case "$1" in --) shift; for arg; do addResidual "$arg"; done; set -- ;; -v|-verbose) verbose=true && addScala "-verbose" && shift ;; - -debug) DEBUG="$DEBUG_STR" && shift ;; -q|-quiet) quiet=true && shift ;; # Optimize for short-running applications, see https://github.com/lampepfl/dotty/issues/222 @@ -61,7 +60,7 @@ case "$1" in esac done -classpathArgs +compilerJavaClasspathArgs if [ "$PROG_NAME" == "$ScriptingMain" ]; then setScriptName="-Dscript.path=$target_script" @@ -72,7 +71,6 @@ fi [ -n "$script_trace" ] && set -x eval "\"$JAVACMD\"" \ ${JAVA_OPTS:-$default_java_opts} \ - "${DEBUG-}" \ "${java_args[@]}" \ "-classpath \"$jvm_cp_args\"" \ -Dscala.usejavacp=true \ diff --git a/dist/bin/scaladoc b/dist/bin/scaladoc index d83ce5e09595..e92e21d6e49a 100755 --- a/dist/bin/scaladoc +++ b/dist/bin/scaladoc @@ -106,7 +106,6 @@ while [[ $# -gt 0 ]]; do case "$1" in --) shift; for arg; do addResidual "$arg"; done; set -- ;; -v|-verbose) verbose=true && addScala "-verbose" && shift ;; - -debug) DEBUG="$DEBUG_STR" && shift ;; -q|-quiet) quiet=true && shift ;; -colors) colors=true && shift ;; @@ -126,7 +125,6 @@ classpathArgs eval "\"$JAVACMD\"" \ ${JAVA_OPTS:-$default_java_opts} \ - "${DEBUG-}" \ "${java_args[@]}" \ "${jvm_cp_args-}" \ "dotty.tools.scaladoc.Main" \ diff --git a/project/scripts/bootstrapCmdTests b/project/scripts/bootstrapCmdTests index 31b8368d5215..af1ffef87a33 100755 --- a/project/scripts/bootstrapCmdTests +++ b/project/scripts/bootstrapCmdTests @@ -67,3 +67,13 @@ clear_out "$OUT" # check options specified in files ./bin/scalac @project/scripts/options "$SOURCE" + +# test command line options +./bin/scalac -help > "$tmp" 2>&1 +grep -qe "Usage: scalac " "$tmp" + +./bin/scala -help > "$tmp" 2>&1 +grep -qe "Usage: scala " "$tmp" + +./bin/scala -d hello.jar tests/run/hello.scala +ls hello.jar