aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts/bootstrap
diff options
context:
space:
mode:
authorGravatar dmarting <dmarting@google.com>2017-05-05 14:12:29 +0200
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2017-05-05 15:27:50 +0200
commit511c35b46cead500d4e76706e0a709e50995ceba (patch)
tree6bb1adc788acd057d4059b81679d630e455222f8 /scripts/bootstrap
parente114a5eb00e458561152fa5cd04c318fad948253 (diff)
Bootstrap: move the fail function to the top
We use fail pretty early in the script and not having the fail function leads to non useful message about the fail function not existing. Fixes #2949. PiperOrigin-RevId: 155186880
Diffstat (limited to 'scripts/bootstrap')
-rwxr-xr-xscripts/bootstrap/buildenv.sh23
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