Skip to content

Commit

Permalink
add dsym_uses_parallel_linker
Browse files Browse the repository at this point in the history
Summary: Add the `dsym_uses_parallel_linker` attribute to be able to enable parallel dSYM generation for improved performance and reduced output size.

Reviewed By: maxovtsin

Differential Revision: D64131359

fbshipit-source-id: 5dd85aa3435cbecc544e9947a086518dfa9bb433
  • Loading branch information
rmaz authored and facebook-github-bot committed Oct 10, 2024
1 parent b856253 commit 6ed1173
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
17 changes: 10 additions & 7 deletions prelude/apple/apple_dsym.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,30 @@ def get_apple_dsym(ctx: AnalysisContext, executable: Artifact, debug_info: list[
def get_apple_dsym_ext(ctx: AnalysisContext, executable: [ArgLike, Artifact], debug_info: list[ArgLike], action_identifier: str, output_path: str) -> Artifact:
dsymutil = ctx.attrs._apple_toolchain[AppleToolchainInfo].dsymutil
output = ctx.actions.declare_output(output_path, dir = True)

cmd = cmd_args(
[
dsymutil,
"--verify-dwarf={}".format(ctx.attrs._dsymutil_verify_dwarf),
# Reproducers are not useful, we can reproduce from the action digest.
"--reproducer=Off",
] + ctx.attrs._dsymutil_extra_flags + [
"-o",
output.as_output(),
],
executable,
# Mach-O executables don't contain DWARF data.
# Instead, they contain paths to the object files which themselves contain DWARF data.
#
# So, those object files are needed for dsymutil to be to create the dSYM bundle.
hidden = debug_info,
)
if ctx.attrs.dsym_uses_parallel_linker:
cmd.add("--linker=parallel")

cmd.add(ctx.attrs._dsymutil_extra_flags)
cmd.add(
[
"-o",
output.as_output(),
executable,
],
)
ctx.actions.run(cmd, category = "apple_dsym", identifier = action_identifier)

return output

def get_apple_dsym_info_json(binary_dsyms: list[Artifact], dep_dsyms: list[Artifact]) -> dict[str, typing.Any]:
Expand Down
1 change: 1 addition & 0 deletions prelude/apple/apple_rules_impl_utility.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ APPLE_VALIDATION_DEPS_ATTR_TYPE = attrs.set(attrs.dep(), sorted = True, default

def apple_dsymutil_attrs():
return {
"dsym_uses_parallel_linker": attrs.bool(default = False),
"_dsymutil_extra_flags": attrs.list(attrs.string()),
"_dsymutil_verify_dwarf": attrs.string(),
}
Expand Down

0 comments on commit 6ed1173

Please sign in to comment.