From: Bill Erickson Date: Wed, 8 May 2019 17:43:07 +0000 (-0400) Subject: LP1817932 Hatch Deps fetcher for Mac X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=aa88dc362b64be5c15ef9e9ab1defd55708c870c;p=working%2FHatch.git LP1817932 Hatch Deps fetcher for Mac Adds a 'mac' command line option to the Java dependency fetcher script for fetching Mac dependencies. Also teaches hatch.sh to reference the correct directories when running on a mac (i.e. uname=Darwin). Signed-off-by: Bill Erickson --- diff --git a/fetch-deps.sh b/fetch-deps.sh index b06ea61b9c..8c235998b1 100755 --- a/fetch-deps.sh +++ b/fetch-deps.sh @@ -23,6 +23,11 @@ LINUX_JFX_ZIP="openjfx-${JAVA_VERSION}_linux-x64_bin-sdk.zip" LINUX_JDK_URL="https://download.java.net/java/GA/jdk11/9/GPL/$LINUX_JDK_TAR" LINUX_JFX_URL="https://download2.gluonhq.com/openjfx/$JAVA_VERSION/$LINUX_JFX_ZIP" +MAC_JDK_TAR="openjdk-${JAVA_VERSION}_osx-x64_bin.tar.gz" +MAC_JFX_ZIP="openjfx-${JAVA_VERSION}_osx-x64_bin-sdk.zip" +MAC_JDK_URL="https://download.java.net/java/GA/jdk11/9/GPL/$MAC_JDK_TAR" +MAC_JFX_URL="https://download2.gluonhq.com/openjfx/$JAVA_VERSION/$MAC_JFX_ZIP" + JSON_BUILD="20160810" JSON_JAR="json-$JSON_BUILD.jar" JSON_URL="https://search.maven.org/remotecontent?filepath=org/json/json/$JSON_BUILD/$JSON_JAR" @@ -46,14 +51,14 @@ if [ "$PLATFORM" == "windows" ]; then if [ ! -d "$JDK_DIR" ]; then if [ ! -f "$WIN_JDK_ZIP" ]; then - wget "$WIN_JDK_URL"; + curl -o "$WIN_JDK_ZIP" "$WIN_JDK_URL"; fi; $UNZIP "$WIN_JDK_ZIP" fi; if [ ! -d "$JFX_DIR" ]; then if [ ! -f "$WIN_JFX_ZIP" ]; then - wget "$WIN_JFX_URL"; + curl -o "$WIN_JFX_ZIP" "$WIN_JFX_URL"; fi; $UNZIP "$WIN_JFX_ZIP" fi; @@ -65,28 +70,49 @@ elif [ "$PLATFORM" == "linux" ]; then if [ ! -d "$JDK_DIR" ]; then if [ ! -f "$LINUX_JDK_TAR" ]; then - wget "$LINUX_JDK_URL"; + curl -o "$LINUX_JDK_TAR" "$LINUX_JDK_URL"; fi; tar -zxf "$LINUX_JDK_TAR" fi; if [ ! -d "$JFX_DIR" ]; then if [ ! -f "$LINUX_JFX_ZIP" ]; then - wget "$LINUX_JFX_URL"; + curl -o "$LINUX_JFX_ZIP" "$LINUX_JFX_URL"; fi; $UNZIP "$LINUX_JFX_ZIP" fi; + +elif [ "$PLATFORM" == "mac" ]; then + + JDK_DIR="$JDK_DIR.jdk" # Mac builds append .jdk + JDK_DIR_SHORT="$JDK_DIR_SHORT-mac" + JFX_DIR_SHORT="$JFX_DIR_SHORT-mac" + + if [ ! -d "$JDK_DIR" ]; then + if [ ! -f "$MAC_JDK_TAR" ]; then + curl -o "$MAC_JDK_TAR" "$MAC_JDK_URL"; + fi; + tar -zxf "$MAC_JDK_TAR" + fi; + + if [ ! -d "$JFX_DIR" ]; then + if [ ! -f "$MAC_JFX_ZIP" ]; then + curl -o "$MAC_JFX_ZIP" "$MAC_JFX_URL"; + fi; + $UNZIP "$MAC_JFX_ZIP" + fi; + else echo "Valid platform argument required"; - echo "$0 windows | linux"; + echo "$0 windows | linux | mac"; exit 1; fi; mkdir -p lib if [ ! -f lib/$JSON_JAR ]; then echo "Fetching JSON libs..." - wget -O lib/$JSON_JAR $JSON_URL + curl -o lib/$JSON_JAR $JSON_URL fi; rm -rf "$JDK_DIR_SHORT" "$JFX_DIR_SHORT"; diff --git a/hatch.sh b/hatch.sh index fc48ca0af8..5444285ec1 100755 --- a/hatch.sh +++ b/hatch.sh @@ -5,6 +5,13 @@ # Reference local JDK/JFX bundles. JAVA_HOME="./java-jdk-linux" JAVAFX_HOME="./javafx-sdk-linux" + +# Are we running on a mac? +if [ $(uname) == 'Darwin' ]; then + JAVA_HOME="./java-jdk-mac/Contents/Home" + JAVAFX_HOME="./javafx-sdk-mac" +fi; + JAFAFX_MODS="--module-path $JAVAFX_HOME/lib --add-modules=javafx.base,javafx.graphics,javafx.web" JAVA=$JAVA_HOME/bin/java