pmd/.travis/install-openjdk.sh

31 lines
1.2 KiB
Bash
Raw Normal View History

2019-04-27 16:54:28 +02:00
#
# Original sources:
# Linux: https://github.com/AdoptOpenJDK/openjdk11-upstream-binaries/releases/jdk-11.0.3%2B7/
# https://github.com/AdoptOpenJDK/openjdk11-upstream-binaries/releases/download/jdk-11.0.3%2B7/OpenJDK11U-x64_linux_11.0.3_7.tar.gz
# MacOSX: https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/jdk-11.0.3%2B7/
# https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.3%2B7/OpenJDK11U-jdk_x64_mac_hotspot_11.0.3_7.tar.gz
#
if [[ "$OSTYPE" == "darwin"* ]]; then
OPENJDK_ARCHIVE=OpenJDK11U-jdk_x64_mac_hotspot_11.0.3_7.tar.gz
2019-04-27 17:39:50 +02:00
COMPONENTS_TO_STRIP=3 # e.g. jdk-11.0.3+7/Contents/Home/bin/java
2019-04-27 16:54:28 +02:00
else
OPENJDK_ARCHIVE=OpenJDK11U-x64_linux_11.0.3_7.tar.gz
2019-04-27 17:39:50 +02:00
COMPONENTS_TO_STRIP=1 # e.g. openjdk-11.0.3+7/bin/java
2019-04-27 16:54:28 +02:00
fi
2019-04-27 16:22:21 +02:00
DOWNLOAD_URL=https://pmd-code.org/${OPENJDK_ARCHIVE}
LOCAL_DIR=${HOME}/.cache/openjdk
TARGET_DIR=${HOME}/openjdk11
mkdir -p ${LOCAL_DIR}
mkdir -p ${TARGET_DIR}
wget --quiet --directory-prefix ${LOCAL_DIR} --timestamping --continue ${DOWNLOAD_URL}
2019-04-27 17:20:05 +02:00
tar --extract --file ${LOCAL_DIR}/${OPENJDK_ARCHIVE} -C ${TARGET_DIR} --strip-components=${COMPONENTS_TO_STRIP}
2019-04-27 16:22:21 +02:00
export JAVA_HOME=${TARGET_DIR}
export PATH=${JAVA_HOME}/bin:$PATH
java -version