From: Ben Soares Date: Thu, 23 Jan 2020 17:05:23 +0000 (+0000) Subject: JAL-3130 Improved locations of AdoptOpenJDK JRE downloads \(locally and on build... X-Git-Tag: Develop-2_11_2_0-d20201215~80^2~25 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=bc4e160e76b21b2554a78b5695363ca00d524480;p=jalview.git JAL-3130 Improved locations of AdoptOpenJDK JRE downloads \(locally and on build server\) and helper script download_jres.sh to update them using AdoptOpenJDK API. --- diff --git a/build.gradle b/build.gradle index 916d1d0..a6fcf8b 100644 --- a/build.gradle +++ b/build.gradle @@ -292,10 +292,16 @@ ext { // for install4j JAVA_MIN_VERSION = JAVA_VERSION JAVA_MAX_VERSION = JAVA_VERSION - macosJavaVMDir = string("${System.env.HOME}/buildtools/jre/openjdk-java_vm/getdown/macos-jre${JAVA_VERSION}/jre") - macosJavaVMTgz = string("${System.env.HOME}/buildtools/jre/openjdk-java_vm/install4j/tgz/macos-jre${JAVA_VERSION}.tar.gz") - windowsJavaVMDir = string("${System.env.HOME}/buildtools/jre/openjdk-java_vm/getdown/windows-jre${JAVA_VERSION}/jre") - windowsJavaVMTgz = string("${System.env.HOME}/buildtools/jre/openjdk-java_vm/install4j/tgz/windows-jre${JAVA_VERSION}.tar.gz") + def jreInstallsDir = string(jre_installs_dir) + if (jreInstallsDir.startsWith("~/")) { + jreInstallsDir = System.getProperty("user.home") + jreInstallsDir.substring(1) + } + macosJavaVMDir = string("${jreInstallsDir}/jre-${JAVA_INTEGER_VERSION}-mac-x64/jre") + macosJavaVMTgz = string("${jreInstallsDir}/tgz/jre-${JAVA_INTEGER_VERSION}-mac-x64.tar.gz") + windowsJavaVMDir = string("${jreInstallsDir}/jre-${JAVA_INTEGER_VERSION}-windows-x64/jre") + windowsJavaVMTgz = string("${jreInstallsDir}/tgz/jre-${JAVA_INTEGER_VERSION}-windows-x64.tar.gz") + linuxJavaVMDir = string("${jreInstallsDir}/jre-${JAVA_INTEGER_VERSION}-linux-x64/jre") + linuxJavaVMTgz = string("${jreInstallsDir}/tgz/jre-${JAVA_INTEGER_VERSION}-linux-x64.tar.gz") install4jDir = string("${jalviewDir}/${install4j_utils_dir}") install4jConfFileName = string("jalview-install4j-conf.install4j") install4jConfFile = file("${install4jDir}/${install4jConfFileName}") @@ -715,7 +721,8 @@ task convertBuildingMD(type: Exec) { } def hostname = "hostname".execute().text.trim() - if ((pandoc == null || ! file(pandoc).exists()) && hostname.equals("jv-bamboo")) { + def buildtoolsPandoc = System.getProperty("user.home")+"/buildtools/pandoc/bin/pandoc" + if ((pandoc == null || ! file(pandoc).exists()) && file(buildtoolsPandoc).exists()) { pandoc = System.getProperty("user.home")+"/buildtools/pandoc/bin/pandoc" } @@ -1289,6 +1296,7 @@ task installers(type: com.install4j.gradle.Install4jTask) { } def install4jTemplateVersion = "${JALVIEW_VERSION}_F${filesMd5}_C${gitHash}" + println("WINDOWS_JAVA_VM_TGZ=${windowsJavaVMTgz}") variables = [ 'OSX_KEYSTORE': OSX_KEYSTORE, 'JSIGN_SH': JSIGN_SH, @@ -1301,9 +1309,11 @@ task installers(type: com.install4j.gradle.Install4jTask) { 'JAVA_INTEGER_VERSION': JAVA_INTEGER_VERSION, 'VERSION': JALVIEW_VERSION, 'MACOS_JAVA_VM_DIR': macosJavaVMDir, - 'MACOS_JAVA_VM_TGZ': macosJavaVMTgz, 'WINDOWS_JAVA_VM_DIR': windowsJavaVMDir, + 'LINUX_JAVA_VM_DIR': linuxJavaVMDir, + 'MACOS_JAVA_VM_TGZ': macosJavaVMTgz, 'WINDOWS_JAVA_VM_TGZ': windowsJavaVMTgz, + 'LINUX_JAVA_VM_TGZ': linuxJavaVMTgz, 'COPYRIGHT_MESSAGE': install4j_copyright_message, 'MACOS_BUNDLE_ID': install4j_macOS_bundle_id, 'GETDOWN_RESOURCE_DIR': getdown_resource_dir, diff --git a/gradle.properties b/gradle.properties index 2bac743..c5deb83 100644 --- a/gradle.properties +++ b/gradle.properties @@ -100,13 +100,7 @@ getdown_alt_java11_min_version = 11000000 getdown_alt_java11_max_version = #getdown_alt_java11_txt_multi_java_location = [windows-amd64] /getdown/jre/windows-jre11.jar,[linux-amd64] /getdown/jre/linux-jre11.tgz,[mac os x] /getdown/jre/macos-jre11.tgz #getdown_alt_java8_txt_multi_java_location = [windows-amd64] /getdown/jre/windows-jre1.8.tgz,[linux-amd64] /getdown/jre/linux-jre1.8.tgz,[mac os x] /getdown/jre/macos-jre1.8.tgz -JRE_installs = /Users/bsoares/Java/installs -Windows_JRE8 = OpenJDK8U-jdk_x64_windows_hotspot_8u202b08/jdk8u202-b08 -Mac_JRE8 = OpenJDK8U-jre_x64_mac_hotspot_8u202b08/jdk8u202-b08-jre/Contents/Home -Linux_JRE8 = OpenJDK8U-jre_x64_linux_hotspot_8u202b08/jdk8u202-b08-jre -Windows_JRE11 = OpenJDK11-jre_x64_windows_hotspot_11_28/jdk-11+28-jre -Mac_JRE11 = OpenJDK11-jre_x64_mac_hotspot_11_28/jdk-11+28-jre/Contents/Home -Linux_JRE11 = OpenJDK11-jre_x64_linux_hotspot_11_28/jdk-11+28-jre +jre_installs_dir = ~/buildtools/jre j8libDir = j8lib j11libDir = j11lib diff --git a/utils/install4j/download_jres.sh b/utils/install4j/download_jres.sh new file mode 100755 index 0000000..0a1cf9f --- /dev/null +++ b/utils/install4j/download_jres.sh @@ -0,0 +1,76 @@ +#!/usr/bin/env bash + +# see https://api.adoptopenjdk.net/swagger-ui/#/Binary/get_v3_binary_latest__feature_version___release_type___os___arch___image_type___jvm_impl___heap_size___vendor_ + + +### bs 2020-01-22 +### This is a script to download and update the JREs used in the windows, mac (and maybe linux) installations, and update channel +### It creates a structure with +### ./jre-VERSION-OS-ARCH/jre/... +### as used by getdown +### and +### ./tgz/jre-VERSION-OS-ARCH.tgz +### which is an archive of the _contents_ of ./jre-VERSION-OS-ARCH/jre/ and used by install4j for the installer + +BASE=https://api.adoptopenjdk.net/v3/binary/latest +RELEASE_TYPE=ga +JVM_IMPL=hotspot +HEAP_SIZE=normal +VENDOR=adoptopenjdk +IMAGE_TYPE=jre + +RM=/bin/rm + +# unzip-strip from https://superuser.com/questions/518347/equivalent-to-tars-strip-components-1-in-unzip +unzip-strip() ( + local zip=$1 + local dest=${2:-.} + local temp=$(mktemp -d) && unzip -qq -d "$temp" "$zip" && mkdir -p "$dest" && + shopt -s dotglob && local f=("$temp"/*) && + if (( ${#f[@]} == 1 )) && [[ -d "${f[0]}" ]] ; then + mv "$temp"/*/* "$dest" + else + mv "$temp"/* "$dest" + fi && rmdir "$temp"/* "$temp" +) + +for FEATURE_VERSION in 8 11; do + for OS in linux mac windows; do + for ARCH in x64 x32 arm; do + #for ARCH in aarch64 arm x32 x64; do + NAME="${IMAGE_TYPE}-${FEATURE_VERSION}-${OS}-${ARCH}" + TARFILE="${NAME}.tgz" + echo "* Downloading ${TARFILE}" + URL="${BASE}/${FEATURE_VERSION}/${RELEASE_TYPE}/${OS}/${ARCH}/${IMAGE_TYPE}/${JVM_IMPL}/${HEAP_SIZE}/${VENDOR}" + wget -q -O "${TARFILE}" "${URL}" + if [ "$?" != 0 ]; then + echo "- No ${IMAGE_TYPE}-${FEATURE_VERSION} download for ${OS}-${ARCH} '${URL}'" + $RM -f "${TARFILE}" + continue; + fi + echo "Unpacking ${TARFILE}" + JREDIR="${NAME}/jre" + [ x$NAME != x -a -e "${JREDIR}" ] && $RM -rf "${JREDIR}" + mkdir -p "${JREDIR}" + if [ x$OS = xwindows ]; then + echo "using unzip" + unzip-strip "${TARFILE}" "${JREDIR}" + RET=$? + else + echo "using tar" + tar --strip-components=1 -C "${JREDIR}" -zxf "${TARFILE}" + RET=$? + fi + if [ "$RET" != 0 ]; then + echo "Error unpacking ${TARFILE}" + exit 1 + fi + $RM "${TARFILE}" + echo "Creating .tar.gz for install4j bundling and updates" + TGZDIR=tgz + mkdir -p "${TGZDIR}" + tar -C "${JREDIR}" -zcf "${TGZDIR}/${NAME}.tar.gz" . + done + done +done + diff --git a/utils/install4j/install4j8_template.install4j b/utils/install4j/install4j8_template.install4j index 3d39720..6508ed7 100644 --- a/utils/install4j/install4j8_template.install4j +++ b/utils/install4j/install4j8_template.install4j @@ -1,7 +1,7 @@ - + - + @@ -18,10 +18,12 @@ - - - - + + + + + + @@ -29,6 +31,7 @@ + @@ -1166,6 +1169,7 @@ return console.askYesNo(message, true); + @@ -1181,6 +1185,7 @@ return console.askYesNo(message, true); +