From e00a47aaf9212bb8a26b881dbe850a076f8d1ce1 Mon Sep 17 00:00:00 2001 From: Toni Helenius Date: Sat, 20 Apr 2024 13:38:37 +0300 Subject: [PATCH 1/3] Always get the latest JDK of the specified major version --- jdks/download-jdks.sh | 55 ++++++++++++------------------------------- 1 file changed, 15 insertions(+), 40 deletions(-) diff --git a/jdks/download-jdks.sh b/jdks/download-jdks.sh index a48eb5f5..307fd9f1 100755 --- a/jdks/download-jdks.sh +++ b/jdks/download-jdks.sh @@ -11,17 +11,17 @@ set -e # Quit on Error jdk_major_version="21" -jdk_version="0.2" -jdk_build_version="13" +jvm_impl="hotspot" +jdk_vendor="eclipse" function download_jdk { - echo ">>> Downloading the JDK for $1" + echo ">>> Downloading the JDK for $1_$2$3" - if [ -f downloads/jdk-$1$2 ]; + if [ -f downloads/jdk-$1_$2$3 ]; then echo "<<< Already existing, SKIPPING." else - curl -# -o downloads/jdk-$1$2 -L https://github.com/adoptium/temurin$jdk_major_version-binaries/releases/download/jdk-$jdk_major_version.$jdk_version+$jdk_build_version/OpenJDK${jdk_major_version}U-jdk_$1_hotspot_$jdk_major_version.${jdk_version}_$jdk_build_version$2 + curl -# -o downloads/jdk-$1_$2$3 -L https://api.adoptium.net/v3/binary/latest/$jdk_major_version/ga/$2/$1/jdk/$jvm_impl/normal/$jdk_vendor?project=jdk echo "<<< OK!" fi } @@ -37,26 +37,17 @@ function unpack_mac_jdk { return 0 fi - download_jdk x64_mac .tar.gz + download_jdk x64 mac .tar.gz tar xf downloads/jdk-x64_mac.tar.gz - if [ "$jdk_major_version" == "8" ]; - then - cd jdk$jdk_version-$jdk_build_version/Contents/ - else - cd jdk-$jdk_major_version.$jdk_version+$jdk_build_version/Contents/ - fi + cd jdk-$jdk_major_version*/Contents/ + # FROM HERE: build-osx-zip.sh by normen (with changes) mv Home jdk # rename folder rm -rf jdk/man jdk/legal # ANT got stuck at the symlinks (https://bz.apache.org/bugzilla/show_bug.cgi?id=64053) zip -9 -r -y -q ../../compiled/jdk-macosx.zip jdk cd ../../ - if [ "$jdk_major_version" == "8" ]; - then - rm -r jdk$jdk_version-$jdk_build_version - else - rm -rf jdk-$jdk_major_version.$jdk_version+$jdk_build_version - fi + rm -rf jdk-$jdk_major_version* if [ "$TRAVIS" == "true" ]; then rm -rf downloads/jdk-x64_mac.tar.gz @@ -90,22 +81,14 @@ function unpack_windows { return 0 fi - download_jdk $1_windows .zip + download_jdk $1 windows .zip mkdir -p windows-$1 unzip -qq downloads/jdk-$1_windows.zip -d windows-$1 cd windows-$1/ - if [ "$jdk_major_version" == "8" ]; - then - mv jdk$jdk_version-$jdk_build_version/* . - rm -r jdk$jdk_version-$jdk_build_version - # TODO: Why? - rm src.zip - else - mv jdk-$jdk_major_version.$jdk_version+$jdk_build_version/* . - rm -rf jdk-$jdk_major_version.$jdk_version+$jdk_build_version - fi + mv jdk-$jdk_major_version*/* . + rm -rf jdk-$jdk_major_version* # This seems to be replaced by lib/tools.jar in openJDK #unzip -qq tools.zip -d . @@ -139,21 +122,13 @@ function unpack_linux { return 0 fi - download_jdk $1_linux .tar.gz + download_jdk $1 linux .tar.gz mkdir -p linux-$1 cd linux-$1 tar -xf "../downloads/jdk-$1_linux.tar.gz" - if [ "$jdk_major_version" == "8" ]; - then - mv jdk$jdk_version-$jdk_build_version/* . - rm -r jdk$jdk_version-$jdk_build_version - # TODO: Why? - rm src.zip - else - mv jdk-$jdk_major_version.$jdk_version+$jdk_build_version/* . - rm -rf jdk-$jdk_major_version.$jdk_version+$jdk_build_version - fi + mv jdk-$jdk_major_version*/* . + rm -rf jdk-$jdk_major_version* cd ../ From beebc0e01ee5a247b23425cf8d87230365fda1fe Mon Sep 17 00:00:00 2001 From: Toni Helenius Date: Sat, 20 Apr 2024 13:43:26 +0300 Subject: [PATCH 2/3] Just use the major version on the generated path --- jdks/download-jdks.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jdks/download-jdks.sh b/jdks/download-jdks.sh index 307fd9f1..8fc81d64 100755 --- a/jdks/download-jdks.sh +++ b/jdks/download-jdks.sh @@ -202,10 +202,10 @@ function build_other_jdk { echo "< OK!" } -mkdir -p local/$jdk_major_version-$jdk_version-$jdk_build_version/downloads -mkdir -p local/$jdk_major_version-$jdk_version-$jdk_build_version/compiled +mkdir -p local/$jdk_major_version/downloads +mkdir -p local/$jdk_major_version/compiled -cd local/$jdk_major_version-$jdk_version-$jdk_build_version +cd local/$jdk_major_version if [ "x$TRAVIS" != "x" ]; then if [ "x$BUILD_X64" != "x" ]; then From 83ef4fe781e4793f81acebeb4e377c55e06ec836 Mon Sep 17 00:00:00 2001 From: Toni Helenius Date: Sat, 20 Apr 2024 14:00:03 +0300 Subject: [PATCH 3/3] Quote parameters --- jdks/download-jdks.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jdks/download-jdks.sh b/jdks/download-jdks.sh index 8fc81d64..ca1cc942 100755 --- a/jdks/download-jdks.sh +++ b/jdks/download-jdks.sh @@ -81,7 +81,7 @@ function unpack_windows { return 0 fi - download_jdk $1 windows .zip + download_jdk "$1" windows .zip mkdir -p windows-$1 unzip -qq downloads/jdk-$1_windows.zip -d windows-$1 @@ -122,7 +122,7 @@ function unpack_linux { return 0 fi - download_jdk $1 linux .tar.gz + download_jdk "$1" linux .tar.gz mkdir -p linux-$1 cd linux-$1