source: trunk/abcl/ci/install-adoptjdk.bash @ 15263

Last change on this file since 15263 was 15263, checked in by Mark Evenson, 2 years ago

ci: use latest available openjdk8-8u252b09 and openjdk11-11.0.7b10

File size: 2.5 KB
Line 
1#!/usr/bin/env bash
2DIR="$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
3
4. ${DIR}/install-jenv.bash
5
6jdk=$1
7if [[ -z $jdk ]]; then
8    jdk=openjdk8
9fi
10
11# empty variables are not necessary, but a hint that these are not
12# lexically scoped in their modification.
13topdir=
14dist=
15function determine_adoptjdk() {
16    case $(uname) in
17        Darwin)
18            case $jdk in
19                openjdk8)
20                    topdir=jdk8u252-b09
21                    dist="https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u252-b09/OpenJDK8U-jdk_x64_mac_hotspot_8u252b09.tar.gz"
22                    ;;
23                openjdk11)
24                    topdir=jdk-11.0.7+10
25                    dist="https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.7%2B10/OpenJDK11U-jdk_x64_mac_hotspot_11.0.7_10.tar.gz"
26                    ;;
27                openjdk14)
28                    topdir=jdk-14.0.1+7
29                    dist="https://github.com/AdoptOpenJDK/openjdk14-binaries/releases/download/jdk-14.0.1%2B7/OpenJDK14U-jdk_x64_mac_hotspot_14.0.1_7.tar.gz"
30                    ;;
31            esac
32            ;;
33        Linux)
34            case $jdk in
35                openjdk8)
36                    topdir=jdk8u252-b09
37                    dist="https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u252-b09/OpenJDK8U-jdk_x64_linux_hotspot_8u252b09.tar.gz"
38                    ;;
39                openjdk11)
40                    topdir=jdk-11.0.7+10
41                    dist="https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.7%2B10/OpenJDK11U-jdk_x64_linux_hotspot_11.0.7_10.tar.gz"
42                    ;;
43                openjdk14)
44                    topdir=jdk-14.0.1+7
45                    dist="https://github.com/AdoptOpenJDK/openjdk14-binaries/releases/download/jdk-14.0.1%2B7/OpenJDK14U-jdk_x64_linux_hotspot_14.0.1_7.tar.gz"
46                    ;;
47            esac
48            ;;
49        *)
50            echo No known dist for $(uname)
51    esac
52}
53
54tmpdir=/var/tmp
55
56function download_and_extract() {
57    pushd ${tmpdir} && wget --continue ${dist}
58   
59    tar xvz -f $(basename ${dist})
60
61    popd
62}
63
64function add_jdk() {
65    echo $dist
66    echo $tmpdir
67    case $(uname) in
68        Darwin)
69            jenv add ${tmpdir}/${topdir}/Contents/Home
70            ;;
71        Linux)
72            jenv add ${tmpdir}/${topdir}
73            ;;
74    esac
75}
76
77determine_adoptjdk
78download_and_extract
79add_jdk
80
81. ${DIR}/set-jdk.bash
82
83jenv doctor
84
85
86
87
88
89
90
Note: See TracBrowser for help on using the repository browser.