2
0
Fork 0
mirror of https://github.com/bazel-contrib/bazel-lib synced 2024-12-04 14:02:23 +00:00
bazel-lib/docs/paths.md
2022-02-11 07:52:01 -08:00

2.2 KiB

Public API

relative_file

relative_file(to_file, frm_file)

Resolves a relative path between two files, "to_file" and "frm_file", they must share the same root

PARAMETERS

Name Description Default Value
to_file the path with file name to resolve to, from frm none
frm_file the path with file name to resolve from none

RETURNS

The relative path from frm_file to to_file, including the file name

to_manifest_path

to_manifest_path(ctx, file)

The runfiles manifest entry path for a file

This is the full runfiles path of a file including its workspace name as the first segment. We refert to it as the manifest path as it is the path flavor that is used for in the runfiles MANIFEST file.

We must avoid using non-normalized paths (workspace/../other_workspace/path) in order to locate entries by their key.

PARAMETERS

Name Description Default Value
ctx starlark rule execution context none
file a File object none

RETURNS

The runfiles manifest entry path for a file

to_workspace_path

to_workspace_path(file)

The workspace relative path for a file

This is the full runfiles path of a file excluding its workspace name. This differs from root path and manifest path as it does not include the repository name if the file is from an external repository.

PARAMETERS

Name Description Default Value
file a File object none

RETURNS

The workspace relative path for a file