source: tags/1.9.2/ci/install-openjdk.bash

Last change on this file was 15697, checked in by Mark Evenson, 18 months ago

ci: update openjdk versions

Deprecate openjdk19 in favor of openjdk20 as it is the current
development release.

Have <file:ci/set-jdk.bash> only use its arguments to set jdk
version, while attempting to be more verbose and guard against failure
to interpolate these values as we go.

Usage:

set-jdk OPENJDK_VERSION ABCL_ROOT

where

OPENJDK_VERSION is of the form 'openjdk8', 'openjdk19', etc.

ABCL_ROOT is the root of the ABCL source tree

File size: 6.4 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
11uname=$2
12if [[ -z $uname ]]; then
13    uname=$(uname)
14fi
15
16# empty variables are not necessary, but a hint that these are not
17# lexically scoped in their modification.
18topdir=
19dist=
20function determine_openjdk() {
21    case $uname in
22        # just x86_64 for now.  We've got Rosseta2 c'est nes pas?
23        Darwin)
24            case $jdk in
25                openjdk8)
26                    v=372
27                    build=b07
28                    version=1.8.0.${v}
29                    topdir=jdk8u${v}-${build}
30                    dist="https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u${v}-${build}/OpenJDK8U-jdk_x64_mac_hotspot_8u${v}${build}.tar.gz"
31                    ;;
32                openjdk11)
33                    version=11.0.19
34                    build=7
35                    topdir=jdk-${version}+${build}
36                    dist="https://github.com/adoptium/temurin11-binaries/releases/download/jdk-${version}%2B${build}/OpenJDK11U-jdk_x64_mac_hotspot_${version}_${build}.tar.gz"
37                    ;;
38                # deprecated
39                openjdk14)  # Need version from adoptium
40                    topdir=jdk-14.0.2+12
41                    dist="https://github.com/AdoptOpenJDK/openjdk14-binaries/releases/download/jdk-14.0.2%2B12/OpenJDK14U-jdk_x64_mac_hotspot_14.0.2_12.tar.gz"
42                    ;;
43                # deprecated
44                openjdk15) # Need version from adoptium
45                    topdir=jdk-15+36
46                    dist="https://github.com/AdoptOpenJDK/openjdk15-binaries/releases/download/jdk-15%2B36/OpenJDK15U-jdk_x64_mac_hotspot_15_36.tar.gz"
47                    ;;
48                # deprecated
49                openjdk16)
50                    topdir=jdk-16.0.2+7
51                    dist="https://github.com/adoptium/temurin16-binaries/releases/download/jdk-16.0.2%2B7/OpenJDK16U-jdk_x64_mac_hotspot_16.0.2_7.tar.gz"
52                    ;;
53                openjdk17)
54                    version=17.0.7
55                    build=7
56                    topdir="jdk-${version}+${build}"
57                    dist="https://github.com/adoptium/temurin17-binaries/releases/download/jdk-${version}%2B${build}/OpenJDK17U-jdk_x64_mac_hotspot_${version}_${build}.tar.gz"
58                    ;;
59                # deprecated
60                openjdk19)
61                    v="19"
62                    id="${v}.0.2"
63                    rev="7"
64                    arch="jdk_x64_mac_hotspot"
65                    topdir="jdk-${id}+${rev}"
66                    dist="https://github.com/adoptium/temurin${v}-binaries/releases/download/jdk-${id}%2B${rev}/OpenJDK${v}U-${arch}_${id}_${rev}.tar.gz"
67                    ;;
68                openjdk20)
69                    v="20"
70                    id="${v}.0.1"
71                    rev="9"
72                    arch="jdk_x64_mac_hotspot"
73                    topdir="jdk-${id}+${rev}"
74                    dist="https://github.com/adoptium/temurin${v}-binaries/releases/download/jdk-${id}%2B${rev}/OpenJDK${v}U-${arch}_${id}_${rev}.tar.gz"
75                    ;;
76            esac
77            ;;
78        Linux)
79            case $jdk in
80                openjdk8)
81                    version=u372
82                    build=b07
83                    topdir=jdk8${version}-${build}
84                    dist="https://github.com/adoptium/temurin8-binaries/releases/download/jdk8${version}-${build}/OpenJDK8U-jdk_x64_linux_hotspot_8${version}${build}.tar.gz"
85                    ;;
86                openjdk11)
87                    version=11.0.19
88                    build=7
89                    topdir=jdk-${version}+${build}
90                    dist="https://github.com/adoptium/temurin11-binaries/releases/download/jdk-${version}%2B${build}/OpenJDK11U-jdk_x64_linux_hotspot_${version}_${build}.tar.gz"
91                    ;;
92                # deprecated
93                openjdk14) # Need version from adoptium
94                    topdir=jdk-14.0.2+12
95                    dist="https://github.com/AdoptOpenJDK/openjdk14-binaries/releases/download/jdk-14.0.2%2B12/OpenJDK14U-jdk_x64_linux_hotspot_14.0.2_12.tar.gz"
96                    ;;
97                # deprecated
98                openjdk15) # Need version from adoptium
99                    topdir=jdk-15+36
100                    dist="https://github.com/AdoptOpenJDK/openjdk15-binaries/releases/download/jdk-15%2B36/OpenJDK15U-jdk_x64_linux_hotspot_15_36.tar.gz"
101                    ;;
102                # deprecated
103                openjdk16)
104                    topdir=jdk-16.0.2+7
105                    dist="https://github.com/adoptium/temurin16-binaries/releases/download/jdk-16.0.2%2B7/OpenJDK16U-jdk_x64_linux_hotspot_16.0.2_7.tar.gz"
106                    ;;
107                openjdk17)
108                    version=17.0.7
109                    build=7
110                    topdir="jdk-${version}+${build}"
111                    dist="https://github.com/adoptium/temurin17-binaries/releases/download/jdk-${version}%2B${build}/OpenJDK17U-jdk_x64_linux_hotspot_${version}_${build}.tar.gz"
112                    ;;
113                # deprecated
114                openjdk19)
115                    v="19"
116                    id="${v}.0.2"
117                    rev="7"
118                    arch="jdk_x64_linux_hotspot"
119                    topdir="jdk-${id}+${rev}"
120                    dist="https://github.com/adoptium/temurin${v}-binaries/releases/download/jdk-${id}%2B${rev}/OpenJDK${v}U-${arch}_${id}_${rev}.tar.gz"
121                    ;;
122                openjdk20)
123                    v="20"
124                    id="${v}.0.1"
125                    rev="9"
126                    arch="jdk_x64_linux_hotspot"
127                    topdir="jdk-${id}+${rev}"
128                    dist="https://github.com/adoptium/temurin${v}-binaries/releases/download/jdk-${id}%2B${rev}/OpenJDK${v}U-${arch}_${id}_${rev}.tar.gz"
129                    ;;
130esac
131            ;;
132        *)
133            echo No known dist for $(uname)
134    esac
135}
136
137tmpdir=/var/tmp
138
139function download_and_extract() {
140    pushd ${tmpdir} && wget --continue ${dist}
141   
142    tar xvz -f $(basename ${dist})
143
144    popd
145}
146
147function add_jdk() {
148    echo $dist
149    echo $tmpdir
150    case $(uname) in
151        Darwin)
152            jenv add ${tmpdir}/${topdir}/Contents/Home
153            ;;
154        Linux)
155            jenv add ${tmpdir}/${topdir}
156            ;;
157    esac
158}
159
160determine_openjdk
161download_and_extract
162add_jdk
163
164. ${DIR}/set-jdk.bash ${jdk}
165
166jenv doctor
Note: See TracBrowser for help on using the repository browser.