Compare commits

..

3 Commits

27
warp4j
View File

@ -273,20 +273,20 @@ function choose_distro_type() {
# actually choose distro type # actually choose distro type
JAVA_DISTRO_TYPE=$(choose_distro_type) JAVA_DISTRO_TYPE=$(choose_distro_type)
# generates adoptopenjdk api url # generates adoptium api url
function api_url() { function api_url() {
local request=$1 # info/binary local request=$1 # info/binary
local platform=$2 # windows/linux/macos local platform=$2 # windows/linux/macos
# adoptopenjdk uses "mac" instead of "macos" # adoptium uses "mac" instead of "macos"
if [[ $platform == "macos" ]]; then if [[ $platform == "macos" ]]; then
platform="mac" platform="mac"
fi fi
echo -n "https://api.adoptopenjdk.net/v2/\
$request/releases/openjdk$JAVA_VERSION_BASE?\ echo -n "https://api.adoptium.net/v3/assets/feature_releases/\
openjdk_impl=$JVM_IMPL&\ $JAVA_VERSION_BASE/ga?architecture=x64&heap_size=normal&image_type=jdk&\
os=$platform&\ os=$platform&page=0&page_size=20&project=$JAVA_DISTRO_TYPE&\
arch=x64&\ sort_method=DEFAULT&sort_order=DESC&vendor=eclipse"
type=$JAVA_DISTRO_TYPE"
} }
# requests info about all releases for given platform and java branch # 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 # finds latest concrete distro version that matches version specified by user
function find_latest_version() { 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 user_version=$2 # version supplied by user is a template
local matched_version # latest version that matches the template local matched_version # latest version that matches the template
local versions # all versions local versions # all versions
@ -495,12 +495,11 @@ function find_latest_version() {
# finds direct link to download concrete runtime version # finds direct link to download concrete runtime version
function find_distro_link() { 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 version=$2 # concrete distro version like "11.0.2+9"
local link=$(echo "$info" \ local link=$(echo "$info" \
| grep -B13 "\"heap_size\": \"normal\"" \ | grep -B14 "\"release_name\": \"jdk-$version\"" \
| grep -B11 "\"semver\": \"$version\"" \ | grep "\"link\":" \
| grep "binary_link" \
| sort --reverse \ | sort --reverse \
| head -n 1 \ | head -n 1 \
| awk '{print $2}' \ | awk '{print $2}' \
@ -653,7 +652,7 @@ if [[ $JAVA_DISTRO_TYPE == $DISTRO_TYPE_JDK ]]; then
echo "Extracting jar file to get classpath" echo "Extracting jar file to get classpath"
unzip -q "${JAR}" -d "${EXTRACTED_JAR_PATH}" unzip -q "${JAR}" -d "${EXTRACTED_JAR_PATH}"
echo "Fetching modules" 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 else
echo "Fetch modules with default behavior" echo "Fetch modules with default behavior"
MODULES=$("$JDEPS" --print-module-deps --ignore-missing-deps --multi-release $JAVA_VERSION_BASE "$JAR" | grep -v Warning) MODULES=$("$JDEPS" --print-module-deps --ignore-missing-deps --multi-release $JAVA_VERSION_BASE "$JAR" | grep -v Warning)