2024-08-08 19:56:11 +00:00
" Utilities for working with file paths. "
2021-11-09 23:13:30 +00:00
load ( " //lib/private:paths.bzl " , " paths " )
relative_file = paths . relative_file
2022-06-13 18:53:04 +00:00
to_output_relative_path = paths . to_output_relative_path
2023-02-11 20:36:49 +00:00
to_repository_relative_path = paths . to_repository_relative_path
to_rlocation_path = paths . to_rlocation_path
2021-11-10 14:30:07 +00:00
# Bash helper function for looking up runfiles.
# See windows_utils.bzl for the cmd.exe equivalent.
2021-11-17 05:30:32 +00:00
# Vendored from
2021-11-10 14:30:07 +00:00
# https://github.com/bazelbuild/bazel/blob/master/tools/bash/runfiles/runfiles.bash
BASH_RLOCATION_FUNCTION = r """
2024-01-18 21:23:14 +00:00
# --- begin runfiles.bash initialization v3 ---
# Copy-pasted from the Bazel Bash runfiles library v3.
# https://github.com/bazelbuild/bazel/blob/master/tools/bash/runfiles/runfiles.bash
set - uo pipefail ; set + e ; f = bazel_tools / tools / bash / runfiles / runfiles . bash
2021-11-10 14:30:07 +00:00
source " $ { RUNFILES_DIR:-/dev/null}/$f " 2 > / dev / null | | \
2024-01-18 21:23:14 +00:00
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 | | \
2024-01-27 20:26:12 +00:00
{ echo > & 2 " ERROR: runfiles.bash initializer cannot find $f. An executable rule may have forgotten to expose it in the runfiles, or the binary may require RUNFILES_DIR to be set. " ; exit 1 ; } ; f = ; set - e
2024-01-18 21:23:14 +00:00
# --- end runfiles.bash initialization v3 ---
2021-11-10 14:30:07 +00:00
"""