bazel-lib/lib/paths.bzl

29 lines
1.2 KiB
Python

"Public API"
load("//lib/private:paths.bzl", "paths")
relative_file = paths.relative_file
to_output_relative_path = paths.to_output_relative_path
to_repository_relative_path = paths.to_repository_relative_path
to_rlocation_path = paths.to_rlocation_path
# deprecated namings
to_manifest_path = paths.to_manifest_path # equivalent to to_rlocation_path
to_workspace_path = paths.to_workspace_path # equivalent to to_repository_relative_path
# Bash helper function for looking up runfiles.
# See windows_utils.bzl for the cmd.exe equivalent.
# Vendored from
# https://github.com/bazelbuild/bazel/blob/master/tools/bash/runfiles/runfiles.bash
BASH_RLOCATION_FUNCTION = r"""
# --- begin runfiles.bash initialization v2 ---
set -uo pipefail; 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 v2 ---
"""