diff options
author | Keith Smiley <keithbsmiley@gmail.com> | 2024-03-04 09:50:17 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-04 12:50:17 -0500 |
commit | 55c77014c71f4965863f475e033541c621dfbda0 (patch) | |
tree | 1880dba1ca9b57889414898b3b368d33a51a1277 | |
parent | 6f6dc0259fb7dd065fc1dfca90a4ebac3adac797 (diff) | |
download | bazelbuild-apple_support-55c77014c71f4965863f475e033541c621dfbda0.tar.gz |
Shorten the path used for the processor script. (#311)
Use a hash of the first output rather than the full path so it is
less likely to hit path limits when the target where the helper is
used is also deep in a directory structure.
PiperOrigin-RevId: 608607365
(cherry picked from commit 832646cefde1d9166389ccec1ea02af126fc687e)
Co-authored-by: Thomas Van Lenten <thomasvl@google.com>
-rw-r--r-- | lib/apple_support.bzl | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/apple_support.bzl b/lib/apple_support.bzl index 94cdafa..155378b 100644 --- a/lib/apple_support.bzl +++ b/lib/apple_support.bzl @@ -391,16 +391,19 @@ def _run( return # Since a label/name isn't passed in, use the first output to derive a name - # that will hopefully be unique. For added attempt at safety, name the file - # based on the content, so any dup actions might still merge. - base = kwargs.get("outputs")[0].short_path.replace("/", "_") + # that will hopefully be unique. + output0 = kwargs.get("outputs")[0] if xcode_path_resolve_level == _XCODE_PATH_RESOLVE_LEVEL.args: script = _XCODE_PROCESSOR__ARGS suffix = "args" else: script = _XCODE_PROCESSOR__ARGS_AND_FILES suffix = "args_and_files" - processor_script = actions.declare_file("{}_processor_script_{}.sh".format(base, suffix)) + processor_script = actions.declare_file("{}_{}_processor_script_{}.sh".format( + output0.basename, + hash(output0.short_path), + suffix, + )) actions.write(processor_script, script, is_executable = True) processed_kwargs = _kwargs_for_apple_platform( |