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
@@ -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
