feature/using_new_adoptium_url #3

Merged
David merged 2 commits from feature/using_new_adoptium_url into develop 2024-05-11 21:16:59 +02:00

27
warp4j
View File

@ -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}' \
@ -653,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)