mirror of
https://github.com/halcyon/asdf-java.git
synced 2024-10-05 23:32:11 +08:00
New architecture
This commit is contained in:
parent
a39f3bbb79
commit
2a22a1723e
21
LICENSE
Normal file
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2019 Scott McLeod
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
4
README.md
Normal file
4
README.md
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# asdf-java
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
* [jq](https://stedolan.github.io/jq/)
|
112
bin/functions
Executable file
112
bin/functions
Executable file
@ -0,0 +1,112 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
PLUGIN_HOME=$(dirname $(dirname "${0}"))
|
||||||
|
CACHE_DIR="/tmp/asdf-java.cache"
|
||||||
|
mkdir -p ${CACHE_DIR}
|
||||||
|
case "$(uname -s)" in
|
||||||
|
Darwin) TEMP_DIR=$(mktemp -dt asdf-java)
|
||||||
|
STAT="stat -f %c ${CACHE_DIR}/*"
|
||||||
|
;;
|
||||||
|
*) TEMP_DIR=$(mktemp -dp /tmp asdf-java.XXXXXXXX)
|
||||||
|
STAT="stat -c %Z ${CACHE_DIR}/*";;
|
||||||
|
esac
|
||||||
|
|
||||||
|
trap "cd ${PWD}; rm -rf ${TEMP_DIR}" EXIT
|
||||||
|
|
||||||
|
function retrieve-json() {
|
||||||
|
URLS=("https://api.adoptopenjdk.net/v2/info/releases/{openjdk8}?type=jdk"
|
||||||
|
"https://api.adoptopenjdk.net/v2/info/releases/{openjdk9}?type=jdk"
|
||||||
|
"https://api.adoptopenjdk.net/v2/info/releases/{openjdk10}?type=jdk"
|
||||||
|
"https://api.adoptopenjdk.net/v2/info/releases/{openjdk11}?type=jdk"
|
||||||
|
"https://api.adoptopenjdk.net/v2/info/releases/{openjdk12}?type=jdk")
|
||||||
|
|
||||||
|
if [[ -z "$(ls -A ${CACHE_DIR})" ]] || [[ $(set -- $(${STAT}) && echo ${1}) -le $(( `date +%s` - 3600)) ]]
|
||||||
|
then
|
||||||
|
for url in "${URLS[@]}"
|
||||||
|
do
|
||||||
|
curl -s -L ${url} -# -w "%{filename_effective}\n" -o "${CACHE_DIR}/adopt-#1.json" 2>&1 >> /dev/null
|
||||||
|
done
|
||||||
|
for i in `ls ${CACHE_DIR}`
|
||||||
|
do
|
||||||
|
jq '(.[].release_name) |= sub("jdk-";"adopt-openjdk-") | (.[].release_name) |= sub("^jdk";"adopt-openjdk-")' \
|
||||||
|
${CACHE_DIR}/${i} > ${CACHE_DIR}/${i}.temp
|
||||||
|
mv ${CACHE_DIR}/${i}.temp ${CACHE_DIR}/${i}
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function all-json() {
|
||||||
|
jq -s 'add' ${CACHE_DIR}/*.json ${PLUGIN_HOME}/corretto/corretto.json ${PLUGIN_HOME}/zulu/zulu.json
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function list-all() {
|
||||||
|
retrieve-json
|
||||||
|
local hotspot="map(select(.binaries[].openjdk_impl == \"hotspot\")) \
|
||||||
|
| map(.release_name) | unique[]"
|
||||||
|
local openj9_normal_heap="map(select(.binaries[].heap_size == \"normal\")) \
|
||||||
|
| map(.release_name) | unique[] | select(contains(\"openj9\"))"
|
||||||
|
local openj9_large_heap="map(select(.binaries[].heap_size == \"large\")) \
|
||||||
|
| map(.release_name + \"_large-heap\") | unique[] | select(contains(\"openj9\"))"
|
||||||
|
echo $(all-json | jq -r "${hotspot}" ; all-json | jq -r "${openj9_normal_heap}" ; all-json | jq -r "${openj9_large_heap}")
|
||||||
|
}
|
||||||
|
|
||||||
|
function install {
|
||||||
|
retrieve-json
|
||||||
|
local release=$(case ${ASDF_INSTALL_VERSION} in
|
||||||
|
*_large-heap) echo ${ASDF_INSTALL_VERSION%%_large-heap} ;;
|
||||||
|
*) echo ${ASDF_INSTALL_VERSION} ;;
|
||||||
|
|
||||||
|
esac)
|
||||||
|
local heap_size=$(case ${ASDF_INSTALL_VERSION} in
|
||||||
|
*_large-heap) echo "large" ;;
|
||||||
|
*) echo "normal" ;;
|
||||||
|
esac)
|
||||||
|
local os=$(case `uname -s` in
|
||||||
|
Linux) echo "linux" ;;
|
||||||
|
Darwin) echo "mac" ;;
|
||||||
|
esac)
|
||||||
|
local architecture=$(case `uname -m` in
|
||||||
|
x86_64) echo "x64" ;;
|
||||||
|
esac)
|
||||||
|
local select_release="map(select(.release_name==\"${release}\")) | unique[] | .binaries[]"
|
||||||
|
local select_binary="select(.os==\"${os}\" and .architecture==\"${architecture}\" and .heap_size==\"${heap_size}\")"
|
||||||
|
local binary=$(all-json | jq "$select_release | $select_binary")
|
||||||
|
local binary_link=$(set -- $(echo ${binary} | jq -r ".binary_link") ; echo ${1})
|
||||||
|
local checksum_link=$(set -- $(echo ${binary} | jq -r ".checksum_link") ; echo ${1})
|
||||||
|
|
||||||
|
cd ${TEMP_DIR}
|
||||||
|
curl -LO -# -w "%{filename_effective}\n" ${binary_link}
|
||||||
|
if [ $? -ne 0 ]
|
||||||
|
then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
curl -LO -# -w "%{filename_effective}\n" ${checksum_link}
|
||||||
|
if [ $? -ne 0 ]
|
||||||
|
then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
sha256sum -c $(basename ${checksum_link})
|
||||||
|
|
||||||
|
tar zxf $(basename ${binary_link})
|
||||||
|
dir=$(set -- $(ls -d */) ; echo ${1})
|
||||||
|
cd ${dir}
|
||||||
|
mkdir -p ${ASDF_INSTALL_PATH}
|
||||||
|
|
||||||
|
case ${os} in
|
||||||
|
mac) case ${release} in
|
||||||
|
azul*) mv * ${ASDF_INSTALL_PATH} ;;
|
||||||
|
*) mv Contents/Home/* ${ASDF_INSTALL_PATH} ;;
|
||||||
|
esac ;;
|
||||||
|
*) mv * ${ASDF_INSTALL_PATH} ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
case `basename ${0}` in
|
||||||
|
list-all) list-all
|
||||||
|
;;
|
||||||
|
install) install
|
||||||
|
;;
|
||||||
|
esac
|
1
bin/install
Symbolic link
1
bin/install
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
functions
|
1
bin/list-all
Symbolic link
1
bin/list-all
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
functions
|
@ -0,0 +1 @@
|
|||||||
|
810e6a70a8170e72f9d0fd9a380ba1e36bff9e44435175ef509f3c8b3be93d4c amazon-corretto-11.0.3.7.1-linux-x64.tar.gz
|
@ -0,0 +1 @@
|
|||||||
|
db6331dc95cba56e3412e9edc878bdbdb9a919c5a8feb54bbda86bc89184468a amazon-corretto-11.0.3.7.1-macosx-x64.tar.gz
|
@ -0,0 +1 @@
|
|||||||
|
84241d523798c1df5b7c5e2e57615a8761b6eb8386eb87026895803319d3c5ce amazon-corretto-8.212.04.2-linux-x64.tar.gz
|
@ -0,0 +1 @@
|
|||||||
|
1d53e7a9fd0e2ab213bb6ea9043992a46fa5b82a5dd1de674bc9bfc2ed59432c amazon-corretto-8.212.04.2-macosx-x64.tar.gz
|
43
corretto/corretto.json
Normal file
43
corretto/corretto.json
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"release_name": "amazon-corretto-8.212.04.2",
|
||||||
|
"binaries": [
|
||||||
|
{
|
||||||
|
"os": "linux",
|
||||||
|
"architecture": "x64",
|
||||||
|
"openjdk_impl": "hotspot",
|
||||||
|
"binary_link": "https://d3pxv6yz143wms.cloudfront.net/8.212.04.2/amazon-corretto-8.212.04.2-linux-x64.tar.gz",
|
||||||
|
"heap_size": "normal",
|
||||||
|
"checksum_link": "https://raw.githubusercontent.com/halcyon/asdf-java-2/master/corretto/amazon-corretto-8.212.04.2-linux-x64.tar.gz.sha256.txt"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"os": "mac",
|
||||||
|
"architecture": "x64",
|
||||||
|
"openjdk_impl": "hotspot",
|
||||||
|
"binary_link": "https://d3pxv6yz143wms.cloudfront.net/8.212.04.2/amazon-corretto-8.212.04.2-macosx-x64.tar.gz",
|
||||||
|
"heap_size": "normal",
|
||||||
|
"checksum_link": "https://raw.githubusercontent.com/halcyon/asdf-java-2/master/corretto/amazon-corretto-8.212.04.2-macosx-x64.tar.gz.sha256.txt"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"release_name": "amazon-corretto-11.0.3.7.1",
|
||||||
|
"binaries": [
|
||||||
|
{
|
||||||
|
"os": "linux",
|
||||||
|
"architecture": "x64",
|
||||||
|
"openjdk_impl": "hotspot",
|
||||||
|
"binary_link": "https://d3pxv6yz143wms.cloudfront.net/11.0.3.7.1/amazon-corretto-11.0.3.7.1-linux-x64.tar.gz",
|
||||||
|
"heap_size": "normal",
|
||||||
|
"checksum_link": "https://raw.githubusercontent.com/halcyon/asdf-java-2/master/corretto/amazon-corretto-11.0.3.7.1-linux-x64.tar.gz.sha256.txt"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"os": "mac",
|
||||||
|
"architecture": "x64",
|
||||||
|
"openjdk_impl": "hotspot",
|
||||||
|
"binary_link": "https://d3pxv6yz143wms.cloudfront.net/11.0.3.7.1/amazon-corretto-11.0.3.7.1-macosx-x64.tar.gz",
|
||||||
|
"heap_size": "normal",
|
||||||
|
"checksum_link": "https://raw.githubusercontent.com/halcyon/asdf-java-2/master/corretto/amazon-corretto-11.0.3.7.1-macosx-x64.tar.gz.sha256.txt"
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
]
|
5
set-java-home.sh
Normal file
5
set-java-home.sh
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
asdf current java 2>&1 > /dev/null
|
||||||
|
if [[ "$?" -eq 0 ]]
|
||||||
|
then
|
||||||
|
export JAVA_HOME=$(asdf where java)
|
||||||
|
fi
|
75
zulu/zulu.json
Normal file
75
zulu/zulu.json
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"release_name": "azul-zulu-12.0.1",
|
||||||
|
"binaries": [
|
||||||
|
{
|
||||||
|
"os": "linux",
|
||||||
|
"architecture": "x64",
|
||||||
|
"openjdk_impl": "hotspot",
|
||||||
|
"binary_link": "https://cdn.azul.com/zulu/bin/zulu12.2.3-ca-jdk12.0.1-linux_x64.tar.gz",
|
||||||
|
"heap_size": "normal",
|
||||||
|
"checksum_link": "https://raw.githubusercontent.com/halcyon/asdf-java-2/master/zulu/zulu12.2.3-ca-jdk12.0.1-linux_x64.tar.gz.sha256.txt"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"os": "mac",
|
||||||
|
"architecture": "x64",
|
||||||
|
"openjdk_impl": "hotspot",
|
||||||
|
"binary_link": "https://cdn.azul.com/zulu/bin/zulu12.2.3-ca-jdk12.0.1-macosx_x64.tar.gz",
|
||||||
|
"heap_size": "normal",
|
||||||
|
"checksum_link": "https://raw.githubusercontent.com/halcyon/asdf-java-2/master/zulu/zulu12.2.3-ca-jdk12.0.1-macosx_x64.tar.gz.sha256.txt"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"release_name": "azul-zulu-11.0.3",
|
||||||
|
"binaries": [
|
||||||
|
{
|
||||||
|
"os": "linux",
|
||||||
|
"architecture": "x64",
|
||||||
|
"openjdk_impl": "hotspot",
|
||||||
|
"binary_link": "https://cdn.azul.com/zulu/bin/zulu11.31.11-ca-jdk11.0.3-linux_x64.tar.gz",
|
||||||
|
"heap_size": "normal",
|
||||||
|
"checksum_link": "https://raw.githubusercontent.com/halcyon/asdf-java-2/master/zulu/zulu11.31.11-ca-jdk11.0.3-linux_x64.tar.gz.sha256.txt"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"os": "mac",
|
||||||
|
"architecture": "x64",
|
||||||
|
"openjdk_impl": "hotspot",
|
||||||
|
"binary_link": "https://cdn.azul.com/zulu/bin/zulu11.31.11-ca-jdk11.0.3-macosx_x64.tar.gz",
|
||||||
|
"heap_size": "normal",
|
||||||
|
"checksum_link": "https://raw.githubusercontent.com/halcyon/asdf-java-2/master/zulu/zulu11.31.11-ca-jdk11.0.3-macosx_x64.tar.gz.sha256.txt"
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"release_name": "azul-zulu-8.0.212",
|
||||||
|
"binaries": [
|
||||||
|
{
|
||||||
|
"os": "linux",
|
||||||
|
"architecture": "x64",
|
||||||
|
"openjdk_impl": "hotspot",
|
||||||
|
"binary_link": "https://cdn.azul.com/zulu/bin/zulu8.38.0.13-ca-jdk8.0.212-linux_x64.tar.gz",
|
||||||
|
"heap_size": "normal",
|
||||||
|
"checksum_link": "https://raw.githubusercontent.com/halcyon/asdf-java-2/master/zulu/zulu8.38.0.13-ca-jdk8.0.212-linux_x64.tar.gz.sha256.txt"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"os": "mac",
|
||||||
|
"architecture": "x64",
|
||||||
|
"openjdk_impl": "hotspot",
|
||||||
|
"binary_link": "https://cdn.azul.com/zulu/bin/zulu8.38.0.13-ca-jdk8.0.212-macosx_x64.tar.gz",
|
||||||
|
"heap_size": "normal",
|
||||||
|
"checksum_link": "https://raw.githubusercontent.com/halcyon/asdf-java-2/master/zulu/zulu8.38.0.13-ca-jdk8.0.212-macosx_x64.tar.gz.sha256.txt"
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"release_name": "azul-zulu-7u222",
|
||||||
|
"binaries": [
|
||||||
|
{
|
||||||
|
"os": "linux",
|
||||||
|
"architecture": "x64",
|
||||||
|
"openjdk_impl": "hotspot",
|
||||||
|
"binary_link": "https://cdn.azul.com/zulu/bin/zulu7.29.0.5-ca-jdk7.0.222-linux_x64.tar.gz",
|
||||||
|
"heap_size": "normal",
|
||||||
|
"checksum_link": "https://raw.githubusercontent.com/halcyon/asdf-java-2/master/zulu/zulu7.29.0.5-ca-jdk7.0.222-linux_x64.tar.gz.sha256.txt"
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
]
|
@ -0,0 +1 @@
|
|||||||
|
ddb0fd4526089cf1ce2db36282c282263f587a9e8be373fa02f511a12923cc48 zulu11.31.11-ca-jdk11.0.3-linux_x64.tar.gz
|
@ -0,0 +1 @@
|
|||||||
|
98df91fa49f16b73dbc09e153628190640ff6c3fac2322b8142bc00077a0f738 zulu11.31.11-ca-jdk11.0.3-macosx_x64.tar.gz
|
1
zulu/zulu12.2.3-ca-jdk12.0.1-linux_x64.tar.gz.sha256.txt
Normal file
1
zulu/zulu12.2.3-ca-jdk12.0.1-linux_x64.tar.gz.sha256.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
529c99841d69e11a85aea967ccfb9d0fd40b98c5b68dbe1d059002655e0a9c13 zulu12.2.3-ca-jdk12.0.1-linux_x64.tar.gz
|
@ -0,0 +1 @@
|
|||||||
|
67ca9d285056132ebb19fa237a14affda52132142e1171fe1c20e18974b3b8a5 zulu12.2.3-ca-jdk12.0.1-macosx_x64.tar.gz
|
@ -0,0 +1 @@
|
|||||||
|
2eb69c315beaa6d804647ff33f931f19ca076daa65808cd9fa285d557c00b677 zulu7.29.0.5-ca-jdk7.0.222-linux_x64.tar.gz
|
@ -0,0 +1 @@
|
|||||||
|
568e7578f1b20b1e62a8ed2c374bad4eb0e75d221323ccfa6ba8d7bc56cf33cf zulu8.38.0.13-ca-jdk8.0.212-linux_x64.tar.gz
|
@ -0,0 +1 @@
|
|||||||
|
64538f3eed34a298cc48168e89326fd323a55d801a3e6b2c3cc948effe124250 zulu8.38.0.13-ca-jdk8.0.212-macosx_x64.tar.gz
|
Loading…
Reference in New Issue
Block a user