Feature: Updating url and parser to fetch from Adoptium
This commit is contained in:
parent
6ee83e1056
commit
d15b451319
25
warp4j
25
warp4j
@ -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}' \
|
||||||
|
Loading…
Reference in New Issue
Block a user