Skip to content

Commit

Permalink
Beginning final portions of localized scala home
Browse files Browse the repository at this point in the history
  • Loading branch information
Brennon York committed Dec 11, 2014
1 parent 69c4e44 commit f914dea
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ third_party/libmesos.so
third_party/libmesos.dylib
build/apache-maven*
build/zinc*
build/scala*
conf/java-opts
conf/*.sh
conf/*.cmd
Expand Down
28 changes: 19 additions & 9 deletions build/mvn
Original file line number Diff line number Diff line change
Expand Up @@ -55,25 +55,31 @@ check_and_install_app() {
# some black magic to set the generated app variable (i.e. MVN_BIN) into the
# environment
eval "${APP_BIN}=`which $1 2>/dev/null`"

# Check and source the package build file if present, else error out
if [ -f "$resource" ]; then
source "${_DIR}/packages/$1.sh"
else
echo "ERROR: Cannot find the $1.sh build file from within ${_DIR}/packages."
echo " Ensure the file exists and is accesible."
exit 1
fi

if [ -z "`which $1 2>/dev/null`" ]; then
# attempt to force install if flagged
if [ -n "${FORCE_INSTALL}" ]; then
local resource="${_DIR}/packages/$1.sh"
if [ -f "$resource" ]; then
source "${_DIR}/packages/$1.sh"

prep_install_for_${_OSTYPE}
install_$1_for_${_OSTYPE}
else
echo "ERROR: Cannot find the $1.sh build file from within ${_DIR}/packages."
echo " Ensure the file exists and is accesible."
exit 1
fi

# else exit with error message
else
echo "ERROR: $1 isn't installed; please install or automatically force install (-f)."
exit 2
fi
fi
postprocess_$1_for_${_OSTYPE}
}

# Prints the help and usage for this script
Expand Down Expand Up @@ -143,16 +149,20 @@ ZINC_PORT=${ZINC_PORT:-"3030"}
# Check and install all applications necessary to fully build Spark
check_and_install_app "mvn"
check_and_install_app "zinc"
check_and_install_app "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
if [ -z "`${ZINC_BIN} -status`" ]; then
${ZINC_BIN} -start -port ${ZINC_PORT}
if [ -n "`${ZINC_BIN} -status`" ]; then
${ZINC_BIN} -shutdown
fi

${ZINC_BIN} -start -port ${ZINC_PORT} -scala-home "${SCALA_HOME}"
${ZINC_BIN} -status

# Determine the parameters pushed in from the command line and, if any are
# present, use those within the maven
if [ $# -gt 0 ]; then
Expand Down
4 changes: 4 additions & 0 deletions build/packages/mvn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ install_mvn_for_linux() {
export MVN_BIN="${mvn_bin}"
}

export_mvn_for_linux() {

}

install_mvn_for_osx() {
brew install maven
export MVN_BIN=`which mvn`
Expand Down
4 changes: 2 additions & 2 deletions build/packages/scala.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ install_scala_for_linux() {
cd "${dir}/.." && tar -xzf "${scala_loc}"
rm -rf "${scala_loc}"
fi
export SCALA_BIN="${scala_bin}"
export SCALA_HOME="$(dirname ${scala_bin})/.."
}

install_scala_for_osx() {
brew install scala
export SCALA_BIN=`which scala`
export SCALA_HOME="$(dirname "`brew --prefix`/Cellar/$(readlink `which scala`)")/../libexec"
}

0 comments on commit f914dea

Please sign in to comment.