Documentation Index
Fetch the complete documentation index at: https://docs.aspect.build/llms.txt
Use this file to discover all available pages before exploring further.
Documentation for @bazel_lib@v3.2.0 — View source
Function: relative_file
Resolves a relative path between two files, “to_file” and “frm_file”.
If neither of the paths begin with ../ it is assumed that they share the same root. When finding the relative path,
the incoming files are treated as actual files (not folders) so the resulting relative path may differ when compared
to passing the same arguments to python’s “os.path.relpath()” or NodeJs’s “path.relative()”.
For example, ‘relative_file(”../foo/foo.txt”, “bar/bar.txt”)’ will return ’../../foo/foo.txt’
Parameters
the path with file name to resolve to, from frm
the path with file name to resolve from
Function: to_output_relative_path
The relative path from bazel-out/[arch]/bin to the given File object
Parameters
a
File objectFile
Function: to_repository_relative_path
The repository relative path for a File
This is the full runfiles path of a File excluding its workspace name.
This differs from root path (a.k.a. short_path) and
rlocation path as it does not include the repository name if the File is from an external repository.
Parameters
a
File objectFile
Function: to_rlocation_path
The rlocation path for a File
This produces the same value as the rlocationpath predefined source/output path variable.
From https://bazel.build/reference/be/make-variables#predefined_genrule_variables:
rlocationpath: The path a built binary can pass to theRlocationfunction of a runfiles library to find a dependency at runtime, either in the runfiles directory (if available) or using the runfiles manifest.
This is similar to root path (a.k.a. short_path) in that it does not contain configuration prefixes, but differs in that it always starts with the name of the repository.
The rlocation path of aFilein an external repository repo will start withrepo/, followed by the repository-relative path.
Passing this path to a binary and resolving it to a file system path using the runfiles libraries is the preferred approach to find dependencies at runtime. Compared to root path, it has the advantage that it works on all platforms and even if the runfiles directory is not available.
Parameters
starlark rule execution context
a
File objectFile
