2022-04-14 17:48:44 +00:00
|
|
|
"Helpers for copy rules"
|
|
|
|
|
2023-10-31 22:19:38 +00:00
|
|
|
# Hints for Bazel spawn strategy
|
|
|
|
COPY_EXECUTION_REQUIREMENTS = {
|
2023-10-06 22:20:40 +00:00
|
|
|
# ----------------+-----------------------------------------------------------------------------
|
|
|
|
# no-sandbox | Results in the action or test never being sandboxed; it can still be cached
|
2023-10-31 20:38:32 +00:00
|
|
|
# | or run remotely.
|
2023-10-06 22:20:40 +00:00
|
|
|
# ----------------+-----------------------------------------------------------------------------
|
|
|
|
# See https://bazel.google.cn/reference/be/common-definitions?hl=en&authuser=0#common-attributes
|
|
|
|
#
|
2023-10-31 20:38:32 +00:00
|
|
|
# Sandboxing for this action is wasteful since there is a 1:1 mapping of input file/directory to
|
|
|
|
# output file/directory so little room for non-hermetic inputs to sneak in to the execution.
|
2023-10-06 22:20:40 +00:00
|
|
|
"no-sandbox": "1",
|
2022-04-14 17:48:44 +00:00
|
|
|
}
|
2023-02-06 04:47:02 +00:00
|
|
|
|
|
|
|
def progress_path(f):
|
|
|
|
"""
|
|
|
|
Convert a file to an appropriate string to display in an action progress message.
|
|
|
|
|
|
|
|
Args:
|
|
|
|
f: a file to show as a path in a progress message
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
The path formatted for use in a progress message
|
|
|
|
"""
|
|
|
|
return f.short_path.removeprefix("../")
|