Skip to content

Commit fb20967

Browse files
authored
Re-export runfiles env vars so that dependencies can use them (#1235)
1 parent 9d5727d commit fb20967

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

foreign_cc/private/runnable_binary_wrapper.sh

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
#!/usr/bin/env bash
22

3-
# --- begin runfiles.bash initialization v2 ---
4-
# Copy-pasted from the Bazel Bash runfiles library v2. (@bazel_tools//tools/bash/runfiles)
5-
set -uo pipefail; f=bazel_tools/tools/bash/runfiles/runfiles.bash
3+
# --- begin runfiles.bash initialization v3 ---
4+
# Copy-pasted from the Bazel Bash runfiles library v3.
5+
set -uo pipefail; set +e; f=bazel_tools/tools/bash/runfiles/runfiles.bash
66
source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \
7-
source "$(grep -sm1 "^$f " "${RUNFILES_MANIFEST_FILE:-/dev/null}" | cut -f2- -d' ')" 2>/dev/null || \
8-
source "$0.runfiles/$f" 2>/dev/null || \
9-
source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
10-
source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
11-
{ echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e
12-
# --- end runfiles.bash initialization v2 ---
7+
source "$(grep -sm1 "^$f " "${RUNFILES_MANIFEST_FILE:-/dev/null}" | cut -f2- -d' ')" 2>/dev/null || \
8+
source "$0.runfiles/$f" 2>/dev/null || \
9+
source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
10+
source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
11+
{ echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e
12+
# --- end runfiles.bash initialization v3 ---
13+
14+
runfiles_export_envvars
1315

1416
if [[ ! -d "${RUNFILES_DIR}" ]]; then
1517
>&2 echo "RUNFILES_DIR is set to '${RUNFILES_DIR}' which does not exist";

0 commit comments

Comments
 (0)