File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -95,9 +95,7 @@ while [[ $# -gt 0 ]]; do
95
95
# is a script if extension .scala or .sc or if has scala hash bang
96
96
if [[ -e " $1 " && (" $1 " == * .scala || " $1 " == * .sc || -f " $1 " && ` head -n 1 -- " $1 " | grep ' #!.*scala' ` ) ]]; then
97
97
execute_script=true
98
- [ -n " $SCALA_OPTS " ] && java_options+=($SCALA_OPTS )
99
98
target_script=" $1 "
100
- if [ ! -f $target_script
101
99
else
102
100
residual_args+=(" $1 " )
103
101
fi
@@ -114,14 +112,18 @@ if [ $execute_script == true ]; then
114
112
if [ " $CLASS_PATH " ]; then
115
113
cp_arg=" -classpath \" $CLASS_PATH \" "
116
114
fi
115
+ if [ -n " $SCALA_OPTS " ]; then
116
+ java_options+=($SCALA_OPTS )
117
+ if [ " ${SCALA_OPTS## -save} " != " ${SCALA_OPTS} " ]; then
118
+ save_compiled=true
119
+ fi
120
+ fi
117
121
setScriptName=" -Dscript.path=$target_script "
118
122
target_jar=" ${target_script% .* } .jar"
119
- jar_found=false
120
- [[ $save_compiled == true && -f " $target_jar " ]] && jar_found=true
121
- if [[ $jar_found == true && " $target_jar " -nt " $target_script " ]]; then
123
+ if [[ $save_compiled == true && " $target_jar " -nt " $target_script " ]]; then
122
124
java $setScriptName -jar " $target_jar " " ${script_args[@]} "
123
125
else
124
- [[ $save_compiled == true && -f $target_jar ]] && rm -f $target_jar
126
+ [[ $save_compiled == true ]] && rm -f $target_jar
125
127
residual_args+=($setScriptName )
126
128
eval " \" $PROG_HOME /bin/scalac\" $cp_arg ${java_options[@]} ${residual_args[@]} -script $target_script ${script_args[@]} "
127
129
fi
You can’t perform that action at this time.
0 commit comments