source: tags/1.7.0/ci/set-jdk.bash

Last change on this file was 15298, checked in by Mark Evenson, 4 years ago

ci: remove all mention of TRAVIS_BUILD_DIR

Decouple the scripts under <file:ci/> by not using any reference to
Travis CI specific variables.

TODO: depend on explict command line arguments rather than "magic
side-effects" from environment variables.

File size: 872 bytes
Line 
1function set_jdk() {
2    abcl_jdk=$1
3    if [[ -z ${abcl_jdk} ]]; then
4        abcl_jdk=openjdk8
5    fi
6
7    dir=$2
8    if [[ -z ${dir} ]]; then
9        dir=${ABCL_ROOT}
10    fi
11
12    . ${DIR}/ensure-jenv-is-present.bash
13
14    jenv versions
15
16    case ${abcl_jdk} in
17        openjdk8)
18            version=$(jenv versions | grep openjdk | grep 1.8 | tail -1 | sed s/*//)
19            ;;
20        openjdk11)
21            version=$(jenv versions | grep openjdk | grep 11.0 | tail -1 | sed s/*//)
22            ;;
23    esac
24
25    if [[ -z ${version} ]]; then
26        version=$(jenv versions | tail -1 | sed s/*//)
27    fi
28
29    if [[ -z ${version} ]]; then
30        version=1.8
31    fi
32   
33    pushd ${dir}
34
35    jenv local ${version}
36    # but practically we guard every invocation of jenv this way
37    jenv global ${version}
38
39    jenv version
40
41    popd
42}
43
44set_jdk ${ABCL_JDK} ${ABCL_ROOT}
Note: See TracBrowser for help on using the repository browser.