#!/bin/bash set -e # TODO should this be extracted to shared init script # Get the directory where the script is located if [[ -z "${RUNFILES_DIR:-}" ]]; then SCRIPT_DIR="$(readlink -f "${BASH_SOURCE[0]}")" # Set RUNFILES_DIR relative to the script location export RUNFILES_DIR="${SCRIPT_DIR}.runfiles" fi # --- 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 --- # 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 CONFIGURE_BINARY="$(rlocation "_main/$(basename "%{CONFIGURE_PATH}")")" # Run the configuration exec "${CONFIGURE_BINARY}" "$@"