databuild/job/configure_wrapper.sh.tpl

38 lines
1.4 KiB
Smarty
Executable file

#!/bin/bash
set -e
# --- begin runfiles.bash initialization v3 ---
# Copy-pasted from the Bazel Bash runfiles library v3.
set -uo pipefail; set +e; f=bazel_tools/tools/bash/runfiles/runfiles.bash
source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \
source "$(grep -sm1 "^$f " "${RUNFILES_MANIFEST_FILE:-/dev/null}" | cut -f2- -d' ')" 2>/dev/null || \
source "$0.runfiles/$f" 2>/dev/null || \
source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
{ echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e
# --- end runfiles.bash initialization v3 ---
CONFIGURE_BINARY="%{CONFIGURE_PATH}"
# Set up JAVA_RUNFILES if not already set
if [[ -z "${JAVA_RUNFILES:-}" ]]; then
if [[ -d "$0.runfiles" ]]; then
export JAVA_RUNFILES="$0.runfiles"
elif [[ -f "${RUNFILES_MANIFEST_FILE:-}" ]]; then
export JAVA_RUNFILES="$(dirname "${RUNFILES_MANIFEST_FILE}")"
fi
fi
if [[ ! -x "$CONFIGURE_BINARY" ]]; then
CONFIGURE_BASENAME=$(basename "$CONFIGURE_BINARY")
if [[ ! -x "$CONFIGURE_BASENAME" ]]; then
echo "Error: CONFIGURE binary not found or not executable at $CONFIGURE_BINARY and $CONFIGURE_BASENAME" >&2
exit 1
else
CONFIGURE_BINARY=./$CONFIGURE_BASENAME
fi
fi
# Run the configuration
exec "${CONFIGURE_BINARY}" "$@"