Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix DWARF binary not copied for AppleDsymBundleInfo #2396

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions apple/internal/partials/debug_symbols.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def _collect_linkmaps(

return outputs

def _copy_dsyms_into_declared_bundle(
def _generate_dsym_binaries(
*,
actions,
debug_output_filename,
Expand Down Expand Up @@ -303,13 +303,21 @@ def _bundle_dsym_files(
found_binaries_by_arch.update(dsym_binaries)

if found_binaries_by_arch:
output_files = _copy_dsyms_into_declared_bundle(
generated_dsym_binaries = _generate_dsym_binaries(
actions = actions,
debug_output_filename = dsym_output_filename,
dsym_bundle_name = dsym_bundle_name,
found_binaries_by_arch = found_binaries_by_arch,
platform_prerequisites = platform_prerequisites,
)
output_files.extend(generated_dsym_binaries)
dsyms_command = (" && ".join([
"cp \"{dsym_path}\" \"${{OUTPUT_DIR}}/Contents/Resources/DWARF/{dsym_bundle_name}\"".format(
dsym_path = dsym_binary.path,
dsym_bundle_name = dsym_output_filename,
)
for dsym_binary in generated_dsym_binaries
]))

# If we found any binaries, create the Info.plist for the bundle as well.
dsym_plist = _generate_dsym_info_plist(
Expand All @@ -334,9 +342,9 @@ def _bundle_dsym_files(
apple_support.run_shell(
actions = actions,
apple_fragment = platform_prerequisites.apple_fragment,
inputs = [dsym_plist] + found_binaries_by_arch.values(),
inputs = generated_dsym_binaries + [dsym_plist] + found_binaries_by_arch.values(),
outputs = [dsym_bundle_dir],
command = ("mkdir -p \"${OUTPUT_DIR}/Contents/Resources/DWARF\" && " + plist_command),
command = ("mkdir -p \"${OUTPUT_DIR}/Contents/Resources/DWARF\" && " + dsyms_command + " && " + plist_command),
env = {
"OUTPUT_DIR": dsym_bundle_dir.path,
},
Expand Down
4 changes: 4 additions & 0 deletions test/starlark_tests/xcarchive_tests.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ def xcarchive_test_suite(name):
target_under_test = "//test/starlark_tests/targets_under_test/ios:app_minimal.xcarchive",
contains = [
"$BUNDLE_ROOT/dSYMs/app_minimal.app.dSYM",
"$BUNDLE_ROOT/dSYMs/app_minimal.app.dSYM/Contents/Resources/DWARF/app_minimal",
"$BUNDLE_ROOT/dSYMs/app_minimal.app.dSYM/Contents/Info.plist",
"$BUNDLE_ROOT/Info.plist",
"$BUNDLE_ROOT/Products/Applications/app_minimal.app",
],
Expand All @@ -76,6 +78,8 @@ def xcarchive_test_suite(name):
contains = [
"$BUNDLE_ROOT/dSYMs/app_with_ext_space_in_path.app.dSYM",
"$BUNDLE_ROOT/dSYMs/ext with space.appex.dSYM",
"$BUNDLE_ROOT/dSYMs/ext with space.appex.dSYM/Contents/Resources/DWARF/ext with space",
"$BUNDLE_ROOT/dSYMs/ext with space.appex.dSYM/Contents/Info.plist",
"$BUNDLE_ROOT/Info.plist",
"$BUNDLE_ROOT/Products/Applications/app_with_ext_space_in_path.app",
],
Expand Down