Skip to content

Commit

Permalink
Shorten the path used for the processor script.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
thomasvl authored and swiple-rules-gardener committed Feb 20, 2024
1 parent e240b74 commit 832646c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/apple_support.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -386,16 +386,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(
Expand Down

1 comment on commit 832646c

@keith
Copy link
Member

@keith keith commented on 832646c Mar 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.