@@ -139,8 +139,17 @@ if [ "$1" == "--force" ]; then
139
139
shift
140
140
fi
141
141
142
+ if [ " $1 " == " --zinc" ]; then
143
+ echo " Using zinc for incremental compilation. Be sure you are aware of the implications of "
144
+ echo " running this server process on your machine"
145
+ USE_ZINC=1
146
+ shift
147
+ fi
148
+
142
149
# Install the proper version of Scala, Zinc and Maven for the build
143
- install_zinc
150
+ if [ -n " ${USE_ZINC} " ]; then
151
+ install_zinc
152
+ fi
144
153
install_scala
145
154
install_mvn
146
155
@@ -149,12 +158,15 @@ cd "${_CALLING_DIR}"
149
158
150
159
# Now that zinc is ensured to be installed, check its status and, if its
151
160
# not running or just installed, start it
152
- if [ -n " ${ZINC_INSTALL_FLAG} " -o -z " ` " ${ZINC_BIN} " -status -port ${ZINC_PORT} ` " ]; then
153
- export ZINC_OPTS=${ZINC_OPTS:- " $_COMPILE_JVM_OPTS " }
154
- " ${ZINC_BIN} " -shutdown -port ${ZINC_PORT}
155
- " ${ZINC_BIN} " -start -port ${ZINC_PORT} \
156
- -scala-compiler " ${SCALA_COMPILER} " \
157
- -scala-library " ${SCALA_LIBRARY} " & > /dev/null
161
+ if [ -n " ${USE_ZINC} " ]; then
162
+ if [ -n " ${ZINC_INSTALL_FLAG} " -o -z " ` " ${ZINC_BIN} " -status -port ${ZINC_PORT} ` " ]; then
163
+ export ZINC_OPTS=${ZINC_OPTS:- " $_COMPILE_JVM_OPTS " }
164
+ " ${ZINC_BIN} " -shutdown -port ${ZINC_PORT}
165
+ " ${ZINC_BIN} " -start -port ${ZINC_PORT} -server 127.0.0.1 \
166
+ -idle-timeout 30m \
167
+ -scala-compiler " ${SCALA_COMPILER} " \
168
+ -scala-library " ${SCALA_LIBRARY} " & > /dev/null
169
+ fi
158
170
fi
159
171
160
172
# Set any `mvn` options if not already present
@@ -164,3 +176,8 @@ echo "Using \`mvn\` from path: $MVN_BIN" 1>&2
164
176
165
177
# Last, call the `mvn` command as usual
166
178
" ${MVN_BIN} " -DzincPort=${ZINC_PORT} " $@ "
179
+
180
+ if [ -n " ${USE_ZINC} " ]; then
181
+ # Try to shut down zinc explicitly
182
+ " ${ZINC_BIN} " -shutdown -port ${ZINC_PORT}
183
+ fi
0 commit comments