Skip to content

Commit 3b65ef1

Browse files
committed
Merge remote-tracking branch 'szeiger/fix/scala-script-on-mingw'
2 parents b77b85e + 2393d74 commit 3b65ef1

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

src/compiler/scala/tools/ant/templates/tool-unix.tmpl

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,17 @@ if uname | grep -q ^CYGWIN; then
5858
cygwin="$(uname)"
5959
fi
6060

61+
unset mingw
62+
if uname | grep -q ^MINGW; then
63+
mingw="$(uname)"
64+
fi
65+
6166
# Finding the root folder for this Scala distribution
6267
SCALA_HOME="$(findScalaHome)"
6368
SEP=":"
6469

6570
# Possible additional command line options
66-
CYGWIN_OPT=""
71+
WINDOWS_OPT=""
6772
EMACS_OPT=""
6873
[[ -n "$EMACS" ]] && EMACS_OPT="-Denv.emacs=$EMACS"
6974

@@ -94,10 +99,16 @@ if [[ -n "$cygwin" ]]; then
9499
fi
95100
SCALA_HOME="$(cygpath --$format "$SCALA_HOME")"
96101
TOOL_CLASSPATH="$(cygpath --path --$format "$TOOL_CLASSPATH")"
102+
elif [[ -n "$mingw" ]]; then
103+
SCALA_HOME="$(cmd //c echo "$SCALA_HOME")"
104+
TOOL_CLASSPATH="$(cmd //c echo "$TOOL_CLASSPATH")"
105+
fi
106+
107+
if [[ -n "$cygwin$mingw" ]]; then
97108
case "$TERM" in
98109
rxvt* | xterm*)
99110
stty -icanon min 1 -echo
100-
CYGWIN_OPT="-Djline.terminal=scala.tools.jline.UnixTerminal"
111+
WINDOWS_OPT="-Djline.terminal=scala.tools.jline.UnixTerminal"
101112
;;
102113
esac
103114
fi
@@ -110,9 +121,10 @@ fi
110121
declare -a java_args
111122
declare -a scala_args
112123

113-
# default to the boot classpath for speed, except on cygwin/mingw.
124+
# default to the boot classpath for speed, except on cygwin/mingw because
125+
# JLine on Windows requires a custom DLL to be loaded.
114126
unset usebootcp
115-
if [[ -z $cygwin ]]; then
127+
if [[ -z "$cygwin$mingw" ]]; then
116128
usebootcp="true"
117129
fi
118130

@@ -181,7 +193,7 @@ execCommand \
181193
-Dscala.home="$SCALA_HOME" \
182194
-Dscala.usejavacp=true \
183195
$EMACS_OPT \
184-
$CYGWIN_OPT \
196+
$WINDOWS_OPT \
185197
@properties@ @class@ @toolflags@ "$@@"
186198

187199
# record the exit status lest it be overwritten:

0 commit comments

Comments
 (0)