diff options
-rwxr-xr-x | scripts/bootstrap/buildenv.sh | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/scripts/bootstrap/buildenv.sh b/scripts/bootstrap/buildenv.sh index 197eef981d..88d7e4fc45 100755 --- a/scripts/bootstrap/buildenv.sh +++ b/scripts/bootstrap/buildenv.sh @@ -30,6 +30,19 @@ if [ -n "${BAZEL_WRKDIR}" ] ; then fi +# We define the fail function early so we can use it when detecting the JDK +# See https://github.com/bazelbuild/bazel/issues/2949, +function fail() { + local exitCode=$? + if [[ "$exitCode" = "0" ]]; then + exitCode=1 + fi + echo >&2 + echo "ERROR: $@" >&2 + exit $exitCode +} + + # Set standard variables DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) WORKSPACE_DIR="$(dirname "$(dirname "${DIR}")")" @@ -192,16 +205,6 @@ function run() { fi } -function fail() { - local exitCode=$? - if [[ "$exitCode" = "0" ]]; then - exitCode=1 - fi - echo >&2 - echo "ERROR: $@" >&2 - exit $exitCode -} - function display() { if [[ -z "${QUIETMODE}" ]]; then echo -e "$@" >&2 |