From 89c72559b6762aa2fe6e0ae2a4551291d48dc1d8 Mon Sep 17 00:00:00 2001 From: Jochen Schalanda Date: Sun, 22 Mar 2026 22:15:10 +0100 Subject: [PATCH] feat: add support for Dragonwell 25 --- bin/dragonwell25.bash | 144 ++++++++++++++++++++++++++++++++++++++++++ bin/update.bash | 1 + 2 files changed, 145 insertions(+) create mode 100755 bin/dragonwell25.bash diff --git a/bin/dragonwell25.bash b/bin/dragonwell25.bash new file mode 100755 index 00000000000..0b8a85324ad --- /dev/null +++ b/bin/dragonwell25.bash @@ -0,0 +1,144 @@ +#!/usr/bin/env bash +set -e +set -Euo pipefail + +TEMP_DIR=$(mktemp -d) +trap 'rm -rf ${TEMP_DIR}' EXIT + +if [[ "$#" -lt 2 ]] +then + echo "Usage: ${0} metadata-directory checksum-directory" + exit 1 +fi + +# shellcheck source=bin/functions.bash +source "$(dirname "${0}")/functions.bash" + +VENDOR='dragonwell' +METADATA_DIR="${1}/${VENDOR}" +CHECKSUM_DIR="${2}/${VENDOR}" + +ensure_directory "${METADATA_DIR}" +ensure_directory "${CHECKSUM_DIR}" + +function normalize_release_type { + case "${1}" in + ea|*Experimental*|FP1) echo 'ea' + ;; + *) echo 'ga' + ;; + esac +} + +function download { + local tag_name="${1}" + local asset_name="${2}" + local filename="${asset_name}" + + local url="https://github.com/dragonwell-project/dragonwell25/releases/download/${tag_name}/${asset_name}" + local metadata_file="${METADATA_DIR}/${filename}.json" + local archive="${TEMP_DIR}/${filename}" + + if [[ -f "${metadata_file}" ]] + then + echo "Skipping ${filename}" + elif [[ "${filename}" =~ (tar\.gz|zip)$ ]] + then + download_file "${url}" "${archive}" || return 1 + + local regex + if [[ "${filename}" =~ ^Alibaba_Dragonwell_(Standard|Extended) ]] + then + # shellcheck disable=SC2016 + regex='s/^Alibaba_Dragonwell_(?:Standard|Extended)[–_]([0-9\+.]{1,}[^_]*)_(aarch64|x64)(?:_alpine)?[-_](Linux|linux|Windows|windows)\.(.*)$/VERSION="$1" JAVA_VERSION="$1" ARCH="$2" OS="$3" EXT="$4"/g' + elif [[ "${filename}" = Alibaba_Dragonwell* ]]; + then + # shellcheck disable=SC2016 + regex='s/^Alibaba_Dragonwell_([0-9\+.]{1,}[^_]*)(?:_alpine)?[_-](?:(GA|Experimental|GA_Experimental|FP1)_)?(Linux|linux|Windows|windows)_(aarch64|x64)\.(.*)$/VERSION="$1" JAVA_VERSION="$1" RELEASE_TYPE="$2" OS="$3" ARCH="$4" EXT="$5"/g' + else + # shellcheck disable=SC2016 + regex='s/^OpenJDK(?:[0-9\+].{1,})_(x64|aarch64)_(linux|windows)_dragonwell_dragonwell-([0-9.]+)(?:_jdk)?[-_]([0-9._]+)-?(ga|.*)\.(tar\.gz|zip)$/ARCH="$1" OS="$2" VERSION="$3" JAVA_VERSION="$4" RELEASE_TYPE="$5" EXT="$6"/g' + fi + + local VERSION="" + local JAVA_VERSION="" + local RELEASE_TYPE="" + local OS="" + local ARCH="" + local EXT="" + local FEATURES="" + + # Parse meta-data from file name + eval "$(perl -pe "${regex}" <<< "${asset_name}")" + + if [[ -z "${VERSION}" ]] + then + # shellcheck disable=SC2016 + regex='s/^Alibaba_Dragonwell_([0-9\+.]{1,}[^_]*)(?:_alpine)?_(aarch64|x64)_(Linux|linux|Windows|windows)\.(.*)$/VERSION="$1" JAVA_VERSION="$1" RELEASE_TYPE="jdk" OS="$3" ARCH="$2" EXT="$4"/g' + eval "$(perl -pe "${regex}" <<< "${asset_name}")" + fi + + if [[ -z "${VERSION}" ]] + then + echo "Unable to parse ${asset_name}" + return 1 + fi + + if [[ -z "${RELEASE_TYPE}" ]] + then + RELEASE_TYPE='ga' + fi + + if [[ "${VERSION}" =~ "preview" ]] + then + RELEASE_TYPE='ea' + fi + + if [[ "${filename}" =~ "_alpine" ]] + then + FEATURES='musl' + fi + + local json + json="$(metadata_json \ + "${VENDOR}" \ + "${filename}" \ + "$(normalize_release_type "${RELEASE_TYPE}")" \ + "${VERSION}" \ + "${JAVA_VERSION}" \ + 'hotspot' \ + "$(normalize_os "${OS}")" \ + "$(normalize_arch "${ARCH}")" \ + "${EXT}" \ + 'jdk' \ + "${FEATURES}" \ + "${url}" \ + "$(hash_file 'md5' "${archive}" "${CHECKSUM_DIR}")" \ + "$(hash_file 'sha1' "${archive}" "${CHECKSUM_DIR}")" \ + "$(hash_file 'sha256' "${archive}" "${CHECKSUM_DIR}")" \ + "$(hash_file 'sha512' "${archive}" "${CHECKSUM_DIR}")" \ + "$(file_size "${archive}")" \ + "${filename}" + )" + + echo "${json}" > "${metadata_file}" + rm -f "${archive}" + else + echo "Skipping ${filename}" + fi +} + +RELEASE_FILE="${TEMP_DIR}/releases-${VENDOR}-25.json" +download_github_releases 'dragonwell-project' 'dragonwell25' "${RELEASE_FILE}" + +versions=$(jq -r '.[].tag_name' "${RELEASE_FILE}" | sort -V) +for version in ${versions} +do + assets=$(jq -r ".[] | select(.tag_name == \"${version}\") | .assets[] | select(.content_type | startswith(\"application\")) | select(.name | contains(\"_source\") | not) | select(.name | endswith(\"jar\") | not) | .name" "${RELEASE_FILE}") + for asset in ${assets} + do + download "${version}" "${asset}" || echo "Cannot download ${asset}" + done +done + +jq -s -S . "${METADATA_DIR}"/{Alibaba_Dragonwell,OpenJDK}*.json > "${METADATA_DIR}/all.json" diff --git a/bin/update.bash b/bin/update.bash index eaac219cb80..6350987b349 100755 --- a/bin/update.bash +++ b/bin/update.bash @@ -52,6 +52,7 @@ vendors=( "$(cmd 'dragonwell11')" "$(cmd 'dragonwell17')" "$(cmd 'dragonwell21')" + "$(cmd 'dragonwell25')" "$(cmd 'oracle')" "$(cmd 'oracle-graalvm')" "$(cmd 'oracle-graalvm-ea')"