Skip to content

Commit

Permalink
updated to properly only restart zinc if it was freshly installed
Browse files Browse the repository at this point in the history
  • Loading branch information
Brennon York committed Dec 15, 2014
1 parent a680d12 commit 3e8b9b3
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions build/mvn
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,13 @@ install_mvn() {

# Install zinc under the build/ folder
install_zinc() {
ZINC_INSTALL_FLAG=1
local zinc_path="zinc-0.3.5.3/bin/zinc"
[ ! -f "${zinc_path}" ] && ZINC_INSTALL_FLAG=1
install_app \
"http://downloads.typesafe.com/zinc/0.3.5.3" \
"zinc-0.3.5.3.tgz" \
"zinc-0.3.5.3/bin/zinc"
ZINC_BIN="${_DIR}/zinc-0.3.5.3/bin/zinc"
"${zinc_path}"
ZINC_BIN="${_DIR}/${ZINC_PATH}"
}

# Determine the Scala version from the root pom.xml file, set the Scala URL,
Expand All @@ -74,12 +75,9 @@ print(minidom.parse('${_DIR}/../pom.xml').getElementsByTagName('scala.version')[
}

# Determines if a given application is already installed. If not, will attempt
# to install if the -f (forced install) flag was set from the command line
# options.
# Leverages the build/packages directory for package install files which
# cater installation of a given application across various operating systems.
# - Current supported operating systems are Linux, Solaris, BSD, and OSX
# to install
## Arg1 - application name
## Arg2 - Alternate path to local install under build/ dir
check_and_install_app() {
# create the local environment variable in uppercase
local app_bin="`echo $1 | awk '{print toupper(\$0)}'`_BIN"
Expand All @@ -98,21 +96,21 @@ ZINC_PORT=${ZINC_PORT:-"3030"}

# Check and install all applications necessary to build Spark
check_and_install_app "mvn"
check_and_install_app "zinc"

# Check and download the proper version of Scala for the build
# Install the proper version of Scala and Zinc for the build
install_zinc
install_scala

# Reset the current working directory
cd "${_DIR}/.."

# Now that zinc is ensured to be installed, check its status and, if its
# not running, start it
# not running or just installed, start it
if [ -n "${ZINC_INSTALL_FLAG}" -o -z "`${ZINC_BIN} -status`" ]; then
${ZINC_BIN} -shutdown
${ZINC_BIN} -start -port ${ZINC_PORT} \
-scala-compiler "${SCALA_COMPILER}" \
-scala-library "${SCALA_LIBRARY}" &>/dev/null
-scala-library "${SCALA_LIBRARY}"
fi

# Last, call the `mvn` command as usual
Expand Down

0 comments on commit 3e8b9b3

Please sign in to comment.