From d15b4513193140675a516251cffeb6e07716d304 Mon Sep 17 00:00:00 2001 From: david Date: Sat, 11 May 2024 20:16:48 +0200 Subject: [PATCH 1/2] Feature: Updating url and parser to fetch from Adoptium --- warp4j | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/warp4j b/warp4j index f853a10..cbfe4f8 100755 --- a/warp4j +++ b/warp4j @@ -273,20 +273,20 @@ function choose_distro_type() { # actually choose distro type JAVA_DISTRO_TYPE=$(choose_distro_type) -# generates adoptopenjdk api url +# generates adoptium api url function api_url() { local request=$1 # info/binary local platform=$2 # windows/linux/macos - # adoptopenjdk uses "mac" instead of "macos" + # adoptium uses "mac" instead of "macos" if [[ $platform == "macos" ]]; then platform="mac" fi - echo -n "https://api.adoptopenjdk.net/v2/\ -$request/releases/openjdk$JAVA_VERSION_BASE?\ -openjdk_impl=$JVM_IMPL&\ -os=$platform&\ -arch=x64&\ -type=$JAVA_DISTRO_TYPE" + + echo -n "https://api.adoptium.net/v3/assets/feature_releases/\ +$JAVA_VERSION_BASE/ga?architecture=x64&heap_size=normal&image_type=jdk&\ +os=$platform&page=0&page_size=20&project=$JAVA_DISTRO_TYPE&\ +sort_method=DEFAULT&sort_order=DESC&vendor=eclipse" + } # requests info about all releases for given platform and java branch @@ -469,7 +469,7 @@ function find_latest_cached() { # finds latest concrete distro version that matches version specified by user function find_latest_version() { - local info=$1 # info fetched from AdoptOpenJDK + local info=$1 # info fetched from Adoptium local user_version=$2 # version supplied by user is a template local matched_version # latest version that matches the template local versions # all versions @@ -495,12 +495,11 @@ function find_latest_version() { # finds direct link to download concrete runtime version function find_distro_link() { - local info=$1 # info fetched from AdoptOpenJDK + local info=$1 # info fetched from Adoptium local version=$2 # concrete distro version like "11.0.2+9" local link=$(echo "$info" \ - | grep -B13 "\"heap_size\": \"normal\"" \ - | grep -B11 "\"semver\": \"$version\"" \ - | grep "binary_link" \ + | grep -B14 "\"release_name\": \"jdk-$version\"" \ + | grep "\"link\":" \ | sort --reverse \ | head -n 1 \ | awk '{print $2}' \ -- 2.45.2 From 33521690288f15528b25f8ac66c381812631d1f8 Mon Sep 17 00:00:00 2001 From: david Date: Sat, 11 May 2024 21:07:27 +0200 Subject: [PATCH 2/2] Feature: Fixing class-path --- warp4j | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/warp4j b/warp4j index cbfe4f8..db73d31 100755 --- a/warp4j +++ b/warp4j @@ -652,7 +652,7 @@ if [[ $JAVA_DISTRO_TYPE == $DISTRO_TYPE_JDK ]]; then echo "Extracting jar file to get classpath" unzip -q "${JAR}" -d "${EXTRACTED_JAR_PATH}" echo "Fetching modules" - MODULES=$($JDEPS --ignore-missing-deps --print-module-deps --recursive --multi-release $JAVA_VERSION_BASE -quiet --class-path=${EXTRACTED_JAR_PATH}/BOOT-INF/lib/* --module-path=${EXTRACTED_JAR_PATH}/BOOT-INF/lib/BOOT-INF/lib/* $JAR | grep -v Warning) + MODULES=$($JDEPS --ignore-missing-deps --print-module-deps --recursive --multi-release $JAVA_VERSION_BASE -quiet --class-path=${EXTRACTED_JAR_PATH}/* --module-path=${EXTRACTED_JAR_PATH}/* $JAR | grep -v Warning) else echo "Fetch modules with default behavior" MODULES=$("$JDEPS" --print-module-deps --ignore-missing-deps --multi-release $JAVA_VERSION_BASE "$JAR" | grep -v Warning) -- 2.45.2