diff --git a/lib/jvm.sh b/lib/jvm.sh index 5f29f0d..674c962 100644 --- a/lib/jvm.sh +++ b/lib/jvm.sh @@ -10,13 +10,6 @@ else DEFAULT_JDK_VERSION="1.8" fi -read -d '' -r INVENTORY_QUERY <<'JQ_QUERY' - ($raw_version_string | capture("((?[^-]*?)-)?(?.*$)")) as $parsed_raw_version_string | - (.version_aliases[$parsed_raw_version_string.version] // $parsed_raw_version_string.version) as $version | - ($parsed_raw_version_string.stack // $default_distribution) as $distribution | - .artifacts[] | select(.version == $version and .metadata.distribution == $distribution and .arch == "amd64" and .os == "linux" and (.metadata.cedar_stack? == null or .metadata.cedar_stack? == $stack)) -JQ_QUERY - get_jdk_version() { local appDir="${1:?}" @@ -29,6 +22,13 @@ get_jdk_version() { } get_jdk_url() { + read -d '' -r INVENTORY_QUERY <<-'INVENTORY_QUERY' + ($raw_version_string | capture("((?[^-]*?)-)?(?.*$)")) as $parsed_raw_version_string | + (.version_aliases[$parsed_raw_version_string.version] // $parsed_raw_version_string.version) as $version | + ($parsed_raw_version_string.stack // $default_distribution) as $distribution | + .artifacts[] | select(.version == $version and .metadata.distribution == $distribution and .arch == "amd64" and .os == "linux" and (.metadata.cedar_stack? == null or .metadata.cedar_stack? == $stack)) + INVENTORY_QUERY + jq <"${JVM_COMMON_DIR}/inventory.json" \ --arg raw_version_string "${1}" \ --arg default_distribution "zulu" \