diff --git a/apple/BUILD b/apple/BUILD index cf151a306a..0b6b410617 100644 --- a/apple/BUILD +++ b/apple/BUILD @@ -73,6 +73,7 @@ bzl_library( name = "apple_binary", srcs = ["apple_binary.bzl"], deps = [ + "//apple/internal:apple_toolchains", "//apple/internal:linking_support", "//apple/internal:rule_attrs", "//apple/internal:rule_factory", diff --git a/apple/apple_binary.bzl b/apple/apple_binary.bzl index 6fba3459cb..c1a81af745 100644 --- a/apple/apple_binary.bzl +++ b/apple/apple_binary.bzl @@ -18,6 +18,11 @@ load( "@build_bazel_apple_support//lib:apple_support.bzl", "apple_support", ) +load( + "//apple/internal:apple_toolchains.bzl", + "AppleXPlatToolsToolchainInfo", + "apple_toolchain_utils", +) load( "//apple/internal:linking_support.bzl", "linking_support", @@ -67,6 +72,7 @@ visionOS binaries require a visionOS SDK provided by Xcode 15.1 beta or later. Resolved Xcode is version {xcode_version}. """.format(xcode_version = str(xcode_version_config.xcode_version()))) + apple_xplat_toolchain_info = ctx.attr._xplat_toolchain[AppleXPlatToolsToolchainInfo] binary_type = ctx.attr.binary_type bundle_loader = ctx.attr.bundle_loader cc_toolchain_forwarder = ctx.split_attr._cc_toolchain_forwarder @@ -97,6 +103,7 @@ Resolved Xcode is version {xcode_version}. link_result = linking_support.register_binary_linking_action( ctx, cc_toolchains = cc_toolchain_forwarder, + build_settings = apple_xplat_toolchain_info.build_settings, bundle_loader = bundle_loader, exported_symbols_lists = ctx.files.exported_symbols_lists, extra_linkopts = extra_linkopts, @@ -152,6 +159,7 @@ implementation of `apple_binary` in Bazel core so that it can be removed. implementation = _apple_binary_impl, attrs = [ apple_support.platform_constraint_attrs(), + apple_toolchain_utils.shared_attrs(), rule_attrs.binary_linking_attrs( deps_cfg = transition_support.apple_platform_split_transition, is_test_supporting_rule = False, diff --git a/apple/build_settings/build_settings.bzl b/apple/build_settings/build_settings.bzl index 510003609c..86be205b38 100644 --- a/apple/build_settings/build_settings.bzl +++ b/apple/build_settings/build_settings.bzl @@ -58,6 +58,14 @@ physical devices) or `xcrun simctl list devices` (for simulators). """, default = "", ), + "dsym_variant_flag": struct( + doc = """ +Controls the output format for dSYM debug symbols. Valid values are: +- "flat": Outputs individual dSYM files as additional outputs from the target. +- "bundle": Outputs dSYM bundles as directories. +""", + default = "flat", + ), } # List of all registered build settings without command line flags at diff --git a/apple/internal/BUILD b/apple/internal/BUILD index e98884d67b..fb79217628 100644 --- a/apple/internal/BUILD +++ b/apple/internal/BUILD @@ -202,6 +202,8 @@ bzl_library( "//apple:__subpackages__", ], deps = [ + ":fragment_support", + ":outputs", ":platform_support", "@bazel_skylib//lib:paths", "@rules_cc//cc/common", @@ -261,6 +263,14 @@ bzl_library( ], ) +bzl_library( + name = "fragment_support", + srcs = ["fragment_support.bzl"], + visibility = [ + "//apple:__subpackages__", + ], +) + bzl_library( name = "framework_import_support", srcs = ["framework_import_support.bzl"], @@ -345,6 +355,7 @@ bzl_library( ":compilation_support", ":entitlements_support", ":intermediates", + ":outputs", ":providers", ":rule_support", "@bazel_skylib//lib:collections", @@ -432,6 +443,7 @@ bzl_library( ], deps = [ ":experimental", + ":fragment_support", ":intermediates", "@bazel_skylib//lib:paths", ], diff --git a/apple/internal/apple_framework_import.bzl b/apple/internal/apple_framework_import.bzl index 102c7d2d94..bf1ae1f6b3 100644 --- a/apple/internal/apple_framework_import.bzl +++ b/apple/internal/apple_framework_import.bzl @@ -245,12 +245,8 @@ def _apple_dynamic_framework_import_impl(ctx): providers.append(cc_info) # Create AppleDynamicFramework provider. - framework_groups = _grouped_framework_files(framework_imports) - framework_dirs_set = depset(framework_groups.keys()) providers.append(new_appledynamicframeworkinfo( cc_info = cc_info, - framework_dirs = framework_dirs_set, - framework_files = depset(framework_imports), )) if "apple._import_framework_via_swiftinterface" in features and framework.swift_interface_imports: diff --git a/apple/internal/compilation_support.bzl b/apple/internal/compilation_support.bzl index 6950c21003..f2b1ace030 100644 --- a/apple/internal/compilation_support.bzl +++ b/apple/internal/compilation_support.bzl @@ -22,6 +22,14 @@ load( "@rules_cc//cc/common:cc_common.bzl", "cc_common", ) +load( + "//apple/internal:fragment_support.bzl", + "fragment_support", +) +load( + "//apple/internal:outputs.bzl", + "outputs", +) load( "//apple/internal:platform_support.bzl", "platform_support", @@ -163,10 +171,12 @@ def _register_binary_strip_action( "-bundle" in extra_link_args or link_bundle or "-kext" in extra_link_args): strip_safe = True - # TODO(b/331163513): Use intermediates.file() instead of declare_shareable_artifact(). - stripped_binary = ctx.actions.declare_shareable_artifact( - paths.join(ctx.label.package, name), - apple_platform_info.target_build_config.bin_dir, + stripped_binary = outputs.main_binary( + actions = ctx.actions, + apple_platform_info = apple_platform_info, + cpp_fragment = ctx.fragments.cpp, + label = ctx.label, + unstripped = False, ) args = ctx.actions.args() args.add("strip") @@ -240,9 +250,6 @@ def _classify_libraries(libraries_to_link): } return always_link_libraries.keys(), as_needed_libraries.keys() -def _emit_builtin_objc_strip_action(ctx): - return ctx.fragments.cpp.objc_should_strip_binary - def _register_configuration_specific_link_actions( *, additional_outputs, @@ -268,23 +275,19 @@ def _register_configuration_specific_link_actions( ctx = common_variables.ctx feature_configuration = _build_feature_configuration(common_variables) - # When compilation_mode=opt and objc_enable_binary_stripping are specified, the unstripped - # binary containing debug symbols is generated by the linker, which also needs the debug - # symbols for dead-code removal. The binary is also used to generate dSYM bundle if - # --apple_generate_dsym is specified. A symbol strip action is later registered to strip - # the symbol table from the unstripped binary. - if _emit_builtin_objc_strip_action(ctx): - # TODO(b/331163513): Use intermediates.file() instead of declare_shareable_artifact(). - binary = ctx.actions.declare_shareable_artifact( - paths.join(ctx.label.package, name + "_unstripped"), - apple_platform_info.target_build_config.bin_dir, - ) + # TODO: Remove hasattr check when we drop Bazel 8 + if hasattr(ctx.fragments.objc, "builtin_objc_strip_action"): + unstripped = ctx.fragments.objc.builtin_objc_strip_action else: - # TODO(b/331163513): Use intermediates.file() instead of declare_shareable_artifact(). - binary = ctx.actions.declare_shareable_artifact( - paths.join(ctx.label.package, name), - apple_platform_info.target_build_config.bin_dir, - ) + unstripped = False + + binary = outputs.main_binary( + actions = ctx.actions, + apple_platform_info = apple_platform_info, + cpp_fragment = ctx.fragments.cpp, + label = ctx.label, + unstripped = unstripped, + ) # TODO: Delete feature check and else branch when we drop Bazel 8 support (see f4a3fa40) if cc_common.is_enabled( @@ -374,7 +377,12 @@ def _register_configuration_specific_link_actions_with_cpp_variables( variables_extension = user_variable_extensions, ) - if _emit_builtin_objc_strip_action(ctx): + # TODO: Remove hasattr check when we drop Bazel 8 + if hasattr(ctx.fragments.objc, "builtin_objc_strip_action") and \ + fragment_support.is_objc_strip_action_enabled( + cpp_fragment = ctx.fragments.cpp, + ) and \ + ctx.fragments.objc.builtin_objc_strip_action: return _register_binary_strip_action( ctx = ctx, apple_platform_info = apple_platform_info, @@ -554,17 +562,7 @@ def _register_configuration_specific_link_actions_with_objc_variables( main_output = binary, ) - if _emit_builtin_objc_strip_action(ctx): - return _register_binary_strip_action( - apple_platform_info = apple_platform_info, - binary = binary, - ctx = ctx, - extra_link_args = extra_link_args, - feature_configuration = feature_configuration, - name = name, - ) - else: - return binary + return binary compilation_support = struct( # TODO(b/331163513): Move apple_common.compliation_support.build_common_variables here, too. diff --git a/apple/internal/features_support.bzl b/apple/internal/features_support.bzl index aff81f9361..5c5029270e 100644 --- a/apple/internal/features_support.bzl +++ b/apple/internal/features_support.bzl @@ -15,6 +15,7 @@ """Support macros to assist in detecting build features.""" load("@bazel_skylib//lib:new_sets.bzl", "sets") +load("@rules_cc//cc/common:cc_common.bzl", "cc_common") def _compute_enabled_features(*, requested_features, unsupported_features): """Returns a list of features for the given build. @@ -33,6 +34,21 @@ def _compute_enabled_features(*, requested_features, unsupported_features): ) return sets.to_list(enabled_features_set) +def _make_cc_configured_features_init(ctx): + """Captures the rule ctx for a deferred `cc_common.configure_features(...)` call. + + Args: + ctx: The rule context, expected to be captured directly in the rule context and NOT within a + partial or helper method. + + Returns: + A lambda that has the captured instance of the rule context, which will always set that rule + context as the `ctx` argument of `cc_common.configure_features(...)` and will forward any + arguments it is given to `cc_common.configure_features(...)`. + """ + return lambda *args, **kwargs: cc_common.configure_features(ctx = ctx, *args, **kwargs) + features_support = struct( compute_enabled_features = _compute_enabled_features, + make_cc_configured_features_init = _make_cc_configured_features_init, ) diff --git a/apple/internal/fragment_support.bzl b/apple/internal/fragment_support.bzl new file mode 100644 index 0000000000..34797eec7f --- /dev/null +++ b/apple/internal/fragment_support.bzl @@ -0,0 +1,31 @@ +# Copyright 2025 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Wrapper to centralize configuration of fragment-based logic.""" + +visibility([ + "//apple/...", + "//test/...", +]) + +def _is_objc_strip_action_enabled(*, cpp_fragment): + """Returns wheither the Objective-C strip action is active.""" + return ( + cpp_fragment.objc_enable_binary_stripping() and + cpp_fragment.compilation_mode() == "opt" + ) + +fragment_support = struct( + is_objc_strip_action_enabled = _is_objc_strip_action_enabled, +) diff --git a/apple/internal/ios_rules.bzl b/apple/internal/ios_rules.bzl index e020315c96..8d1cd03a3d 100644 --- a/apple/internal/ios_rules.bzl +++ b/apple/internal/ios_rules.bzl @@ -248,6 +248,7 @@ def _ios_application_impl(ctx): ctx, cc_toolchains = cc_toolchain_forwarder, avoid_deps = ctx.attr.frameworks, + build_settings = apple_xplat_toolchain_info.build_settings, entitlements = entitlements.linking, exported_symbols_lists = ctx.files.exported_symbols_lists, extra_linkopts = extra_linkopts, @@ -342,9 +343,8 @@ def _ios_application_impl(ctx): bundle_extension = bundle_extension, bundle_name = bundle_name, debug_dependencies = embeddable_targets + ctx.attr.deps, - dsym_binaries = debug_outputs.dsym_binaries, dsym_info_plist_template = apple_mac_toolchain_info.dsym_info_plist_template, - executable_name = executable_name, + dsym_outputs = debug_outputs.dsym_outputs, label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, @@ -408,7 +408,7 @@ def _ios_application_impl(ctx): actions = actions, binary_artifact = binary_artifact, dependency_targets = embeddable_targets + ctx.attr.deps, - dsym_binaries = debug_outputs.dsym_binaries, + dsym_outputs = debug_outputs.dsym_outputs, label_name = label.name, include_symbols_in_bundle = ctx.attr.include_symbols_in_bundle, platform_prerequisites = platform_prerequisites, @@ -514,7 +514,10 @@ def _ios_application_impl(ctx): rule_descriptor = rule_descriptor, ) - dsyms = outputs.dsyms(processor_result = processor_result) + dsyms = outputs.dsyms( + platform_prerequisites = platform_prerequisites, + processor_result = processor_result, + ) return [ # TODO(b/121155041): Should we do the same for ios_framework and ios_extension? @@ -624,6 +627,7 @@ def _ios_app_clip_impl(ctx): ctx, cc_toolchains = cc_toolchain_forwarder, avoid_deps = ctx.attr.frameworks, + build_settings = apple_xplat_toolchain_info.build_settings, entitlements = entitlements.linking, exported_symbols_lists = ctx.files.exported_symbols_lists, platform_prerequisites = platform_prerequisites, @@ -707,9 +711,8 @@ def _ios_app_clip_impl(ctx): bundle_extension = bundle_extension, bundle_name = bundle_name, debug_dependencies = embeddable_targets + ctx.attr.deps, - dsym_binaries = debug_outputs.dsym_binaries, + dsym_outputs = debug_outputs.dsym_outputs, dsym_info_plist_template = apple_mac_toolchain_info.dsym_info_plist_template, - executable_name = executable_name, label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, @@ -766,7 +769,7 @@ def _ios_app_clip_impl(ctx): actions = actions, binary_artifact = binary_artifact, dependency_targets = embeddable_targets + ctx.attr.deps, - dsym_binaries = debug_outputs.dsym_binaries, + dsym_outputs = debug_outputs.dsym_outputs, label_name = label.name, include_symbols_in_bundle = False, platform_prerequisites = platform_prerequisites, @@ -881,7 +884,6 @@ def _ios_framework_impl(ctx): actions = ctx.actions apple_mac_toolchain_info = ctx.attr._mac_toolchain[AppleMacToolsToolchainInfo] apple_xplat_toolchain_info = ctx.attr._xplat_toolchain[AppleXPlatToolsToolchainInfo] - bin_root_path = ctx.bin_dir.path bundle_name, bundle_extension = bundling_support.bundle_full_name( custom_bundle_name = ctx.attr.bundle_name, label_name = ctx.label.name, @@ -896,13 +898,6 @@ def _ios_framework_impl(ctx): ) cc_toolchain = find_cc_toolchain(ctx) cc_toolchain_forwarder = ctx.split_attr._cc_toolchain_forwarder - cc_features = cc_common.configure_features( - ctx = ctx, - cc_toolchain = cc_toolchain, - language = "objc", - requested_features = ctx.features, - unsupported_features = ctx.disabled_features, - ) executable_name = ctx.attr.executable_name features = features_support.compute_enabled_features( requested_features = ctx.features, @@ -956,6 +951,7 @@ def _ios_framework_impl(ctx): ctx, cc_toolchains = cc_toolchain_forwarder, avoid_deps = ctx.attr.frameworks, + build_settings = apple_xplat_toolchain_info.build_settings, # Frameworks do not have entitlements. entitlements = None, exported_symbols_lists = ctx.files.exported_symbols_lists, @@ -1038,9 +1034,8 @@ def _ios_framework_impl(ctx): bundle_extension = bundle_extension, bundle_name = bundle_name, debug_dependencies = ctx.attr.frameworks + ctx.attr.deps, - dsym_binaries = debug_outputs.dsym_binaries, + dsym_outputs = debug_outputs.dsym_outputs, dsym_info_plist_template = apple_mac_toolchain_info.dsym_info_plist_template, - executable_name = executable_name, label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, @@ -1062,13 +1057,13 @@ def _ios_framework_impl(ctx): partials.framework_headers_partial(hdrs = ctx.files.hdrs), partials.framework_provider_partial( actions = actions, - bin_root_path = bin_root_path, binary_artifact = binary_artifact, - bundle_name = bundle_name, bundle_only = ctx.attr.bundle_only, - cc_features = cc_features, + cc_configured_features_init = features_support.make_cc_configured_features_init(ctx), cc_info = link_result.cc_info, cc_toolchain = cc_toolchain, + features = features, + disabled_features = ctx.disabled_features, rule_label = label, ), partials.resources_partial( @@ -1102,7 +1097,7 @@ def _ios_framework_impl(ctx): actions = actions, binary_artifact = binary_artifact, dependency_targets = ctx.attr.frameworks, - dsym_binaries = debug_outputs.dsym_binaries, + dsym_outputs = debug_outputs.dsym_outputs, label_name = label.name, include_symbols_in_bundle = False, platform_prerequisites = platform_prerequisites, @@ -1233,6 +1228,7 @@ def _ios_extension_impl(ctx): ctx, cc_toolchains = cc_toolchain_forwarder, avoid_deps = ctx.attr.frameworks, + build_settings = apple_xplat_toolchain_info.build_settings, entitlements = entitlements.linking, exported_symbols_lists = ctx.files.exported_symbols_lists, extra_linkopts = extra_linkopts, @@ -1342,9 +1338,8 @@ def _ios_extension_impl(ctx): bundle_extension = bundle_extension, bundle_name = bundle_name, debug_dependencies = ctx.attr.frameworks + ctx.attr.deps, - dsym_binaries = debug_outputs.dsym_binaries, + dsym_outputs = debug_outputs.dsym_outputs, dsym_info_plist_template = apple_mac_toolchain_info.dsym_info_plist_template, - executable_name = executable_name, label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, @@ -1394,7 +1389,7 @@ def _ios_extension_impl(ctx): actions = actions, binary_artifact = binary_artifact, dependency_targets = ctx.attr.frameworks, - dsym_binaries = debug_outputs.dsym_binaries, + dsym_outputs = debug_outputs.dsym_outputs, label_name = label.name, include_symbols_in_bundle = False, platform_prerequisites = platform_prerequisites, @@ -1472,7 +1467,6 @@ def _ios_dynamic_framework_impl(ctx): actions = ctx.actions apple_mac_toolchain_info = ctx.attr._mac_toolchain[AppleMacToolsToolchainInfo] apple_xplat_toolchain_info = ctx.attr._xplat_toolchain[AppleXPlatToolsToolchainInfo] - bin_root_path = ctx.bin_dir.path bundle_id = ctx.attr.bundle_id bundle_name, bundle_extension = bundling_support.bundle_full_name( custom_bundle_name = ctx.attr.bundle_name, @@ -1548,6 +1542,7 @@ def _ios_dynamic_framework_impl(ctx): ctx, cc_toolchains = cc_toolchain_forwarder, avoid_deps = ctx.attr.frameworks, + build_settings = apple_xplat_toolchain_info.build_settings, # Frameworks do not have entitlements. entitlements = None, exported_symbols_lists = ctx.files.exported_symbols_lists, @@ -1628,9 +1623,8 @@ def _ios_dynamic_framework_impl(ctx): bundle_extension = bundle_extension, bundle_name = bundle_name, debug_dependencies = ctx.attr.frameworks, - dsym_binaries = debug_outputs.dsym_binaries, + dsym_outputs = debug_outputs.dsym_outputs, dsym_info_plist_template = apple_mac_toolchain_info.dsym_info_plist_template, - executable_name = executable_name, label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, @@ -1651,13 +1645,13 @@ def _ios_dynamic_framework_impl(ctx): ), partials.framework_provider_partial( actions = actions, - bin_root_path = bin_root_path, binary_artifact = binary_artifact, - bundle_name = bundle_name, bundle_only = False, - cc_features = cc_features, + cc_configured_features_init = features_support.make_cc_configured_features_init(ctx), cc_info = link_result.cc_info, cc_toolchain = cc_toolchain, + features = features, + disabled_features = ctx.disabled_features, rule_label = label, ), partials.resources_partial( @@ -2184,6 +2178,7 @@ def _ios_imessage_extension_impl(ctx): ctx, cc_toolchains = cc_toolchain_forwarder, avoid_deps = ctx.attr.frameworks, + build_settings = apple_xplat_toolchain_info.build_settings, entitlements = entitlements.linking, exported_symbols_lists = ctx.files.exported_symbols_lists, extra_linkopts = extra_linkopts, @@ -2279,9 +2274,8 @@ def _ios_imessage_extension_impl(ctx): bundle_extension = bundle_extension, bundle_name = bundle_name, debug_dependencies = ctx.attr.frameworks, - dsym_binaries = debug_outputs.dsym_binaries, + dsym_outputs = debug_outputs.dsym_outputs, dsym_info_plist_template = apple_mac_toolchain_info.dsym_info_plist_template, - executable_name = executable_name, label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, diff --git a/apple/internal/linking_support.bzl b/apple/internal/linking_support.bzl index cd25702993..f6ff060a2c 100644 --- a/apple/internal/linking_support.bzl +++ b/apple/internal/linking_support.bzl @@ -37,6 +37,10 @@ load( "//apple/internal:multi_arch_binary_support.bzl", "subtract_linking_contexts", ) +load( + "//apple/internal:outputs.bzl", + "outputs", +) load( "//apple/internal:providers.bzl", "AppleDynamicFrameworkInfo", @@ -146,11 +150,13 @@ def _link_multi_arch_binary( *, ctx, avoid_deps, + build_settings, cc_toolchains, extra_linkopts, extra_link_inputs, extra_requested_features, extra_disabled_features, + rule_descriptor, stamp): """Links a (potentially multi-architecture) binary targeting Apple platforms. @@ -168,6 +174,7 @@ def _link_multi_arch_binary( dependencies that will be found at runtime in another image, such as the bundle loader or any dynamic libraries/frameworks that will be loaded by this binary. + build_settings: A struct with build settings info from AppleXplatToolsToolchainInfo. cc_toolchains: Dictionary of CcToolchainInfo and ApplePlatformInfo providers under a split transition to relay target platform information for related deps. extra_linkopts: A list of strings: Extra linkopts to add to the linking action. @@ -176,6 +183,9 @@ def _link_multi_arch_binary( to the linker action. extra_disabled_features: A list of strings: Extra disabled features to be passed to the linker action. + rule_descriptor: The rule descriptor if one exists for the given rule. For convenience, This + will define additional parameters required for linking, such as the dSYM bundle name. If + `None`, these additional parameters will not be set on the linked binary. stamp: Whether to include build information in the linked binary. If 1, build information is always included. If 0, build information is always excluded. If -1 (the default), then the behavior is determined by the --[no]stamp @@ -217,7 +227,7 @@ def _link_multi_arch_binary( avoid_cc_infos.extend([dep[CcInfo] for dep in avoid_deps if CcInfo in dep]) avoid_cc_linking_contexts = [dep.linking_context for dep in avoid_cc_infos] - outputs = [] + linker_outputs = [] cc_infos = [] legacy_debug_outputs = {} @@ -277,21 +287,52 @@ def _link_multi_arch_binary( additional_outputs = [] extensions = {} - dsym_binary = None + dsym_output = None if ctx.fragments.cpp.apple_generate_dsym: - if ctx.fragments.cpp.objc_should_strip_binary: - suffix = "_bin_unstripped.dwarf" + dsym_variants = build_settings.dsym_variant_flag + if dsym_variants == "bundle": + if rule_descriptor: + dsym_bundle_name = ctx.label.name + rule_descriptor.bundle_extension + else: + dsym_bundle_name = ctx.label.name + + # Avoiding "intermediates" as this will be the canonical dSYM in a single arch build + dsym_output = ctx.actions.declare_directory( + "{split_transition_key}/{dsym_bundle_name}.dSYM".format( + split_transition_key = split_transition_key, + dsym_bundle_name = dsym_bundle_name, + ), + ) + elif dsym_variants != "flat": + fail(""" +Internal Error: Found unsupported dsym_variant_flag: {dsym_variants}. + +Please report this as a bug to the Apple BUILD Rules team. + """.format( + dsym_variants = dsym_variants, + )) else: - suffix = "_bin.dwarf" - dsym_binary = intermediates.file( - actions = ctx.actions, - target_name = ctx.label.name, - output_discriminator = split_transition_key, - file_name = ctx.label.name + suffix, - ) - extensions["dsym_path"] = dsym_binary.path # dsym symbol file - additional_outputs.append(dsym_binary) - legacy_debug_outputs.setdefault(platform_info.target_arch, {})["dsym_binary"] = dsym_binary + main_binary_unstripped_basename = outputs.main_binary_basename( + cpp_fragment = ctx.fragments.cpp, + label_name = ctx.label.name, + unstripped = True, + ) + dsym_output = intermediates.file( + actions = ctx.actions, + target_name = ctx.label.name, + output_discriminator = split_transition_key, + file_name = "{}.dwarf".format(main_binary_unstripped_basename), + ) + + # TODO(b/391401130): Remove this once all users are migrated to the downstream + # provider AppleDsymBundleInfo. + legacy_debug_outputs.setdefault( + platform_info.target_arch, + {}, + )["dsym_binary"] = dsym_output + + extensions["dsym_path"] = dsym_output.path # dsym symbol file + additional_outputs.append(dsym_output) linkmap = None if ctx.fragments.cpp.objc_generate_linkmap: @@ -305,7 +346,12 @@ def _link_multi_arch_binary( additional_outputs.append(linkmap) legacy_debug_outputs.setdefault(platform_info.target_arch, {})["linkmap"] = linkmap - name = ctx.label.name + "_bin" + main_binary_basename = outputs.main_binary_basename( + cpp_fragment = ctx.fragments.cpp, + label_name = ctx.label.name, + unstripped = False, + ) + executable = compilation_support.register_configuration_specific_link_actions( additional_outputs = additional_outputs, apple_platform_info = platform_info, @@ -314,7 +360,7 @@ def _link_multi_arch_binary( common_variables = common_variables, extra_link_args = extra_linkopts, extra_link_inputs = extra_link_inputs, - name = name, + name = main_binary_basename, # TODO: Delete when we drop Bazel 8 support (see f4a3fa40) split_transition_key = split_transition_key, stamp = stamp, @@ -326,11 +372,11 @@ def _link_multi_arch_binary( "platform": platform_info.target_os, "architecture": platform_info.target_arch, "environment": platform_info.target_environment, - "dsym_binary": dsym_binary, + "dsym_output": dsym_output, "linkmap": linkmap, } - outputs.append(struct(**output)) + linker_outputs.append(struct(**output)) header_tokens = [] for _, deps in split_deps.items(): @@ -343,7 +389,7 @@ def _link_multi_arch_binary( return struct( cc_info = cc_common.merge_cc_infos(direct_cc_infos = cc_infos), output_groups = output_groups, - outputs = outputs, + outputs = linker_outputs, debug_outputs_provider = new_appledebugoutputsinfo(outputs_map = legacy_debug_outputs), ) @@ -357,20 +403,20 @@ def _debug_outputs_by_architecture(link_outputs): Returns: A `struct` containing three fields: - * `dsym_binaries`: A mapping of architectures to Files representing dSYM binary outputs - for each architecture. + * `dsym_outputs`: A mapping of architectures to Files representing dSYM outputs for each + architecture. * `linkmaps`: A mapping of architectures to Files representing linkmaps for each architecture. """ - dsym_binaries = {} + dsym_outputs = {} linkmaps = {} for link_output in link_outputs: - dsym_binaries[link_output.architecture] = link_output.dsym_binary + dsym_outputs[link_output.architecture] = link_output.dsym_output linkmaps[link_output.architecture] = link_output.linkmap return struct( - dsym_binaries = dsym_binaries, + dsym_outputs = dsym_outputs, linkmaps = linkmaps, ) @@ -416,6 +462,7 @@ def _register_binary_linking_action( ctx, *, avoid_deps = [], + build_settings, bundle_loader = None, cc_toolchains, entitlements = None, @@ -436,6 +483,7 @@ def _register_binary_linking_action( ctx: The rule context. avoid_deps: A list of `Target`s representing dependencies of the binary but whose symbols should not be linked into it. + build_settings: A struct with build settings info from AppleXplatToolsToolchainInfo. bundle_loader: For Mach-O bundles, the `Target` whose binary will load this bundle. This target must propagate the `AppleExecutableBinaryInfo` provider. This simplifies the process of passing the bundle loader to all the arguments @@ -547,6 +595,7 @@ def _register_binary_linking_action( linking_outputs = _link_multi_arch_binary( ctx = ctx, avoid_deps = all_avoid_deps, + build_settings = build_settings, cc_toolchains = cc_toolchains, extra_linkopts = linkopts, extra_link_inputs = link_inputs, @@ -554,6 +603,7 @@ def _register_binary_linking_action( # TODO(321109350): Disable include scanning to work around issue with GrepIncludes actions # being routed to the wrong exec platform. extra_disabled_features = extra_disabled_features + ["cc_include_scanning"], + rule_descriptor = rule_descriptor, stamp = stamp, ) diff --git a/apple/internal/macos_rules.bzl b/apple/internal/macos_rules.bzl index 31d4aecc4c..37b6dd47ca 100644 --- a/apple/internal/macos_rules.bzl +++ b/apple/internal/macos_rules.bzl @@ -241,6 +241,7 @@ def _macos_application_impl(ctx): ctx, cc_toolchains = cc_toolchain_forwarder, avoid_deps = ctx.attr.frameworks, + build_settings = apple_xplat_toolchain_info.build_settings, entitlements = entitlements.linking, exported_symbols_lists = ctx.files.exported_symbols_lists, platform_prerequisites = platform_prerequisites, @@ -316,9 +317,8 @@ def _macos_application_impl(ctx): bundle_extension = bundle_extension, bundle_name = bundle_name, debug_dependencies = embedded_targets + ctx.attr.additional_contents.keys(), - dsym_binaries = debug_outputs.dsym_binaries, + dsym_outputs = debug_outputs.dsym_outputs, dsym_info_plist_template = apple_mac_toolchain_info.dsym_info_plist_template, - executable_name = executable_name, label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, @@ -380,7 +380,7 @@ def _macos_application_impl(ctx): actions = actions, binary_artifact = binary_artifact, dependency_targets = embedded_targets, - dsym_binaries = debug_outputs.dsym_binaries, + dsym_outputs = debug_outputs.dsym_outputs, label_name = label.name, include_symbols_in_bundle = ctx.attr.include_symbols_in_bundle, platform_prerequisites = platform_prerequisites, @@ -433,7 +433,10 @@ def _macos_application_impl(ctx): predeclared_outputs = predeclared_outputs, rule_descriptor = rule_descriptor, ) - dsyms = outputs.dsyms(processor_result = processor_result) + dsyms = outputs.dsyms( + platform_prerequisites = platform_prerequisites, + processor_result = processor_result, + ) run_support.register_macos_executable( actions = actions, @@ -543,6 +546,7 @@ def _macos_bundle_impl(ctx): link_result = linking_support.register_binary_linking_action( ctx, cc_toolchains = cc_toolchain_forwarder, + build_settings = apple_xplat_toolchain_info.build_settings, bundle_loader = ctx.attr.bundle_loader, entitlements = entitlements.linking, exported_symbols_lists = ctx.files.exported_symbols_lists, @@ -622,9 +626,8 @@ def _macos_bundle_impl(ctx): bundle_extension = bundle_extension, bundle_name = bundle_name, debug_dependencies = ctx.attr.additional_contents.keys(), - dsym_binaries = debug_outputs.dsym_binaries, + dsym_outputs = debug_outputs.dsym_outputs, dsym_info_plist_template = apple_mac_toolchain_info.dsym_info_plist_template, - executable_name = executable_name, label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, @@ -797,6 +800,7 @@ def _macos_extension_impl(ctx): ctx, cc_toolchains = cc_toolchain_forwarder, avoid_deps = ctx.attr.frameworks, + build_settings = apple_xplat_toolchain_info.build_settings, entitlements = entitlements.linking, exported_symbols_lists = ctx.files.exported_symbols_lists, extra_linkopts = extra_linkopts, @@ -886,9 +890,8 @@ def _macos_extension_impl(ctx): bundle_extension = bundle_extension, bundle_name = bundle_name, debug_dependencies = ctx.attr.frameworks + ctx.attr.additional_contents.keys(), - dsym_binaries = debug_outputs.dsym_binaries, dsym_info_plist_template = apple_mac_toolchain_info.dsym_info_plist_template, - executable_name = executable_name, + dsym_outputs = debug_outputs.dsym_outputs, label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, @@ -935,7 +938,7 @@ def _macos_extension_impl(ctx): actions = actions, binary_artifact = binary_artifact, dependency_targets = [], - dsym_binaries = debug_outputs.dsym_binaries, + dsym_outputs = debug_outputs.dsym_outputs, label_name = label.name, include_symbols_in_bundle = False, platform_prerequisites = platform_prerequisites, @@ -1065,6 +1068,7 @@ def _macos_quick_look_plugin_impl(ctx): link_result = linking_support.register_binary_linking_action( ctx, + build_settings = apple_xplat_toolchain_info.build_settings, cc_toolchains = cc_toolchain_forwarder, entitlements = entitlements.linking, exported_symbols_lists = ctx.files.exported_symbols_lists, @@ -1147,9 +1151,8 @@ def _macos_quick_look_plugin_impl(ctx): bundle_extension = bundle_extension, bundle_name = bundle_name, debug_dependencies = ctx.attr.additional_contents.keys(), - dsym_binaries = debug_outputs.dsym_binaries, + dsym_outputs = debug_outputs.dsym_outputs, dsym_info_plist_template = apple_mac_toolchain_info.dsym_info_plist_template, - executable_name = executable_name, label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, @@ -1192,7 +1195,7 @@ def _macos_quick_look_plugin_impl(ctx): actions = actions, binary_artifact = binary_artifact, dependency_targets = [], - dsym_binaries = debug_outputs.dsym_binaries, + dsym_outputs = debug_outputs.dsym_outputs, label_name = label.name, include_symbols_in_bundle = False, platform_prerequisites = platform_prerequisites, @@ -1319,6 +1322,7 @@ def _macos_kernel_extension_impl(ctx): link_result = linking_support.register_binary_linking_action( ctx, + build_settings = apple_xplat_toolchain_info.build_settings, cc_toolchains = cc_toolchain_forwarder, entitlements = entitlements.linking, exported_symbols_lists = ctx.files.exported_symbols_lists, @@ -1399,9 +1403,8 @@ def _macos_kernel_extension_impl(ctx): bundle_extension = bundle_extension, bundle_name = bundle_name, debug_dependencies = ctx.attr.additional_contents.keys(), - dsym_binaries = debug_outputs.dsym_binaries, + dsym_outputs = debug_outputs.dsym_outputs, dsym_info_plist_template = apple_mac_toolchain_info.dsym_info_plist_template, - executable_name = executable_name, label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, @@ -1444,7 +1447,7 @@ def _macos_kernel_extension_impl(ctx): actions = actions, binary_artifact = binary_artifact, dependency_targets = [], - dsym_binaries = debug_outputs.dsym_binaries, + dsym_outputs = debug_outputs.dsym_outputs, label_name = label.name, include_symbols_in_bundle = False, platform_prerequisites = platform_prerequisites, @@ -1562,6 +1565,7 @@ def _macos_spotlight_importer_impl(ctx): link_result = linking_support.register_binary_linking_action( ctx, + build_settings = apple_xplat_toolchain_info.build_settings, cc_toolchains = cc_toolchain_forwarder, entitlements = entitlements.linking, exported_symbols_lists = ctx.files.exported_symbols_lists, @@ -1641,9 +1645,8 @@ def _macos_spotlight_importer_impl(ctx): bundle_extension = bundle_extension, bundle_name = bundle_name, debug_dependencies = ctx.attr.additional_contents.keys(), - dsym_binaries = debug_outputs.dsym_binaries, + dsym_outputs = debug_outputs.dsym_outputs, dsym_info_plist_template = apple_mac_toolchain_info.dsym_info_plist_template, - executable_name = executable_name, label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, @@ -1685,7 +1688,7 @@ def _macos_spotlight_importer_impl(ctx): actions = actions, binary_artifact = binary_artifact, dependency_targets = [], - dsym_binaries = debug_outputs.dsym_binaries, + dsym_outputs = debug_outputs.dsym_outputs, label_name = label.name, include_symbols_in_bundle = False, platform_prerequisites = platform_prerequisites, @@ -1803,6 +1806,7 @@ def _macos_xpc_service_impl(ctx): link_result = linking_support.register_binary_linking_action( ctx, + build_settings = apple_xplat_toolchain_info.build_settings, cc_toolchains = cc_toolchain_forwarder, entitlements = entitlements.linking, exported_symbols_lists = ctx.files.exported_symbols_lists, @@ -1882,9 +1886,8 @@ def _macos_xpc_service_impl(ctx): bundle_extension = bundle_extension, bundle_name = bundle_name, debug_dependencies = ctx.attr.additional_contents.keys(), - dsym_binaries = debug_outputs.dsym_binaries, + dsym_outputs = debug_outputs.dsym_outputs, dsym_info_plist_template = apple_mac_toolchain_info.dsym_info_plist_template, - executable_name = executable_name, label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, @@ -1926,7 +1929,7 @@ def _macos_xpc_service_impl(ctx): actions = actions, binary_artifact = binary_artifact, dependency_targets = [], - dsym_binaries = debug_outputs.dsym_binaries, + dsym_outputs = debug_outputs.dsym_outputs, label_name = label.name, include_symbols_in_bundle = False, platform_prerequisites = platform_prerequisites, @@ -2019,6 +2022,7 @@ def _macos_command_line_application_impl(ctx): link_result = linking_support.register_binary_linking_action( ctx, + build_settings = apple_xplat_toolchain_info.build_settings, cc_toolchains = cc_toolchain_forwarder, # Command-line applications do not have entitlements. entitlements = None, @@ -2034,7 +2038,7 @@ def _macos_command_line_application_impl(ctx): actions = actions, bundle_extension = bundle_extension, bundle_name = bundle_name, - dsym_binaries = debug_outputs.dsym_binaries, + dsym_outputs = debug_outputs.dsym_outputs, dsym_info_plist_template = apple_mac_toolchain_info.dsym_info_plist_template, label_name = label.name, linkmaps = debug_outputs.linkmaps, @@ -2088,7 +2092,10 @@ def _macos_command_line_application_impl(ctx): if clang_rt_dylibs.should_package_clang_runtime(features = features): runfiles = clang_rt_dylibs.get_from_toolchain(ctx) - dsyms = outputs.dsyms(processor_result = processor_result) + dsyms = outputs.dsyms( + platform_prerequisites = platform_prerequisites, + processor_result = processor_result, + ) return [ new_applebinaryinfo( @@ -2161,6 +2168,7 @@ def _macos_dylib_impl(ctx): link_result = linking_support.register_binary_linking_action( ctx, + build_settings = apple_xplat_toolchain_info.build_settings, cc_toolchains = cc_toolchain_forwarder, # Dynamic libraries do not have entitlements. entitlements = None, @@ -2177,7 +2185,7 @@ def _macos_dylib_impl(ctx): actions = actions, bundle_extension = bundle_extension, bundle_name = bundle_name, - dsym_binaries = debug_outputs.dsym_binaries, + dsym_outputs = debug_outputs.dsym_outputs, dsym_info_plist_template = apple_mac_toolchain_info.dsym_info_plist_template, label_name = label.name, linkmaps = debug_outputs.linkmaps, @@ -2784,7 +2792,6 @@ def _macos_framework_impl(ctx): actions = ctx.actions apple_mac_toolchain_info = ctx.attr._mac_toolchain[AppleMacToolsToolchainInfo] apple_xplat_toolchain_info = ctx.attr._xplat_toolchain[AppleXPlatToolsToolchainInfo] - bin_root_path = ctx.bin_dir.path bundle_id = ctx.attr.bundle_id bundle_name, bundle_extension = bundling_support.bundle_full_name( custom_bundle_name = ctx.attr.bundle_name, @@ -2794,13 +2801,6 @@ def _macos_framework_impl(ctx): executable_name = ctx.attr.executable_name cc_toolchain = find_cc_toolchain(ctx) cc_toolchain_forwarder = ctx.split_attr._cc_toolchain_forwarder - cc_features = cc_common.configure_features( - ctx = ctx, - cc_toolchain = cc_toolchain, - language = "objc", - requested_features = ctx.features, - unsupported_features = ctx.disabled_features, - ) features = features_support.compute_enabled_features( requested_features = ctx.features, unsupported_features = ctx.disabled_features, @@ -2853,6 +2853,7 @@ def _macos_framework_impl(ctx): ctx, cc_toolchains = cc_toolchain_forwarder, avoid_deps = ctx.attr.frameworks, + build_settings = apple_xplat_toolchain_info.build_settings, # Frameworks do not have entitlements. entitlements = None, exported_symbols_lists = ctx.files.exported_symbols_lists, @@ -2935,9 +2936,8 @@ def _macos_framework_impl(ctx): bundle_extension = bundle_extension, bundle_name = bundle_name, debug_dependencies = ctx.attr.frameworks, - dsym_binaries = debug_outputs.dsym_binaries, + dsym_outputs = debug_outputs.dsym_outputs, dsym_info_plist_template = apple_mac_toolchain_info.dsym_info_plist_template, - executable_name = executable_name, label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, @@ -2959,13 +2959,13 @@ def _macos_framework_impl(ctx): partials.framework_headers_partial(hdrs = ctx.files.hdrs), partials.framework_provider_partial( actions = actions, - bin_root_path = bin_root_path, binary_artifact = binary_artifact, - bundle_name = bundle_name, bundle_only = ctx.attr.bundle_only, - cc_features = cc_features, + cc_configured_features_init = features_support.make_cc_configured_features_init(ctx), cc_info = link_result.cc_info, cc_toolchain = cc_toolchain, + features = features, + disabled_features = ctx.disabled_features, rule_label = label, ), partials.resources_partial( @@ -2999,7 +2999,7 @@ def _macos_framework_impl(ctx): actions = actions, binary_artifact = binary_artifact, dependency_targets = ctx.attr.frameworks, - dsym_binaries = debug_outputs.dsym_binaries, + dsym_outputs = debug_outputs.dsym_outputs, label_name = label.name, include_symbols_in_bundle = False, platform_prerequisites = platform_prerequisites, @@ -3060,7 +3060,6 @@ def _macos_dynamic_framework_impl(ctx): actions = ctx.actions apple_mac_toolchain_info = ctx.attr._mac_toolchain[AppleMacToolsToolchainInfo] apple_xplat_toolchain_info = ctx.attr._xplat_toolchain[AppleXPlatToolsToolchainInfo] - bin_root_path = ctx.bin_dir.path bundle_id = ctx.attr.bundle_id bundle_name, bundle_extension = bundling_support.bundle_full_name( custom_bundle_name = ctx.attr.bundle_name, @@ -3136,6 +3135,7 @@ def _macos_dynamic_framework_impl(ctx): ctx, cc_toolchains = cc_toolchain_forwarder, avoid_deps = ctx.attr.frameworks, + build_settings = apple_xplat_toolchain_info.build_settings, # Frameworks do not have entitlements. entitlements = None, exported_symbols_lists = ctx.files.exported_symbols_lists, @@ -3216,9 +3216,8 @@ def _macos_dynamic_framework_impl(ctx): bundle_extension = bundle_extension, bundle_name = bundle_name, debug_dependencies = ctx.attr.frameworks, - dsym_binaries = debug_outputs.dsym_binaries, + dsym_outputs = debug_outputs.dsym_outputs, dsym_info_plist_template = apple_mac_toolchain_info.dsym_info_plist_template, - executable_name = executable_name, label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, @@ -3239,13 +3238,13 @@ def _macos_dynamic_framework_impl(ctx): ), partials.framework_provider_partial( actions = actions, - bin_root_path = bin_root_path, binary_artifact = binary_artifact, - bundle_name = bundle_name, bundle_only = False, - cc_features = cc_features, + cc_configured_features_init = features_support.make_cc_configured_features_init(ctx), cc_info = link_result.cc_info, cc_toolchain = cc_toolchain, + features = features, + disabled_features = ctx.disabled_features, rule_label = label, ), partials.resources_partial( diff --git a/apple/internal/outputs.bzl b/apple/internal/outputs.bzl index 145c851d7e..b83ec31cef 100644 --- a/apple/internal/outputs.bzl +++ b/apple/internal/outputs.bzl @@ -26,6 +26,10 @@ load( "//apple/internal:experimental.bzl", "is_experimental_tree_artifact_enabled", ) +load( + "//apple/internal:fragment_support.bzl", + "fragment_support", +) load( "//apple/internal:intermediates.bzl", "intermediates", @@ -110,13 +114,26 @@ def _executable(*, actions, label_name): """Returns a file reference for the executable that would be invoked with `bazel run`.""" return actions.declare_file(label_name) -def _dsyms(*, processor_result): +def _dsyms(*, platform_prerequisites, processor_result): """Returns a depset of all of the dsyms from the result.""" - dsyms = [] - for provider in processor_result.providers: - if getattr(provider, "dsyms", None): - dsyms.append(provider.dsyms) - return depset(transitive = dsyms) + direct_dsyms = [] + transitive_dsyms = [] + dsym_variant_flag = platform_prerequisites.build_settings.dsym_variant_flag + if dsym_variant_flag == "bundle": + for provider in processor_result.providers: + # Sourcing fields from the public AppleDsymBundleInfo provider. + if getattr(provider, "direct_dsyms", None): + direct_dsyms.extend(provider.direct_dsyms) + if getattr(provider, "transitive_dsyms", None): + transitive_dsyms.append(provider.transitive_dsyms) + elif dsym_variant_flag == "flat": + for provider in processor_result.providers: + # Sourcing fields from the AppleDebugInfo provider, only visible to the rules. + if getattr(provider, "dsyms", None): + transitive_dsyms.append(provider.dsyms) + else: + fail("Internal Error: Unsupported dsym_variant_flag: {}".format(dsym_variant_flag)) + return depset(direct_dsyms, transitive = transitive_dsyms) def _infoplist(*, actions, label_name, output_discriminator): """Returns a file reference for this target's Info.plist file.""" @@ -127,6 +144,47 @@ def _infoplist(*, actions, label_name, output_discriminator): file_name = "Info.plist", ) +def _main_binary( + *, + actions, + apple_platform_info, + cpp_fragment, + label, + unstripped): + """Returns a file reference for the main binary that gets linked.""" + + # TODO(b/331163513): Use intermediates.file() instead of declare_shareable_artifact() as soon as + # it is safe to do so. + return actions.declare_shareable_artifact( + paths.join(label.package, _main_binary_basename( + cpp_fragment = cpp_fragment, + label_name = label.name, + unstripped = unstripped, + )), + apple_platform_info.target_build_config.bin_dir, + ) + +def _main_binary_basename( + *, + cpp_fragment, + label_name, + unstripped): + """Returns the basename of the main binary that gets linked.""" + + # When compilation_mode=opt and objc_enable_binary_stripping are specified, the unstripped + # binary containing debug symbols is generated by the linker, which also needs the debug + # symbols for dead-code removal. The binary is also used to generate dSYM bundle if + # --apple_generate_dsym is specified. A symbol strip action is later registered to strip + # the symbol table from the unstripped binary. + if fragment_support.is_objc_strip_action_enabled( + cpp_fragment = cpp_fragment, + ) and unstripped: + suffix = "_bin_unstripped" + else: + suffix = "_bin" + + return label_name + suffix + def _has_different_embedding_archive(*, platform_prerequisites, rule_descriptor): """Returns True if this target exposes a different archive when embedded in another target.""" tree_artifact_enabled = is_experimental_tree_artifact_enabled( @@ -193,6 +251,8 @@ outputs = struct( dsyms = _dsyms, executable = _executable, infoplist = _infoplist, + main_binary = _main_binary, + main_binary_basename = _main_binary_basename, merge_output_groups = _merge_output_groups, root_path_from_archive = _root_path_from_archive, has_different_embedding_archive = _has_different_embedding_archive, diff --git a/apple/internal/partials/BUILD b/apple/internal/partials/BUILD index 6b689ebdd1..26368e9102 100644 --- a/apple/internal/partials/BUILD +++ b/apple/internal/partials/BUILD @@ -147,11 +147,13 @@ bzl_library( deps = [ "//apple:providers", "//apple/internal:intermediates", + "//apple/internal:outputs", "//apple/internal:providers", "//apple/internal:resource_actions", "//apple/internal/providers:apple_debug_info", "//apple/internal/utils:defines", "@bazel_skylib//lib:partial", + "@bazel_skylib//lib:paths", "@bazel_skylib//lib:shell", "@build_bazel_apple_support//lib:apple_support", ], @@ -235,7 +237,6 @@ bzl_library( "//apple/internal:framework_import_support", "//apple/internal:providers", "@bazel_skylib//lib:partial", - "@bazel_skylib//lib:paths", ], ) diff --git a/apple/internal/partials/apple_symbols_file.bzl b/apple/internal/partials/apple_symbols_file.bzl index 1a5cfb3553..a3ac156545 100644 --- a/apple/internal/partials/apple_symbols_file.bzl +++ b/apple/internal/partials/apple_symbols_file.bzl @@ -48,7 +48,7 @@ def _apple_symbols_file_partial_impl( actions, binary_artifact, dependency_targets, - dsym_binaries, + dsym_outputs, label_name, output_discriminator, include_symbols_in_bundle, @@ -56,13 +56,19 @@ def _apple_symbols_file_partial_impl( """Implementation for the Apple .symbols file processing partial.""" outputs = [] if (platform_prerequisites.cpp_fragment.apple_generate_dsym and - binary_artifact and dsym_binaries): + binary_artifact and dsym_outputs): inputs = [binary_artifact] - for dsym_binary in dsym_binaries.values(): - inputs.append(dsym_binary) + + # The xcrun symbols tool can handle both dSYM bundles and "flat file" dSYM binaries as + # inputs; therefore, we handle them as inputs in the same way without "guessing" paths to + # the dSYM binaries in a dSYM bundle. + for dsym_output in dsym_outputs.values(): + inputs.append(dsym_output) + for target in dependency_targets: if AppleFrameworkImportInfo in target: inputs.extend(target[AppleFrameworkImportInfo].debug_info_binaries.to_list()) + output = intermediates.directory( actions = actions, target_name = label_name, @@ -110,7 +116,7 @@ def apple_symbols_file_partial( actions, binary_artifact, dependency_targets = [], - dsym_binaries, + dsym_outputs, label_name, output_discriminator = None, include_symbols_in_bundle, @@ -122,7 +128,7 @@ def apple_symbols_file_partial( binary_artifact: The main binary artifact for this target. dependency_targets: List of targets that should be checked for files that need to be bundled. - dsym_binaries: A mapping of architectures to Files representing dsym binary outputs for each + dsym_outputs: A mapping of architectures to Files representing dsym outputs for each architecture. label_name: Name of the target being built. output_discriminator: A string to differentiate between different target intermediate files @@ -139,7 +145,7 @@ def apple_symbols_file_partial( actions = actions, binary_artifact = binary_artifact, dependency_targets = dependency_targets, - dsym_binaries = dsym_binaries, + dsym_outputs = dsym_outputs, include_symbols_in_bundle = include_symbols_in_bundle, label_name = label_name, output_discriminator = output_discriminator, diff --git a/apple/internal/partials/debug_symbols.bzl b/apple/internal/partials/debug_symbols.bzl index 44c0433c7e..5570a41797 100644 --- a/apple/internal/partials/debug_symbols.bzl +++ b/apple/internal/partials/debug_symbols.bzl @@ -22,11 +22,14 @@ load( "@bazel_skylib//lib:paths.bzl", "paths", ) +load( + "@bazel_skylib//lib:shell.bzl", + "shell", +) load( "@build_bazel_apple_support//lib:apple_support.bzl", "apple_support", ) -load("@build_bazel_apple_support//lib:lipo.bzl", "lipo") load( "//apple:providers.bzl", "AppleBundleVersionInfo", @@ -37,6 +40,10 @@ load( "//apple/internal:intermediates.bzl", "intermediates", ) +load( + "//apple/internal:outputs.bzl", + "outputs", +) load( "//apple/internal:providers.bzl", "new_appledsymbundleinfo", @@ -54,6 +61,8 @@ load( "defines", ) +visibility("//apple/...") + def _declare_linkmap( *, actions, @@ -63,14 +72,14 @@ def _declare_linkmap( """Declares a linkmap for this binary. Args: - actions: The actions provider from `ctx.actions`. - arch: The architecture specified for this particular debug output. - debug_output_filename: The base file name to use for this debug output, which will be followed - by the architecture with an underscore to make this linkmap's file name. - linkmap: The linkmap that was generated by the linking action. + actions: The actions provider from `ctx.actions`. + arch: The architecture specified for this particular debug output. + debug_output_filename: The base file name to use for this debug output, which will be + followed by the architecture with an underscore to make this linkmap's file name. + linkmap: The linkmap that was generated by the linking action. Returns: - A linkmap file for the given architecture. + A linkmap file for the given architecture. """ output_linkmap = actions.declare_file( "%s_%s.linkmap" % (debug_output_filename, arch), @@ -86,13 +95,13 @@ def _collect_linkmaps( """Collects the available linkmaps from the binary. Args: - actions: The actions provider from `ctx.actions`. - debug_output_filename: The base file name to use for this debug output, which will be followed - by each architecture with an underscore to make each linkmap's file name. - linkmaps: A mapping of architectures to Files representing linkmaps for each architecture. + actions: The actions provider from `ctx.actions`. + debug_output_filename: The base file name to use for this debug output, which will be + followed by each architecture with an underscore to make each linkmap's file name. + linkmaps: A mapping of architectures to Files representing linkmaps for each architecture. Returns: - A list of linkmap files, one per linked architecture. + A list of linkmap files, one per linked architecture. """ outputs = [] @@ -107,39 +116,41 @@ def _collect_linkmaps( return outputs -def _generate_dsym_binaries( +def _copy_dsyms_into_declared_bundle( *, actions, debug_output_filename, dsym_bundle_name, - found_binaries_by_arch, - platform_prerequisites): + found_binaries_by_arch): """Declares the dSYM binary file and copies it into the preferred .dSYM bundle location. Args: - actions: The actions provider from `ctx.actions`. - debug_output_filename: The base file name to use for this debug output, which will be followed - by the architecture with an underscore to make the dSYM binary file name or with the bundle - extension following it for the dSYM bundle file name. - dsym_bundle_name: The full name of the dSYM bundle, including its extension. - found_binaries_by_arch: A mapping of architectures to Files representing dsym binary outputs - for each architecture. - platform_prerequisites: Struct containing information on the platform being targeted. + actions: The actions provider from `ctx.actions`. + debug_output_filename: The base file name to use for this debug output, which will be + followed by the architecture with an underscore to make the dSYM binary file name or + with the bundle extension following it for the dSYM bundle file name. + dsym_bundle_name: The full name of the dSYM bundle, including its extension. + found_binaries_by_arch: A mapping of architectures to Files representing dsym binary outputs + for each architecture. Returns: - A list of Files representing the copied dSYM binary which is located in the preferred .dSYM - bundle locations. + A list of Files representing the copied dSYM binaries located in the preferred .dSYM bundle + locations. """ - output_binary = actions.declare_file( - "%s/Contents/Resources/DWARF/%s" % ( - dsym_bundle_name, + output_binaries = [] + + for arch, dsym_binary in found_binaries_by_arch.items(): + output_relpath = "Contents/Resources/DWARF/%s_%s" % ( debug_output_filename, - ), - ) + arch, + ) - # Copy the binary over if there's only a single arch. - if len(found_binaries_by_arch) == 1: - dsym_binary = found_binaries_by_arch.values()[0] + output_binary = actions.declare_file( + "%s/%s" % ( + dsym_bundle_name, + output_relpath, + ), + ) # cp instead of symlink here because a dSYM with a symlink to the DWARF data will not be # recognized by spotlight which is key for lldb on mac to find a dSYM for a binary. @@ -159,16 +170,80 @@ fi cp $flags "{src}" "{dst}" """.format(src = dsym_binary.path, dst = output_binary.path), ) + + output_binaries.append(output_binary) + + return output_binaries + +def _lipo_command_for_dsyms( + *, + bundle_inputs, + found_dsyms_by_arch, + main_binary_basename): + """Returns a shell command to invoke lipo against all provided dSYMs for a given bundle. + + Args: + bundle_inputs: Wheither the found binaries are actually dSYM bundles. + found_dsyms_by_arch: A mapping of architectures to Files representing dsym outputs for each + architecture. + main_binary_basename: The basename of the main unstripped binary that was linked to generate + the dSYM. + + Returns: + A String representing the shell command to invoke lipo, referencing an OUTPUT_DIR shell + variable that is expected to represent the dSYM bundle root. + """ + found_binary_paths = [] + + if bundle_inputs: + for dsym_bundle in found_dsyms_by_arch.values(): + found_binary = dsym_bundle.path + paths.join( + "/Contents/Resources/DWARF", + main_binary_basename, + ) + found_binary_paths.append(found_binary) else: - lipo.create( - actions = actions, - apple_fragment = platform_prerequisites.apple_fragment, - inputs = found_binaries_by_arch.values(), - output = output_binary, - xcode_config = platform_prerequisites.xcode_version_config, - ) + for dsym_binary in found_dsyms_by_arch.values(): + found_binary_paths.append(dsym_binary.path) + + lipo_command = ( + "mkdir -p \"${{OUTPUT_DIR}}/Contents/Resources/DWARF\" && " + + "/usr/bin/lipo " + + "-create {found_binary_inputs} " + + "-output \"${{OUTPUT_DIR}}/Contents/Resources/DWARF/{main_binary_basename}\"" + ).format( + found_binary_inputs = " ".join([shell.quote(path) for path in found_binary_paths]), + main_binary_basename = main_binary_basename, + ) + + return lipo_command + +def _ditto_command_for_dsyms(*, found_binaries_by_arch): + """Returns a shell command to invoke ditto against the provided dSYMs for a given bundle. + + Args: + found_binaries_by_arch: A mapping of architectures to Files representing dsym outputs for + each architecture. + + Returns: + A String representing the shell command to invoke ditto, referencing an OUTPUT_DIR shell + variable that is expected to represent the dSYM bundle root. + """ + found_binary_paths = [] + + for dsym_binary in found_binaries_by_arch.values(): + found_binary_paths.append(dsym_binary.path + "/Contents/Resources/Relocations") + + ditto_command = ( + "mkdir -p \"${{OUTPUT_DIR}}/Contents/Resources/Relocations\" && " + + "/usr/bin/ditto " + + "{found_binary_inputs} " + + "\"${{OUTPUT_DIR}}/Contents/Resources/Relocations\"" + ).format( + found_binary_inputs = " ".join([shell.quote(path) for path in found_binary_paths]), + ) - return [output_binary] + return ditto_command def _generate_dsym_info_plist( actions, @@ -182,18 +257,18 @@ def _generate_dsym_info_plist( """Generates an XML Info.plist appropriate for a dSYM bundle. Args: - actions: The actions provider from `ctx.actions`. - dsym_bundle_name: The full name of the dSYM bundle, including its extension. - dsym_info_plist_template: File referencing a plist template for dSYM bundles. - output_discriminator: A string to differentiate between different target intermediate files - or `None`. - platform_prerequisites: Struct containing information on the platform being targeted. - plisttool: A files_to_run for the plist tool. - rule_label: The label of the target being analyzed. - version: A label referencing AppleBundleVersionInfo, if provided by the rule. + actions: The actions provider from `ctx.actions`. + dsym_bundle_name: The full name of the dSYM bundle, including its extension. + dsym_info_plist_template: File referencing a plist template for dSYM bundles. + output_discriminator: A string to differentiate between different target intermediate files + or `None`. + platform_prerequisites: Struct containing information on the platform being targeted. + plisttool: A files_to_run for the plist tool. + rule_label: The label of the target being analyzed. + version: A label referencing AppleBundleVersionInfo, if provided by the rule. Returns: - A File representing the generated Info.plist for the dSYM bundle. + A File representing the generated Info.plist for the dSYM bundle. """ plisttool_input_files = [dsym_info_plist_template] @@ -249,9 +324,8 @@ def _bundle_dsym_files( actions, bundle_extension = "", debug_output_filename, - dsym_binaries = {}, + dsym_inputs = {}, dsym_info_plist_template, - dsym_output_filename, label_name, output_discriminator, platform_prerequisites, @@ -268,27 +342,33 @@ def _bundle_dsym_files( an empty list. Args: - actions: The actions provider from `ctx.actions`. - bundle_extension: The extension for the bundle. - debug_output_filename: The base file name to use for this debug output, which will be followed - by each architecture with an underscore to make each dSYM binary file name or with the - bundle extension following it for the dSYM bundle file name. - dsym_binaries: A mapping of architectures to Files representing dSYM binary outputs for each - architecture. - dsym_info_plist_template: File referencing a plist template for dSYM bundles. - dsym_output_filename: The dSYM binary file name. - label_name: The name of the target. - output_discriminator: A string to differentiate between different target intermediate files - or `None`. - platform_prerequisites: Struct containing information on the platform being targeted. - plisttool: A files_to_run for the plist tool. - rule_label: The label of the target being analyzed. - version: A label referencing AppleBundleVersionInfo, if provided by the rule. + actions: The actions provider from `ctx.actions`. + bundle_extension: The extension for the bundle. + debug_output_filename: The base file name to use for this debug output, which will be + followed by each architecture with an underscore to make each dSYM binary file name or + with the bundle extension following it for the dSYM bundle file name. + dsym_inputs: A mapping of architectures to Files representing dSYM outputs for each + architecture. + dsym_info_plist_template: File referencing a plist template for dSYM bundles. + label_name: The name of the target. + output_discriminator: A string to differentiate between different target intermediate files + or `None`. + platform_prerequisites: Struct containing information on the platform being targeted. + plisttool: A files_to_run for the plist tool. + rule_label: The label of the target being analyzed. + version: A label referencing AppleBundleVersionInfo, if provided by the rule. Returns: - A tuple where the first argument is a list of files that comprise the .dSYM bundle, which - should be returned as additional outputs from the target, and the second argument is a tree - artifact representation of a .dSYM bundle with the binaries lipoed together as one binary. + A two parameter tuple of the following form: + + 1. If `dsym_variant_flag` is "flat", a List of Files that comprise the .dSYM bundle, + which should be returned as additional outputs from the target. If `dsym_variant_flag` + is "bundle" this will be an empty List. + 2. A File representing the tree artifact representation of the .dSYM bundle with the + dSYM binaries lipoed together as one binary, if any dsym_inputs were provided. If + `dsym_variant_flag` is "bundle" and only one dSYM bundle in the dictionary of + dsym_inputs was provided, the tree artifact returned will be an unmodified reference to + that dSYM bundle. """ dsym_bundle_name_with_extension = debug_output_filename + bundle_extension if debug_output_filename != label_name.split(".__internal__.")[0]: @@ -299,27 +379,67 @@ def _bundle_dsym_files( output_files = [] dsym_bundle_dir = None - found_binaries_by_arch = {} + if not dsym_inputs: + return [], None + + # The dSYM binary file names are expected to match the unstripped binaries that they were based + # on from the original crosstool dsymutil invocation; this is more imperative to get right when + # referencing dSYM binaries from a dSYM bundle. + main_binary_basename = outputs.main_binary_basename( + cpp_fragment = platform_prerequisites.cpp_fragment, + label_name = rule_label.name, + unstripped = True, + ) + + command_inputs = dsym_inputs.values() + + dsym_variants = platform_prerequisites.build_settings.dsym_variant_flag + + if dsym_variants == "bundle": + if len(dsym_inputs) == 1: + # If we only have one dSYM binary, we can just use it as-is, no need to merge + lipo its + # contents. + return [], dsym_inputs.values()[0] + + # 1. Lipo the binaries (Resources/DWARF/{main_binary_basename}). + lipo_command = _lipo_command_for_dsyms( + bundle_inputs = True, + found_dsyms_by_arch = dsym_inputs, + main_binary_basename = main_binary_basename, + ) + + # 2. Merge the files within (Resources/Relocations, Info.plist). + ditto_command = _ditto_command_for_dsyms(found_binaries_by_arch = dsym_inputs) + + # We expect any given Info.plist from the splits to be as good as any, no need to merge + # them, but we can do that with plisttool if and when it's needed. + plist_command = ( + "cp \"{dsym_plist_path}\" \"${{OUTPUT_DIR}}/Contents/Info.plist\"" + ).format( + dsym_plist_path = dsym_inputs.values()[0].path + "/Contents/Info.plist", + ) + + command = ( + "rm -rf \"${OUTPUT_DIR}\" && " + + lipo_command + " && " + + ditto_command + " && " + + plist_command + ) - if dsym_binaries: - found_binaries_by_arch.update(dsym_binaries) + dsym_bundle_dir = actions.declare_directory(dsym_bundle_name) - if found_binaries_by_arch: - generated_dsym_binaries = _generate_dsym_binaries( + elif dsym_variants == "flat": + output_files = _copy_dsyms_into_declared_bundle( actions = actions, - debug_output_filename = dsym_output_filename, + debug_output_filename = debug_output_filename, dsym_bundle_name = dsym_bundle_name, - found_binaries_by_arch = found_binaries_by_arch, - platform_prerequisites = platform_prerequisites, + found_binaries_by_arch = dsym_inputs, + ) + lipo_command = _lipo_command_for_dsyms( + bundle_inputs = False, + found_dsyms_by_arch = dsym_inputs, + main_binary_basename = main_binary_basename, ) - 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( @@ -332,27 +452,34 @@ def _bundle_dsym_files( rule_label = rule_label, version = version, ) + command_inputs.append(dsym_plist) output_files.append(dsym_plist) plist_command = ("cp \"{dsym_plist_path}\" \"${{OUTPUT_DIR}}/Contents/Info.plist\"").format( dsym_plist_path = dsym_plist.path, ) - # Put the tree artifact dSYMs in a subdirectory to avoid conflicts with the legacy dSYMs - # provided through existing APIs such as --output_groups=+dsyms. + command = "rm -rf \"${OUTPUT_DIR}\" && " + lipo_command + " && " + plist_command + + # Put the tree artifact dSYMs in a subdirectory to avoid conflicts with any legacy dSYMs + # provided through existing APIs such as --output_groups=+dsyms; note that legacy "flat + # file" dSYMs won't be present if the dsym_variants are set to "bundle" and the bundles will + # be sent through the output group instead, so the workaround is not needed in that case. dsym_bundle_dir = actions.declare_directory("dSYMs/" + dsym_bundle_name) + else: + fail("Internal Error: Unsupported dsym_variant_flag: {}".format(dsym_variants)) - apple_support.run_shell( - actions = actions, - apple_fragment = platform_prerequisites.apple_fragment, - inputs = generated_dsym_binaries + [dsym_plist] + found_binaries_by_arch.values(), - outputs = [dsym_bundle_dir], - command = ("mkdir -p \"${OUTPUT_DIR}/Contents/Resources/DWARF\" && " + dsyms_command + " && " + plist_command), - env = { - "OUTPUT_DIR": dsym_bundle_dir.path, - }, - mnemonic = "DSYMBundleCopy", - xcode_config = platform_prerequisites.xcode_version_config, - ) + apple_support.run_shell( + actions = actions, + apple_fragment = platform_prerequisites.apple_fragment, + inputs = command_inputs, + outputs = [dsym_bundle_dir], + command = command, + env = { + "OUTPUT_DIR": dsym_bundle_dir.path, + }, + mnemonic = "DSYMBundleCopy", + xcode_config = platform_prerequisites.xcode_version_config, + ) return output_files, dsym_bundle_dir @@ -363,7 +490,7 @@ def _debug_symbols_partial_impl( bundle_name, debug_dependencies = [], debug_discriminator = None, - dsym_binaries = {}, + dsym_outputs = {}, dsym_info_plist_template, executable_name = None, label_name, @@ -390,7 +517,7 @@ def _debug_symbols_partial_impl( if AppleFrameworkImportInfo in x ] - debug_output_filename = bundle_name + debug_output_filename = executable_name or bundle_name if debug_discriminator: debug_output_filename += "_" + debug_discriminator @@ -408,16 +535,12 @@ def _debug_symbols_partial_impl( if platform_prerequisites.cpp_fragment: if platform_prerequisites.cpp_fragment.apple_generate_dsym: - dsym_output_filename = executable_name or bundle_name - if debug_discriminator: - dsym_output_filename += "_" + debug_discriminator dsym_files, dsym_bundle_dir = _bundle_dsym_files( actions = actions, bundle_extension = bundle_extension, debug_output_filename = debug_output_filename, - dsym_binaries = dsym_binaries, + dsym_inputs = dsym_outputs, dsym_info_plist_template = dsym_info_plist_template, - dsym_output_filename = dsym_output_filename, label_name = label_name, output_discriminator = output_discriminator, platform_prerequisites = platform_prerequisites, @@ -425,9 +548,10 @@ def _debug_symbols_partial_impl( rule_label = rule_label, version = version, ) + if dsym_files: + direct_dsyms.extend(dsym_files) if dsym_bundle_dir: direct_dsym_bundles.append(dsym_bundle_dir) - direct_dsyms.extend(dsym_files) if platform_prerequisites.cpp_fragment.objc_generate_linkmap: linkmaps = _collect_linkmaps( @@ -444,17 +568,10 @@ def _debug_symbols_partial_impl( default = False, ) - # Output the tree artifact dSYMs as the default outputs if requested. - tree_artifact_dsym_files = defines.bool_value( - config_vars = platform_prerequisites.config_vars, - define_name = "apple.tree_artifact_dsym_files", - default = False, - ) - dsyms_group = depset(direct_dsyms, transitive = transitive_dsyms) linkmaps_group = depset(direct_linkmaps, transitive = transitive_linkmaps) - if tree_artifact_dsym_files: + if platform_prerequisites.build_settings.dsym_variant_flag == "bundle": all_output_dsyms = depset(direct_dsym_bundles, transitive = transitive_dsym_bundles) direct_output_dsyms = direct_dsym_bundles else: @@ -493,7 +610,7 @@ def debug_symbols_partial( bundle_name, debug_dependencies = [], debug_discriminator = None, - dsym_binaries = {}, + dsym_outputs = {}, dsym_info_plist_template, executable_name = None, label_name, @@ -514,27 +631,28 @@ def debug_symbols_partial( section of a successful build. Args: - actions: The actions provider from `ctx.actions`. - bundle_extension: The extension for the bundle. - bundle_name: The name of the output bundle. - debug_dependencies: List of targets from which to collect the transitive dependency debug - information to propagate them upstream. - debug_discriminator: A suffix to distinguish between different debug output files, or `None`. - dsym_binaries: A mapping of architectures to Files representing dsym binary outputs for each - architecture. - dsym_info_plist_template: File referencing a plist template for dSYM bundles. - executable_name: The name of the output DWARF executable. - label_name: The name of the target. - linkmaps: A mapping of architectures to Files representing linkmaps for each architecture. - output_discriminator: A string to differentiate between different target intermediate files - or `None`. - platform_prerequisites: Struct containing information on the platform being targeted. - plisttool: A files_to_run for the plist tool. - rule_label: The label of the target being analyzed. - version: A label referencing AppleBundleVersionInfo, if provided by the rule. + actions: The actions provider from `ctx.actions`. + bundle_extension: The extension for the bundle. + bundle_name: The name of the output bundle. + debug_dependencies: List of targets from which to collect the transitive dependency debug + information to propagate them upstream. + debug_discriminator: A suffix to distinguish between different debug output files, or + `None`. + dsym_outputs: A mapping of architectures to Files representing dsym outputs for each + architecture. + dsym_info_plist_template: File referencing a plist template for dSYM bundles. + executable_name: The name of the output DWARF executable, or `None` to use bundle_name. + label_name: The name of the target. + linkmaps: A mapping of architectures to Files representing linkmaps for each architecture. + output_discriminator: A string to differentiate between different target intermediate files + or `None`. + platform_prerequisites: Struct containing information on the platform being targeted. + plisttool: A files_to_run for the plist tool. + rule_label: The label of the target being analyzed. + version: A label referencing AppleBundleVersionInfo, if provided by the rule. Returns: - A partial that returns the debug output files, if any were requested. + A partial that returns the debug output files, if any were requested. """ return partial.make( _debug_symbols_partial_impl, @@ -543,9 +661,9 @@ def debug_symbols_partial( bundle_name = bundle_name, debug_dependencies = debug_dependencies, debug_discriminator = debug_discriminator, - dsym_binaries = dsym_binaries, + dsym_outputs = dsym_outputs, dsym_info_plist_template = dsym_info_plist_template, - executable_name = executable_name or bundle_name, + executable_name = executable_name, label_name = label_name, linkmaps = linkmaps, output_discriminator = output_discriminator, diff --git a/apple/internal/partials/framework_provider.bzl b/apple/internal/partials/framework_provider.bzl index dcadbb4a97..440f1ee56f 100644 --- a/apple/internal/partials/framework_provider.bzl +++ b/apple/internal/partials/framework_provider.bzl @@ -18,10 +18,6 @@ load( "@bazel_skylib//lib:partial.bzl", "partial", ) -load( - "@bazel_skylib//lib:paths.bzl", - "paths", -) load("@rules_cc//cc/common:cc_common.bzl", "cc_common") load("@rules_cc//cc/common:cc_info.bzl", "CcInfo") load("//apple/internal:providers.bzl", "new_appledynamicframeworkinfo") @@ -29,39 +25,26 @@ load("//apple/internal:providers.bzl", "new_appledynamicframeworkinfo") def _framework_provider_partial_impl( *, actions, - bin_root_path, binary_artifact, - bundle_name, bundle_only, - cc_features, + cc_configured_features_init, cc_info, cc_toolchain, + disabled_features, + features, rule_label): """Implementation for the framework provider partial.""" - # Create a directory structure that the linker can use to reference this - # framework. It follows the pattern of - # any_path/MyFramework.framework/MyFramework. The absolute path and files are - # propagated using the AppleDynamicFrameworkInfo provider. - framework_dir = paths.join("frameworks", "%s.framework" % bundle_name) - framework_file = actions.declare_file( - paths.join(framework_dir, bundle_name), - ) - actions.symlink( - target_file = binary_artifact, - output = framework_file, - ) - - absolute_framework_dir = paths.join( - bin_root_path, - rule_label.package, - framework_dir, + feature_configuration = cc_configured_features_init( + cc_toolchain = cc_toolchain, + language = "objc", + requested_features = features, + unsupported_features = disabled_features, ) - library_to_link = cc_common.create_library_to_link( actions = actions, cc_toolchain = cc_toolchain, - feature_configuration = cc_features, + feature_configuration = feature_configuration, dynamic_library = binary_artifact, ) linker_input = cc_common.create_linker_input( @@ -80,10 +63,7 @@ def _framework_provider_partial_impl( ) framework_provider = new_appledynamicframeworkinfo( - binary = binary_artifact, cc_info = wrapper_cc_info, - framework_dirs = depset([absolute_framework_dir]), - framework_files = depset([framework_file]), ) return struct( @@ -93,13 +73,13 @@ def _framework_provider_partial_impl( def framework_provider_partial( *, actions, - bin_root_path, binary_artifact, - bundle_name, bundle_only, - cc_features, + cc_configured_features_init, cc_info, cc_toolchain, + disabled_features, + features, rule_label): """Constructor for the framework provider partial. @@ -110,14 +90,15 @@ def framework_provider_partial( Args: actions: The actions provider from `ctx.actions`. - bin_root_path: The path to the root `-bin` directory. binary_artifact: The linked dynamic framework binary. - bundle_name: The name of the output bundle. bundle_only: Only include the bundle but do not link the framework - cc_features: List of enabled C++ features. + cc_configured_features_init: A lambda that is the same as cc_common.configure_features(...) + without the need for a `ctx`. cc_info: The CcInfo provider containing information about the targets linked into the dynamic framework. cc_toolchain: The C++ toolchain to use. + disabled_features: List of features to be disabled for C++ actions. + features: List of features to be enabled for C++ actions. rule_label: The label of the target being analyzed. Returns: @@ -128,12 +109,12 @@ def framework_provider_partial( return partial.make( _framework_provider_partial_impl, actions = actions, - bin_root_path = bin_root_path, binary_artifact = binary_artifact, - bundle_name = bundle_name, bundle_only = bundle_only, - cc_features = cc_features, + cc_configured_features_init = cc_configured_features_init, cc_info = cc_info, cc_toolchain = cc_toolchain, + disabled_features = disabled_features, + features = features, rule_label = rule_label, ) diff --git a/apple/internal/providers.bzl b/apple/internal/providers.bzl index d27e0d1ac1..b04838e96c 100644 --- a/apple/internal/providers.bzl +++ b/apple/internal/providers.bzl @@ -232,15 +232,6 @@ dependencies of the given target if any were generated. AppleDynamicFrameworkInfo, new_appledynamicframeworkinfo = provider( doc = "Contains information about an Apple dynamic framework.", fields = { - "framework_dirs": """\ -The framework path names used as link inputs in order to link against the -dynamic framework. -""", - "framework_files": """\ -The full set of artifacts that should be included as inputs to link against the -dynamic framework. -""", - "binary": "The dylib binary artifact of the dynamic framework.", "cc_info": """\ A `CcInfo` which contains information about the transitive dependencies linked into the binary. diff --git a/apple/internal/testing/apple_test_bundle_support.bzl b/apple/internal/testing/apple_test_bundle_support.bzl index 9f1eed951c..4014542b3b 100644 --- a/apple/internal/testing/apple_test_bundle_support.bzl +++ b/apple/internal/testing/apple_test_bundle_support.bzl @@ -392,6 +392,7 @@ def _apple_test_bundle_impl(*, ctx, product_type): ctx, cc_toolchains = cc_toolchain_forwarder, avoid_deps = getattr(ctx.attr, "frameworks", []), + build_settings = apple_xplat_toolchain_info.build_settings, bundle_loader = bundle_loader, # Unit/UI tests do not use entitlements. entitlements = None, @@ -480,7 +481,7 @@ def _apple_test_bundle_impl(*, ctx, product_type): bundle_extension = bundle_extension, bundle_name = bundle_name, debug_dependencies = debug_dependencies, - dsym_binaries = debug_outputs.dsym_binaries, + dsym_outputs = debug_outputs.dsym_outputs, dsym_info_plist_template = apple_mac_toolchain_info.dsym_info_plist_template, executable_name = executable_name, label_name = label.name, @@ -571,7 +572,10 @@ def _apple_test_bundle_impl(*, ctx, product_type): rule_descriptor = rule_descriptor, ) - dsyms = outputs.dsyms(processor_result = processor_result) + dsyms = outputs.dsyms( + platform_prerequisites = platform_prerequisites, + processor_result = processor_result, + ) # The processor outputs has all the extra outputs like dSYM files that we want to propagate, but # it also includes the archive artifact. This collects all the files that should be output from diff --git a/apple/internal/tvos_rules.bzl b/apple/internal/tvos_rules.bzl index 89efc9e1b7..c7d1bc086b 100644 --- a/apple/internal/tvos_rules.bzl +++ b/apple/internal/tvos_rules.bzl @@ -225,6 +225,7 @@ def _tvos_application_impl(ctx): ctx, cc_toolchains = cc_toolchain_forwarder, avoid_deps = ctx.attr.frameworks, + build_settings = apple_xplat_toolchain_info.build_settings, entitlements = entitlements.linking, exported_symbols_lists = ctx.files.exported_symbols_lists, platform_prerequisites = platform_prerequisites, @@ -306,9 +307,8 @@ def _tvos_application_impl(ctx): bundle_extension = bundle_extension, bundle_name = bundle_name, debug_dependencies = embeddable_targets + ctx.attr.deps, - dsym_binaries = debug_outputs.dsym_binaries, + dsym_outputs = debug_outputs.dsym_outputs, dsym_info_plist_template = apple_mac_toolchain_info.dsym_info_plist_template, - executable_name = executable_name, label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, @@ -372,7 +372,7 @@ def _tvos_application_impl(ctx): actions = actions, binary_artifact = binary_artifact, dependency_targets = embeddable_targets, - dsym_binaries = debug_outputs.dsym_binaries, + dsym_outputs = debug_outputs.dsym_outputs, label_name = label.name, include_symbols_in_bundle = False, platform_prerequisites = platform_prerequisites, @@ -493,7 +493,6 @@ def _tvos_dynamic_framework_impl(ctx): actions = ctx.actions apple_mac_toolchain_info = ctx.attr._mac_toolchain[AppleMacToolsToolchainInfo] apple_xplat_toolchain_info = ctx.attr._xplat_toolchain[AppleXPlatToolsToolchainInfo] - bin_root_path = ctx.bin_dir.path bundle_id = ctx.attr.bundle_id bundle_name, bundle_extension = bundling_support.bundle_full_name( custom_bundle_name = ctx.attr.bundle_name, @@ -558,6 +557,7 @@ def _tvos_dynamic_framework_impl(ctx): ctx, cc_toolchains = cc_toolchain_forwarder, avoid_deps = ctx.attr.frameworks, + build_settings = apple_xplat_toolchain_info.build_settings, # Frameworks do not have entitlements. entitlements = None, exported_symbols_lists = ctx.files.exported_symbols_lists, @@ -644,9 +644,8 @@ def _tvos_dynamic_framework_impl(ctx): bundle_extension = bundle_extension, bundle_name = bundle_name, debug_dependencies = ctx.attr.frameworks, - dsym_binaries = debug_outputs.dsym_binaries, + dsym_outputs = debug_outputs.dsym_outputs, dsym_info_plist_template = apple_mac_toolchain_info.dsym_info_plist_template, - executable_name = executable_name, label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, @@ -667,13 +666,13 @@ def _tvos_dynamic_framework_impl(ctx): ), partials.framework_provider_partial( actions = actions, - bin_root_path = bin_root_path, binary_artifact = binary_artifact, - bundle_name = bundle_name, bundle_only = ctx.attr.bundle_only, - cc_features = cc_features, + cc_configured_features_init = features_support.make_cc_configured_features_init(ctx), cc_info = link_result.cc_info, cc_toolchain = cc_toolchain, + features = features, + disabled_features = ctx.disabled_features, rule_label = label, ), partials.resources_partial( @@ -780,7 +779,6 @@ def _tvos_framework_impl(ctx): actions = ctx.actions apple_mac_toolchain_info = ctx.attr._mac_toolchain[AppleMacToolsToolchainInfo] apple_xplat_toolchain_info = ctx.attr._xplat_toolchain[AppleXPlatToolsToolchainInfo] - bin_root_path = ctx.bin_dir.path bundle_name, bundle_extension = bundling_support.bundle_full_name( custom_bundle_name = ctx.attr.bundle_name, label_name = ctx.label.name, @@ -795,13 +793,6 @@ def _tvos_framework_impl(ctx): ) cc_toolchain = find_cc_toolchain(ctx) cc_toolchain_forwarder = ctx.split_attr._cc_toolchain_forwarder - cc_features = cc_common.configure_features( - ctx = ctx, - cc_toolchain = cc_toolchain, - language = "objc", - requested_features = ctx.features, - unsupported_features = ctx.disabled_features, - ) executable_name = ctx.attr.executable_name features = features_support.compute_enabled_features( requested_features = ctx.features, @@ -845,6 +836,7 @@ def _tvos_framework_impl(ctx): ctx, cc_toolchains = cc_toolchain_forwarder, avoid_deps = ctx.attr.frameworks, + build_settings = apple_xplat_toolchain_info.build_settings, # Frameworks do not have entitlements. entitlements = None, exported_symbols_lists = ctx.files.exported_symbols_lists, @@ -933,9 +925,8 @@ def _tvos_framework_impl(ctx): bundle_extension = bundle_extension, bundle_name = bundle_name, debug_dependencies = ctx.attr.frameworks + ctx.attr.deps, - dsym_binaries = debug_outputs.dsym_binaries, + dsym_outputs = debug_outputs.dsym_outputs, dsym_info_plist_template = apple_mac_toolchain_info.dsym_info_plist_template, - executable_name = executable_name, label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, @@ -957,13 +948,13 @@ def _tvos_framework_impl(ctx): partials.framework_headers_partial(hdrs = ctx.files.hdrs), partials.framework_provider_partial( actions = actions, - bin_root_path = bin_root_path, binary_artifact = binary_artifact, - bundle_name = bundle_name, bundle_only = ctx.attr.bundle_only, - cc_features = cc_features, + cc_configured_features_init = features_support.make_cc_configured_features_init(ctx), cc_info = link_result.cc_info, cc_toolchain = cc_toolchain, + features = features, + disabled_features = ctx.disabled_features, rule_label = label, ), partials.resources_partial( @@ -997,7 +988,7 @@ def _tvos_framework_impl(ctx): actions = actions, binary_artifact = binary_artifact, dependency_targets = ctx.attr.frameworks, - dsym_binaries = debug_outputs.dsym_binaries, + dsym_outputs = debug_outputs.dsym_outputs, label_name = label.name, include_symbols_in_bundle = False, platform_prerequisites = platform_prerequisites, @@ -1130,6 +1121,7 @@ def _tvos_extension_impl(ctx): ctx, cc_toolchains = cc_toolchain_forwarder, avoid_deps = ctx.attr.frameworks, + build_settings = apple_xplat_toolchain_info.build_settings, entitlements = entitlements.linking, exported_symbols_lists = ctx.files.exported_symbols_lists, extra_linkopts = extra_linkopts, @@ -1219,9 +1211,8 @@ def _tvos_extension_impl(ctx): bundle_extension = bundle_extension, bundle_name = bundle_name, debug_dependencies = ctx.attr.frameworks + ctx.attr.deps, - dsym_binaries = debug_outputs.dsym_binaries, + dsym_outputs = debug_outputs.dsym_outputs, dsym_info_plist_template = apple_mac_toolchain_info.dsym_info_plist_template, - executable_name = executable_name, label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, @@ -1271,7 +1262,7 @@ def _tvos_extension_impl(ctx): actions = actions, binary_artifact = binary_artifact, dependency_targets = ctx.attr.frameworks, - dsym_binaries = debug_outputs.dsym_binaries, + dsym_outputs = debug_outputs.dsym_outputs, label_name = label.name, include_symbols_in_bundle = False, platform_prerequisites = platform_prerequisites, diff --git a/apple/internal/visionos_rules.bzl b/apple/internal/visionos_rules.bzl index caaa6313a7..a008908c48 100644 --- a/apple/internal/visionos_rules.bzl +++ b/apple/internal/visionos_rules.bzl @@ -233,6 +233,7 @@ Resolved Xcode is version {xcode_version}. ctx, cc_toolchains = cc_toolchain_forwarder, avoid_deps = ctx.attr.frameworks, + build_settings = apple_xplat_toolchain_info.build_settings, entitlements = entitlements.linking, exported_symbols_lists = ctx.files.exported_symbols_lists, platform_prerequisites = platform_prerequisites, @@ -313,9 +314,8 @@ Resolved Xcode is version {xcode_version}. bundle_extension = bundle_extension, bundle_name = bundle_name, debug_dependencies = embeddable_targets + ctx.attr.deps, - dsym_binaries = debug_outputs.dsym_binaries, + dsym_outputs = debug_outputs.dsym_outputs, dsym_info_plist_template = apple_mac_toolchain_info.dsym_info_plist_template, - executable_name = executable_name, label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, @@ -373,7 +373,7 @@ Resolved Xcode is version {xcode_version}. actions = actions, binary_artifact = binary_artifact, dependency_targets = embeddable_targets, - dsym_binaries = debug_outputs.dsym_binaries, + dsym_outputs = debug_outputs.dsym_outputs, label_name = label.name, include_symbols_in_bundle = False, platform_prerequisites = platform_prerequisites, @@ -450,7 +450,10 @@ Resolved Xcode is version {xcode_version}. rule_descriptor = rule_descriptor, ) - dsyms = outputs.dsyms(processor_result = processor_result) + dsyms = outputs.dsyms( + platform_prerequisites = platform_prerequisites, + processor_result = processor_result, + ) return [ DefaultInfo( @@ -497,7 +500,6 @@ def _visionos_dynamic_framework_impl(ctx): actions = ctx.actions apple_mac_toolchain_info = ctx.attr._mac_toolchain[AppleMacToolsToolchainInfo] apple_xplat_toolchain_info = ctx.attr._xplat_toolchain[AppleXPlatToolsToolchainInfo] - bin_root_path = ctx.bin_dir.path bundle_id = ctx.attr.bundle_id bundle_name, bundle_extension = bundling_support.bundle_full_name( custom_bundle_name = ctx.attr.bundle_name, @@ -562,6 +564,7 @@ def _visionos_dynamic_framework_impl(ctx): ctx, cc_toolchains = cc_toolchain_forwarder, avoid_deps = ctx.attr.frameworks, + build_settings = apple_xplat_toolchain_info.build_settings, # Frameworks do not have entitlements. entitlements = None, exported_symbols_lists = ctx.files.exported_symbols_lists, @@ -613,6 +616,7 @@ def _visionos_dynamic_framework_impl(ctx): partials.codesigning_dossier_partial( actions = actions, apple_mac_toolchain_info = apple_mac_toolchain_info, + apple_xplat_toolchain_info = apple_xplat_toolchain_info, bundle_extension = bundle_extension, bundle_location = processor.location.framework, bundle_name = bundle_name, @@ -620,6 +624,7 @@ def _visionos_dynamic_framework_impl(ctx): embedded_targets = ctx.attr.frameworks, label_name = label.name, platform_prerequisites = platform_prerequisites, + predeclared_outputs = predeclared_outputs, provisioning_profile = provisioning_profile, rule_descriptor = rule_descriptor, ), @@ -646,9 +651,8 @@ def _visionos_dynamic_framework_impl(ctx): bundle_extension = bundle_extension, bundle_name = bundle_name, debug_dependencies = ctx.attr.frameworks, - dsym_binaries = debug_outputs.dsym_binaries, + dsym_outputs = debug_outputs.dsym_outputs, dsym_info_plist_template = apple_mac_toolchain_info.dsym_info_plist_template, - executable_name = executable_name, label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, @@ -669,13 +673,13 @@ def _visionos_dynamic_framework_impl(ctx): ), partials.framework_provider_partial( actions = actions, - bin_root_path = bin_root_path, binary_artifact = binary_artifact, - bundle_name = bundle_name, bundle_only = ctx.attr.bundle_only, - cc_features = cc_features, + cc_configured_features_init = features_support.make_cc_configured_features_init(ctx), cc_info = link_result.cc_info, cc_toolchain = cc_toolchain, + features = features, + disabled_features = ctx.disabled_features, rule_label = label, ), partials.resources_partial( @@ -785,7 +789,6 @@ def _visionos_framework_impl(ctx): actions = ctx.actions apple_mac_toolchain_info = ctx.attr._mac_toolchain[AppleMacToolsToolchainInfo] apple_xplat_toolchain_info = ctx.attr._xplat_toolchain[AppleXPlatToolsToolchainInfo] - bin_root_path = ctx.bin_dir.path bundle_name, bundle_extension = bundling_support.bundle_full_name( custom_bundle_name = ctx.attr.bundle_name, label_name = ctx.label.name, @@ -800,13 +803,6 @@ def _visionos_framework_impl(ctx): ) cc_toolchain = find_cc_toolchain(ctx) cc_toolchain_forwarder = ctx.split_attr._cc_toolchain_forwarder - cc_features = cc_common.configure_features( - ctx = ctx, - cc_toolchain = cc_toolchain, - language = "objc", - requested_features = ctx.features, - unsupported_features = ctx.disabled_features, - ) executable_name = ctx.attr.executable_name features = features_support.compute_enabled_features( requested_features = ctx.features, @@ -850,6 +846,7 @@ def _visionos_framework_impl(ctx): ctx, cc_toolchains = cc_toolchain_forwarder, avoid_deps = ctx.attr.frameworks, + build_settings = apple_xplat_toolchain_info.build_settings, # Frameworks do not have entitlements. entitlements = None, exported_symbols_lists = ctx.files.exported_symbols_lists, @@ -938,9 +935,8 @@ def _visionos_framework_impl(ctx): bundle_extension = bundle_extension, bundle_name = bundle_name, debug_dependencies = ctx.attr.frameworks + ctx.attr.deps, - dsym_binaries = debug_outputs.dsym_binaries, + dsym_outputs = debug_outputs.dsym_outputs, dsym_info_plist_template = apple_mac_toolchain_info.dsym_info_plist_template, - executable_name = executable_name, label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, @@ -962,13 +958,13 @@ def _visionos_framework_impl(ctx): partials.framework_headers_partial(hdrs = ctx.files.hdrs), partials.framework_provider_partial( actions = actions, - bin_root_path = bin_root_path, binary_artifact = binary_artifact, - bundle_name = bundle_name, bundle_only = ctx.attr.bundle_only, - cc_features = cc_features, + cc_configured_features_init = features_support.make_cc_configured_features_init(ctx), cc_info = link_result.cc_info, cc_toolchain = cc_toolchain, + features = features, + disabled_features = ctx.disabled_features, rule_label = label, ), partials.resources_partial( @@ -1002,7 +998,7 @@ def _visionos_framework_impl(ctx): actions = actions, binary_artifact = binary_artifact, dependency_targets = ctx.attr.frameworks, - dsym_binaries = debug_outputs.dsym_binaries, + dsym_outputs = debug_outputs.dsym_outputs, label_name = label.name, include_symbols_in_bundle = False, platform_prerequisites = platform_prerequisites, @@ -1122,6 +1118,7 @@ def _visionos_extension_impl(ctx): ctx, cc_toolchains = cc_toolchain_forwarder, avoid_deps = ctx.attr.frameworks, + build_settings = apple_xplat_toolchain_info.build_settings, entitlements = entitlements.linking, exported_symbols_lists = ctx.files.exported_symbols_lists, extra_linkopts = [ @@ -1215,9 +1212,8 @@ def _visionos_extension_impl(ctx): bundle_extension = bundle_extension, bundle_name = bundle_name, debug_dependencies = ctx.attr.frameworks + ctx.attr.deps, - dsym_binaries = debug_outputs.dsym_binaries, + dsym_outputs = debug_outputs.dsym_outputs, dsym_info_plist_template = apple_mac_toolchain_info.dsym_info_plist_template, - executable_name = executable_name, label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, @@ -1267,7 +1263,7 @@ def _visionos_extension_impl(ctx): actions = actions, binary_artifact = binary_artifact, dependency_targets = ctx.attr.frameworks, - dsym_binaries = debug_outputs.dsym_binaries, + dsym_outputs = debug_outputs.dsym_outputs, label_name = label.name, include_symbols_in_bundle = False, platform_prerequisites = platform_prerequisites, diff --git a/apple/internal/watchos_rules.bzl b/apple/internal/watchos_rules.bzl index 358fb20403..bc3a47e1ad 100644 --- a/apple/internal/watchos_rules.bzl +++ b/apple/internal/watchos_rules.bzl @@ -157,7 +157,6 @@ def _watchos_framework_impl(ctx): actions = ctx.actions apple_mac_toolchain_info = ctx.attr._mac_toolchain[AppleMacToolsToolchainInfo] apple_xplat_toolchain_info = ctx.attr._xplat_toolchain[AppleXPlatToolsToolchainInfo] - bin_root_path = ctx.bin_dir.path bundle_id = ctx.attr.bundle_id bundle_name, bundle_extension = bundling_support.bundle_full_name( custom_bundle_name = ctx.attr.bundle_name, @@ -167,13 +166,6 @@ def _watchos_framework_impl(ctx): executable_name = ctx.attr.executable_name cc_toolchain = find_cc_toolchain(ctx) cc_toolchain_forwarder = ctx.split_attr._cc_toolchain_forwarder - cc_features = cc_common.configure_features( - ctx = ctx, - cc_toolchain = cc_toolchain, - language = "objc", - requested_features = ctx.features, - unsupported_features = ctx.disabled_features, - ) features = features_support.compute_enabled_features( requested_features = ctx.features, unsupported_features = ctx.disabled_features, @@ -226,6 +218,7 @@ def _watchos_framework_impl(ctx): ctx, cc_toolchains = cc_toolchain_forwarder, avoid_deps = ctx.attr.frameworks, + build_settings = apple_xplat_toolchain_info.build_settings, # Frameworks do not have entitlements. entitlements = None, exported_symbols_lists = ctx.files.exported_symbols_lists, @@ -306,9 +299,8 @@ def _watchos_framework_impl(ctx): bundle_extension = bundle_extension, bundle_name = bundle_name, debug_dependencies = ctx.attr.frameworks, - dsym_binaries = debug_outputs.dsym_binaries, + dsym_outputs = debug_outputs.dsym_outputs, dsym_info_plist_template = apple_mac_toolchain_info.dsym_info_plist_template, - executable_name = executable_name, label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, @@ -330,13 +322,13 @@ def _watchos_framework_impl(ctx): partials.framework_headers_partial(hdrs = ctx.files.hdrs), partials.framework_provider_partial( actions = actions, - bin_root_path = bin_root_path, binary_artifact = binary_artifact, - bundle_name = bundle_name, bundle_only = ctx.attr.bundle_only, - cc_features = cc_features, + cc_configured_features_init = features_support.make_cc_configured_features_init(ctx), cc_info = link_result.cc_info, cc_toolchain = cc_toolchain, + features = features, + disabled_features = ctx.disabled_features, rule_label = label, ), partials.resources_partial( @@ -370,7 +362,7 @@ def _watchos_framework_impl(ctx): actions = actions, binary_artifact = binary_artifact, dependency_targets = ctx.attr.frameworks, - dsym_binaries = debug_outputs.dsym_binaries, + dsym_outputs = debug_outputs.dsym_outputs, label_name = label.name, include_symbols_in_bundle = False, platform_prerequisites = platform_prerequisites, @@ -431,7 +423,6 @@ def _watchos_dynamic_framework_impl(ctx): actions = ctx.actions apple_mac_toolchain_info = ctx.attr._mac_toolchain[AppleMacToolsToolchainInfo] apple_xplat_toolchain_info = ctx.attr._xplat_toolchain[AppleXPlatToolsToolchainInfo] - bin_root_path = ctx.bin_dir.path bundle_id = ctx.attr.bundle_id bundle_name, bundle_extension = bundling_support.bundle_full_name( custom_bundle_name = ctx.attr.bundle_name, @@ -506,6 +497,7 @@ def _watchos_dynamic_framework_impl(ctx): ctx, cc_toolchains = cc_toolchain_forwarder, avoid_deps = ctx.attr.frameworks, + build_settings = apple_xplat_toolchain_info.build_settings, # Frameworks do not have entitlements. entitlements = None, exported_symbols_lists = ctx.files.exported_symbols_lists, @@ -586,9 +578,8 @@ def _watchos_dynamic_framework_impl(ctx): bundle_extension = bundle_extension, bundle_name = bundle_name, debug_dependencies = ctx.attr.frameworks, - dsym_binaries = debug_outputs.dsym_binaries, + dsym_outputs = debug_outputs.dsym_outputs, dsym_info_plist_template = apple_mac_toolchain_info.dsym_info_plist_template, - executable_name = executable_name, label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, @@ -609,13 +600,13 @@ def _watchos_dynamic_framework_impl(ctx): ), partials.framework_provider_partial( actions = actions, - bin_root_path = bin_root_path, binary_artifact = binary_artifact, - bundle_name = bundle_name, bundle_only = ctx.attr.bundle_only, - cc_features = cc_features, + cc_configured_features_init = features_support.make_cc_configured_features_init(ctx), cc_info = link_result.cc_info, cc_toolchain = cc_toolchain, + features = features, + disabled_features = ctx.disabled_features, rule_label = label, ), partials.resources_partial( @@ -921,7 +912,6 @@ reproducible error case.".format( bundle_name = bundle_name, debug_dependencies = [watch_extension], dsym_info_plist_template = apple_mac_toolchain_info.dsym_info_plist_template, - executable_name = executable_name, label_name = label.name, platform_prerequisites = platform_prerequisites, plisttool = apple_mac_toolchain_info.plisttool, @@ -971,7 +961,7 @@ reproducible error case.".format( actions = actions, binary_artifact = binary_artifact, dependency_targets = [watch_extension], - dsym_binaries = {}, + dsym_outputs = {}, label_name = label.name, include_symbols_in_bundle = False, platform_prerequisites = platform_prerequisites, @@ -1124,6 +1114,7 @@ def _watchos_extension_impl(ctx): ctx, cc_toolchains = cc_toolchain_forwarder, avoid_deps = ctx.attr.frameworks, + build_settings = apple_xplat_toolchain_info.build_settings, entitlements = entitlements.linking, exported_symbols_lists = ctx.files.exported_symbols_lists, extra_linkopts = extra_linkopts, @@ -1215,9 +1206,8 @@ def _watchos_extension_impl(ctx): bundle_extension = bundle_extension, bundle_name = bundle_name, debug_dependencies = embeddable_targets, - dsym_binaries = debug_outputs.dsym_binaries, dsym_info_plist_template = apple_mac_toolchain_info.dsym_info_plist_template, - executable_name = executable_name, + dsym_outputs = debug_outputs.dsym_outputs, label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, @@ -1281,7 +1271,7 @@ def _watchos_extension_impl(ctx): actions = actions, binary_artifact = binary_artifact, dependency_targets = embeddable_targets, - dsym_binaries = debug_outputs.dsym_binaries, + dsym_outputs = debug_outputs.dsym_outputs, label_name = label.name, include_symbols_in_bundle = False, platform_prerequisites = platform_prerequisites, @@ -1591,6 +1581,7 @@ delegate is referenced in the single-target `watchos_application`'s `deps`. ctx, cc_toolchains = cc_toolchain_forwarder, avoid_deps = ctx.attr.frameworks, + build_settings = apple_xplat_toolchain_info.build_settings, entitlements = entitlements.linking, exported_symbols_lists = ctx.files.exported_symbols_lists, extra_linkopts = [], @@ -1682,9 +1673,8 @@ delegate is referenced in the single-target `watchos_application`'s `deps`. bundle_extension = bundle_extension, bundle_name = bundle_name, debug_dependencies = embeddable_targets, - dsym_binaries = debug_outputs.dsym_binaries, dsym_info_plist_template = apple_mac_toolchain_info.dsym_info_plist_template, - executable_name = executable_name, + dsym_outputs = debug_outputs.dsym_outputs, label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, @@ -1746,7 +1736,7 @@ delegate is referenced in the single-target `watchos_application`'s `deps`. actions = actions, binary_artifact = binary_artifact, dependency_targets = embeddable_targets, - dsym_binaries = debug_outputs.dsym_binaries, + dsym_outputs = debug_outputs.dsym_outputs, label_name = label.name, include_symbols_in_bundle = False, platform_prerequisites = platform_prerequisites, diff --git a/apple/internal/xcframework_rules.bzl b/apple/internal/xcframework_rules.bzl index 5295dfa0b3..d13eb5e6ad 100644 --- a/apple/internal/xcframework_rules.bzl +++ b/apple/internal/xcframework_rules.bzl @@ -197,7 +197,7 @@ def _group_link_outputs_by_library_identifier( A list of structs with the following fields; `architectures` containing a list of the architectures that the binary was built with, `binary` referencing the output binary linked with the `lipo` tool if necessary, or referencing a symlink to the original binary if not, - `dsym_binaries` which is a mapping of architectures to dsym binaries if any were created, + `dsym_outputs` which is a mapping of architectures to dsym outputs if any were created, `environment` to reference the target environment the binary was built for, `linkmaps` which is a mapping of architectures to linkmaps if any were created, and `platform` to reference the target platform the binary was built for. @@ -228,7 +228,7 @@ def _group_link_outputs_by_library_identifier( # Iterate through the structure again, this time creating a structure equivalent to link_result # .outputs but with .architecture replaced with .architectures, .dsym_binary replaced with - # .dsym_binaries, and .linkmap replaced with .linkmaps + # .dsym_outputs, and .linkmap replaced with .linkmaps for framework_key, link_outputs in link_outputs_by_framework.items(): inputs = [getattr(output, linking_type) for output in link_outputs] filename = "{}_{}".format(label_name, framework_key) @@ -245,7 +245,7 @@ def _group_link_outputs_by_library_identifier( ) architectures = [] - dsym_binaries = {} + dsym_outputs = {} linkmaps = {} split_attr_keys = [] framework_swift_infos = {} @@ -273,9 +273,9 @@ def _group_link_outputs_by_library_identifier( if _has_non_system_swift_modules(target = dep): framework_swift_infos[link_output.architecture] = dep[SwiftInfo] - # static library linking does not support dsym, and linkmaps yet. + # dSYMs and linkmaps are exclusive to linked binaries, not static library archives. if linking_type == "binary": - dsym_binaries[link_output.architecture] = link_output.dsym_binary + dsym_outputs[link_output.architecture] = link_output.dsym_output linkmaps[link_output.architecture] = link_output.linkmap environment = link_outputs[0].environment @@ -290,7 +290,7 @@ def _group_link_outputs_by_library_identifier( link_outputs_by_library_identifier[library_identifier] = struct( architectures = architectures, binary = fat_binary, - dsym_binaries = dsym_binaries, + dsym_outputs = dsym_outputs, environment = environment, linkmaps = linkmaps, platform = platform, @@ -590,6 +590,7 @@ def _apple_xcframework_impl(ctx): link_result = linking_support.register_binary_linking_action( ctx, + build_settings = apple_xplat_toolchain_info.build_settings, cc_toolchains = cc_toolchain_forwarder, # Frameworks do not have entitlements. entitlements = None, @@ -736,9 +737,8 @@ def _apple_xcframework_impl(ctx): bundle_extension = nested_bundle_extension, bundle_name = bundle_name, debug_discriminator = link_output.platform + "_" + link_output.environment, - dsym_binaries = link_output.dsym_binaries, + dsym_outputs = link_output.dsym_outputs, dsym_info_plist_template = apple_mac_toolchain_info.dsym_info_plist_template, - executable_name = executable_name, label_name = label.name, linkmaps = link_output.linkmaps, output_discriminator = library_identifier, @@ -842,16 +842,20 @@ def _apple_xcframework_impl(ctx): # Save a reference to those archives as file-friendly inputs to the bundler action. framework_archive_files.append(depset([provider.archive])) - # Save the dSYMs. - if getattr(provider, "dsyms", None): - framework_output_files.append(depset(transitive = [provider.dsyms])) - framework_output_groups.append({"dsyms": provider.dsyms}) - # Save the linkmaps. if getattr(provider, "linkmaps", None): framework_output_files.append(depset(transitive = [provider.linkmaps])) framework_output_groups.append({"linkmaps": provider.linkmaps}) + dsyms = outputs.dsyms( + platform_prerequisites = platform_prerequisites, + processor_result = processor_result, + ) + if dsyms: + # Save the dSYMs. + framework_output_files.append(depset(transitive = [dsyms])) + framework_output_groups.append({"dsyms": dsyms}) + # Save additional library details for the XCFramework's root info plist. available_libraries.append(_available_library_dictionary( architectures = link_output.architectures, diff --git a/doc/providers.md b/doc/providers.md index 9cacca33c6..ff1195bc86 100644 --- a/doc/providers.md +++ b/doc/providers.md @@ -282,9 +282,6 @@ Contains information about an Apple dynamic framework. | Name | Description | | :------------- | :------------- | -| framework_dirs | The framework path names used as link inputs in order to link against the dynamic framework. | -| framework_files | The full set of artifacts that should be included as inputs to link against the dynamic framework. | -| binary | The dylib binary artifact of the dynamic framework. | | cc_info | A `CcInfo` which contains information about the transitive dependencies linked into the binary. | diff --git a/test/starlark_tests/apple_xcframework_tests.bzl b/test/starlark_tests/apple_xcframework_tests.bzl index 27b1df3913..c153a75ea1 100644 --- a/test/starlark_tests/apple_xcframework_tests.bzl +++ b/test/starlark_tests/apple_xcframework_tests.bzl @@ -24,6 +24,7 @@ load( ) load( "//test/starlark_tests/rules:analysis_output_group_info_files_test.bzl", + "analysis_output_group_info_dsymutil_bundle_files_test", "analysis_output_group_info_files_test", ) load( @@ -343,6 +344,16 @@ def apple_xcframework_test_suite(name): ], tags = [name], ) + analysis_output_group_info_dsymutil_bundle_files_test( + name = "{}_dsyms_output_group_dsymutil_bundle_files_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/apple:ios_dynamic_xcframework", + output_group_name = "dsyms", + expected_outputs = [ + "ios_arm64_device/ios_dynamic_xcframework.dSYM", + "ios_x86_64_simulator/ios_dynamic_xcframework.dSYM", + ], + tags = [name], + ) analysis_output_group_info_files_test( name = "{}_fat_frameworks_dsyms_output_group_files_test".format(name), target_under_test = "//test/starlark_tests/targets_under_test/apple:ios_dynamic_lipoed_xcframework", @@ -355,6 +366,16 @@ def apple_xcframework_test_suite(name): ], tags = [name], ) + analysis_output_group_info_dsymutil_bundle_files_test( + name = "{}_fat_frameworks_dsyms_output_group_dsymutil_bundle_files_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/apple:ios_dynamic_lipoed_xcframework", + output_group_name = "dsyms", + expected_outputs = [ + "ios_dynamic_lipoed_xcframework_ios_device.framework.dSYM", + "ios_dynamic_lipoed_xcframework_ios_simulator.framework.dSYM", + ], + tags = [name], + ) linkmap_test( name = "{}_device_linkmap_test".format(name), diff --git a/test/starlark_tests/ios_app_clip_tests.bzl b/test/starlark_tests/ios_app_clip_tests.bzl index 5d95b9203e..e40621293e 100644 --- a/test/starlark_tests/ios_app_clip_tests.bzl +++ b/test/starlark_tests/ios_app_clip_tests.bzl @@ -16,10 +16,12 @@ load( "//test/starlark_tests/rules:analysis_output_group_info_files_test.bzl", + "analysis_output_group_info_dsymutil_bundle_files_test", "analysis_output_group_info_files_test", ) load( "//test/starlark_tests/rules:apple_dsym_bundle_info_test.bzl", + "apple_dsym_bundle_info_dsymutil_bundle_test", "apple_dsym_bundle_info_test", ) load( @@ -195,6 +197,18 @@ def ios_app_clip_test_suite(name): ], tags = [name], ) + analysis_output_group_info_dsymutil_bundle_files_test( + name = "{}_with_runtime_framework_transitive_dsyms_output_group_info_dsymutil_bundle_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/ios:app_clip_with_fmwks_from_objc_swift_libraries_using_data", + output_group_name = "dsyms", + expected_outputs = [ + "app_clip_with_fmwks_from_objc_swift_libraries_using_data.app.dSYM", + "fmwk_min_os_baseline_with_bundle.framework.dSYM", + "fmwk_no_version.framework.dSYM", + "fmwk_with_resources.framework.dSYM", + ], + tags = [name], + ) analysis_output_group_info_files_test( name = "{}_with_runtime_framework_transitive_linkmaps_output_group_info_test".format(name), target_under_test = "//test/starlark_tests/targets_under_test/ios:app_clip_with_fmwks_from_objc_swift_libraries_using_data", @@ -227,6 +241,20 @@ def ios_app_clip_test_suite(name): ], tags = [name], ) + apple_dsym_bundle_info_dsymutil_bundle_test( + name = "{}_with_runtime_framework_dsym_bundle_info_dsymutil_bundle_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/ios:app_clip_with_fmwks_from_objc_swift_libraries_using_data", + expected_direct_dsyms = [ + "app_clip_with_fmwks_from_objc_swift_libraries_using_data.app.dSYM", + ], + expected_transitive_dsyms = [ + "app_clip_with_fmwks_from_objc_swift_libraries_using_data.app.dSYM", + "fmwk_min_os_baseline_with_bundle.framework.dSYM", + "fmwk_no_version.framework.dSYM", + "fmwk_with_resources.framework.dSYM", + ], + tags = [name], + ) # Tests inclusion of extensions. archive_contents_test( diff --git a/test/starlark_tests/ios_application_tests.bzl b/test/starlark_tests/ios_application_tests.bzl index 4cd03273b6..b8ef75fefd 100644 --- a/test/starlark_tests/ios_application_tests.bzl +++ b/test/starlark_tests/ios_application_tests.bzl @@ -24,6 +24,7 @@ load( ) load( "//test/starlark_tests/rules:analysis_output_group_info_files_test.bzl", + "analysis_output_group_info_dsymutil_bundle_files_test", "analysis_output_group_info_files_test", ) load( @@ -42,6 +43,7 @@ load( ) load( "//test/starlark_tests/rules:apple_dsym_bundle_info_test.bzl", + "apple_dsym_bundle_info_dsymutil_bundle_test", "apple_dsym_bundle_info_test", ) load( @@ -574,6 +576,17 @@ def ios_application_test_suite(name): ], tags = [name], ) + + analysis_output_group_info_dsymutil_bundle_files_test( + name = "{}_dsyms_output_group_dsymutil_bundle_files_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/ios:app", + output_group_name = "dsyms", + expected_outputs = [ + "app.app.dSYM", + ], + tags = [name], + ) + apple_dsym_bundle_info_test( name = "{}_dsym_bundle_info_files_test".format(name), target_under_test = "//test/starlark_tests/targets_under_test/ios:app", @@ -586,6 +599,18 @@ def ios_application_test_suite(name): tags = [name], ) + apple_dsym_bundle_info_dsymutil_bundle_test( + name = "{}_dsym_bundle_info_dsymutil_bundle_files_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/ios:app", + expected_direct_dsyms = [ + "app.app.dSYM", + ], + expected_transitive_dsyms = [ + "app.app.dSYM", + ], + tags = [name], + ) + analysis_output_group_info_files_test( name = "{}_dsyms_output_group_transitive_files_test".format(name), target_under_test = "//test/starlark_tests/targets_under_test/ios:app_with_ext_and_fmwk_provisioned", @@ -600,8 +625,21 @@ def ios_application_test_suite(name): ], tags = [name], ) + + analysis_output_group_info_dsymutil_bundle_files_test( + name = "{}_dsyms_output_group_dsymutil_bundle_transitive_files_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/ios:app_with_ext_and_fmwk_provisioned", + output_group_name = "dsyms", + expected_outputs = [ + "app_with_ext_and_fmwk_provisioned.app.dSYM", + "ext_with_fmwk_provisioned.appex.dSYM", + "fmwk_with_provisioning.framework.dSYM", + ], + tags = [name], + ) + apple_dsym_bundle_info_test( - name = "{}_transitive_dsyms_test".format(name), + name = "{}_dsymutil_bundle_transitive_dsyms_test".format(name), target_under_test = "//test/starlark_tests/targets_under_test/ios:app_with_ext_and_fmwk_provisioned", expected_direct_dsyms = [ "dSYMs/app_with_ext_and_fmwk_provisioned.app.dSYM", @@ -614,6 +652,20 @@ def ios_application_test_suite(name): tags = [name], ) + apple_dsym_bundle_info_dsymutil_bundle_test( + name = "{}_transitive_dsyms_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/ios:app_with_ext_and_fmwk_provisioned", + expected_direct_dsyms = [ + "app_with_ext_and_fmwk_provisioned.app.dSYM", + ], + expected_transitive_dsyms = [ + "fmwk_with_provisioning.framework.dSYM", + "ext_with_fmwk_provisioned.appex.dSYM", + "app_with_ext_and_fmwk_provisioned.app.dSYM", + ], + tags = [name], + ) + apple_dsym_bundle_info_test( name = "{}_custom_executable_name_dsyms_test".format(name), target_under_test = "//test/starlark_tests/targets_under_test/ios:app_with_custom_executable_name", @@ -1012,6 +1064,22 @@ def ios_application_test_suite(name): ], tags = [name], ) + + analysis_output_group_info_dsymutil_bundle_files_test( + name = "{}_with_runtime_framework_transitive_dsyms_output_group_info_dsymutil_bundle_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/ios:app_with_fmwks_from_frameworks_and_objc_swift_libraries_using_data", + output_group_name = "dsyms", + expected_outputs = [ + "app_with_fmwks_from_frameworks_and_objc_swift_libraries_using_data.app.dSYM", + # Frameworks + "fmwk.framework.dSYM", + "fmwk_min_os_baseline_with_bundle.framework.dSYM", + "fmwk_no_version.framework.dSYM", + "fmwk_with_resources.framework.dSYM", + ], + tags = [name], + ) + analysis_output_group_info_files_test( name = "{}_with_runtime_framework_transitive_linkmaps_output_group_info_test".format(name), target_under_test = "//test/starlark_tests/targets_under_test/ios:app_with_fmwks_from_frameworks_and_objc_swift_libraries_using_data", @@ -1048,6 +1116,22 @@ def ios_application_test_suite(name): tags = [name], ) + apple_dsym_bundle_info_dsymutil_bundle_test( + name = "{}_with_runtime_framework_dsym_bundle_info_files_dsymutil_bundle_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/ios:app_with_fmwks_from_frameworks_and_objc_swift_libraries_using_data", + expected_direct_dsyms = [ + "app_with_fmwks_from_frameworks_and_objc_swift_libraries_using_data.app.dSYM", + ], + expected_transitive_dsyms = [ + "app_with_fmwks_from_frameworks_and_objc_swift_libraries_using_data.app.dSYM", + "fmwk.framework.dSYM", + "fmwk_min_os_baseline_with_bundle.framework.dSYM", + "fmwk_no_version.framework.dSYM", + "fmwk_with_resources.framework.dSYM", + ], + tags = [name], + ) + analysis_failure_message_test( name = "{}_no_bundle_id_fail_test".format(name), target_under_test = "//test/starlark_tests/targets_under_test/ios:app_with_no_bundle_id", diff --git a/test/starlark_tests/ios_extension_tests.bzl b/test/starlark_tests/ios_extension_tests.bzl index 551a966d1f..5ebcb32d75 100644 --- a/test/starlark_tests/ios_extension_tests.bzl +++ b/test/starlark_tests/ios_extension_tests.bzl @@ -16,10 +16,12 @@ load( "//test/starlark_tests/rules:analysis_output_group_info_files_test.bzl", + "analysis_output_group_info_dsymutil_bundle_files_test", "analysis_output_group_info_files_test", ) load( "//test/starlark_tests/rules:apple_dsym_bundle_info_test.bzl", + "apple_dsym_bundle_info_dsymutil_bundle_test", "apple_dsym_bundle_info_test", ) load( @@ -101,6 +103,16 @@ def ios_extension_test_suite(name): ], tags = [name], ) + analysis_output_group_info_dsymutil_bundle_files_test( + name = "{}_dsyms_output_group_dsymutil_bundle_files_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/ios:ext", + output_group_name = "dsyms", + expected_outputs = [ + "ext.appex.dSYM", + ], + tags = [name], + ) + apple_dsym_bundle_info_test( name = "{}_dsym_bundle_info_files_test".format(name), target_under_test = "//test/starlark_tests/targets_under_test/ios:ext", @@ -108,6 +120,13 @@ def ios_extension_test_suite(name): expected_transitive_dsyms = ["dSYMs/ext.appex.dSYM"], tags = [name], ) + apple_dsym_bundle_info_dsymutil_bundle_test( + name = "{}_dsym_bundle_info_dsymutil_bundle_files_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/ios:ext", + expected_direct_dsyms = ["ext.appex.dSYM"], + expected_transitive_dsyms = ["ext.appex.dSYM"], + tags = [name], + ) infoplist_contents_test( name = "{}_plist_test".format(name), @@ -289,6 +308,18 @@ def ios_extension_test_suite(name): ], tags = [name], ) + analysis_output_group_info_dsymutil_bundle_files_test( + name = "{}_with_runtime_framework_transitive_dsyms_output_group_dsymutil_bundle_files_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/ios:ext_with_fmwks_from_objc_swift_libraries_using_data", + output_group_name = "dsyms", + expected_outputs = [ + "ext_with_fmwks_from_objc_swift_libraries_using_data.appex.dSYM", + "fmwk_min_os_baseline_with_bundle.framework.dSYM", + "fmwk_no_version.framework.dSYM", + "fmwk_with_resources.framework.dSYM", + ], + tags = [name], + ) analysis_output_group_info_files_test( name = "{}_with_runtime_framework_transitive_linkmaps_output_group_info_test".format(name), target_under_test = "//test/starlark_tests/targets_under_test/ios:ext_with_fmwks_from_objc_swift_libraries_using_data", @@ -321,6 +352,20 @@ def ios_extension_test_suite(name): ], tags = [name], ) + apple_dsym_bundle_info_dsymutil_bundle_test( + name = "{}_with_runtime_framework_dsym_bundle_info_dsymutil_bundle_files_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/ios:ext_with_fmwks_from_objc_swift_libraries_using_data", + expected_direct_dsyms = [ + "ext_with_fmwks_from_objc_swift_libraries_using_data.appex.dSYM", + ], + expected_transitive_dsyms = [ + "ext_with_fmwks_from_objc_swift_libraries_using_data.appex.dSYM", + "fmwk_min_os_baseline_with_bundle.framework.dSYM", + "fmwk_no_version.framework.dSYM", + "fmwk_with_resources.framework.dSYM", + ], + tags = [name], + ) infoplist_contents_test( name = "{}_capability_set_derived_bundle_id_plist_test".format(name), diff --git a/test/starlark_tests/ios_framework_tests.bzl b/test/starlark_tests/ios_framework_tests.bzl index a45011eec9..c6992247ea 100644 --- a/test/starlark_tests/ios_framework_tests.bzl +++ b/test/starlark_tests/ios_framework_tests.bzl @@ -20,10 +20,12 @@ load( ) load( "//test/starlark_tests/rules:analysis_output_group_info_files_test.bzl", + "analysis_output_group_info_dsymutil_bundle_files_test", "analysis_output_group_info_files_test", ) load( "//test/starlark_tests/rules:apple_dsym_bundle_info_test.bzl", + "apple_dsym_bundle_info_dsymutil_bundle_test", "apple_dsym_bundle_info_test", ) load( @@ -648,6 +650,18 @@ def ios_framework_test_suite(name): ], tags = [name], ) + analysis_output_group_info_dsymutil_bundle_files_test( + name = "{}_with_runtime_framework_transitive_dsyms_output_group_info_dsymutil_bundle_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/ios:fmwk_with_fmwks_from_objc_swift_libraries_using_data", + output_group_name = "dsyms", + expected_outputs = [ + "fmwk_with_fmwks_from_objc_swift_libraries_using_data.framework.dSYM", + "fmwk_min_os_baseline_with_bundle.framework.dSYM", + "fmwk_no_version.framework.dSYM", + "fmwk_with_resources.framework.dSYM", + ], + tags = [name], + ) analysis_output_group_info_files_test( name = "{}_with_runtime_framework_transitive_linkmaps_output_group_info_test".format(name), target_under_test = "//test/starlark_tests/targets_under_test/ios:fmwk_with_fmwks_from_objc_swift_libraries_using_data", @@ -680,6 +694,20 @@ def ios_framework_test_suite(name): ], tags = [name], ) + apple_dsym_bundle_info_dsymutil_bundle_test( + name = "{}_with_runtime_framework_dsym_bundle_info_dsymutil_bundle_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/ios:fmwk_with_fmwks_from_objc_swift_libraries_using_data", + expected_direct_dsyms = [ + "fmwk_with_fmwks_from_objc_swift_libraries_using_data.framework.dSYM", + ], + expected_transitive_dsyms = [ + "fmwk_with_fmwks_from_objc_swift_libraries_using_data.framework.dSYM", + "fmwk_min_os_baseline_with_bundle.framework.dSYM", + "fmwk_no_version.framework.dSYM", + "fmwk_with_resources.framework.dSYM", + ], + tags = [name], + ) infoplist_contents_test( name = "{}_base_bundle_id_derived_bundle_id_plist_test".format(name), diff --git a/test/starlark_tests/ios_ui_test_tests.bzl b/test/starlark_tests/ios_ui_test_tests.bzl index 7dde2c7c1b..054263ad65 100644 --- a/test/starlark_tests/ios_ui_test_tests.bzl +++ b/test/starlark_tests/ios_ui_test_tests.bzl @@ -20,10 +20,12 @@ load( ) load( "//test/starlark_tests/rules:analysis_output_group_info_files_test.bzl", + "analysis_output_group_info_dsymutil_bundle_files_test", "analysis_output_group_info_files_test", ) load( "//test/starlark_tests/rules:apple_dsym_bundle_info_test.bzl", + "apple_dsym_bundle_info_dsymutil_bundle_test", "apple_dsym_bundle_info_test", ) load( @@ -93,6 +95,16 @@ def ios_ui_test_test_suite(name): ], tags = [name], ) + analysis_output_group_info_dsymutil_bundle_files_test( + name = "{}_dsyms_output_group_info_dsymutil_bundle_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/ios:ui_test", + output_group_name = "dsyms", + expected_outputs = [ + "app.app.dSYM", + "ui_test.xctest.dSYM", + ], + tags = [name], + ) apple_dsym_bundle_info_test( name = "{}_apple_dsym_bundle_info_test".format(name), target_under_test = "//test/starlark_tests/targets_under_test/ios:ui_test", @@ -100,6 +112,13 @@ def ios_ui_test_test_suite(name): expected_transitive_dsyms = ["dSYMs/app.app.dSYM", "dSYMs/ui_test.xctest.dSYM"], tags = [name], ) + apple_dsym_bundle_info_dsymutil_bundle_test( + name = "{}_apple_dsym_bundle_info_dsymutil_bundle_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/ios:ui_test", + expected_direct_dsyms = ["ui_test.xctest.dSYM"], + expected_transitive_dsyms = ["app.app.dSYM", "ui_test.xctest.dSYM"], + tags = [name], + ) infoplist_contents_test( name = "{}_test_bundle_id_override".format(name), diff --git a/test/starlark_tests/ios_unit_test_tests.bzl b/test/starlark_tests/ios_unit_test_tests.bzl index 77af37c9b9..1ccfaa0c49 100644 --- a/test/starlark_tests/ios_unit_test_tests.bzl +++ b/test/starlark_tests/ios_unit_test_tests.bzl @@ -24,10 +24,12 @@ load( ) load( "//test/starlark_tests/rules:analysis_output_group_info_files_test.bzl", + "analysis_output_group_info_dsymutil_bundle_files_test", "analysis_output_group_info_files_test", ) load( "//test/starlark_tests/rules:apple_dsym_bundle_info_test.bzl", + "apple_dsym_bundle_info_dsymutil_bundle_test", "apple_dsym_bundle_info_test", ) load( @@ -103,6 +105,16 @@ def ios_unit_test_test_suite(name): ], tags = [name], ) + analysis_output_group_info_dsymutil_bundle_files_test( + name = "{}_dsyms_output_group_info_dsymutil_bundle_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/ios:unit_test", + output_group_name = "dsyms", + expected_outputs = [ + "app.app.dSYM", + "unit_test.xctest.dSYM", + ], + tags = [name], + ) apple_dsym_bundle_info_test( name = "{}_apple_dsym_bundle_info_test".format(name), target_under_test = "//test/starlark_tests/targets_under_test/ios:unit_test", @@ -110,6 +122,13 @@ def ios_unit_test_test_suite(name): expected_transitive_dsyms = ["dSYMs/app.app.dSYM", "dSYMs/unit_test.xctest.dSYM"], tags = [name], ) + apple_dsym_bundle_info_dsymutil_bundle_test( + name = "{}_apple_dsym_bundle_info_dsymutil_bundle_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/ios:unit_test", + expected_direct_dsyms = ["unit_test.xctest.dSYM"], + expected_transitive_dsyms = ["app.app.dSYM", "unit_test.xctest.dSYM"], + tags = [name], + ) infoplist_contents_test( name = "{}_test_bundle_id_override".format(name), diff --git a/test/starlark_tests/macos_application_tests.bzl b/test/starlark_tests/macos_application_tests.bzl index 89de58c569..e90adf7af8 100644 --- a/test/starlark_tests/macos_application_tests.bzl +++ b/test/starlark_tests/macos_application_tests.bzl @@ -20,11 +20,13 @@ load( ) load( "//test/starlark_tests/rules:analysis_output_group_info_files_test.bzl", + "analysis_output_group_info_dsymutil_bundle_files_test", "analysis_output_group_info_files_test", ) load( "//test/starlark_tests/rules:analysis_runfiles_test.bzl", "analysis_runfiles_dsym_test", + "analysis_runfiles_dsymutil_bundle_test", ) load( "//test/starlark_tests/rules:analysis_target_actions_test.bzl", @@ -33,6 +35,7 @@ load( ) load( "//test/starlark_tests/rules:apple_dsym_bundle_info_test.bzl", + "apple_dsym_bundle_info_dsymutil_bundle_test", "apple_dsym_bundle_info_test", ) load( @@ -326,6 +329,15 @@ def macos_application_test_suite(name): ], tags = [name], ) + analysis_output_group_info_dsymutil_bundle_files_test( + name = "{}_dsyms_output_group_dsymutil_bundle_files_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/macos:app", + output_group_name = "dsyms", + expected_outputs = [ + "app.app.dSYM", + ], + tags = [name], + ) apple_dsym_bundle_info_test( name = "{}_dsym_bundle_info_files_test".format(name), target_under_test = "//test/starlark_tests/targets_under_test/macos:app", @@ -337,6 +349,17 @@ def macos_application_test_suite(name): ], tags = [name], ) + apple_dsym_bundle_info_dsymutil_bundle_test( + name = "{}_dsym_bundle_info_dsymutil_bundle_files_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/macos:app", + expected_direct_dsyms = [ + "app.app.dSYM", + ], + expected_transitive_dsyms = [ + "app.app.dSYM", + ], + tags = [name], + ) analysis_runfiles_dsym_test( name = "{}_runfiles_dsym_test".format(name), @@ -348,6 +371,15 @@ def macos_application_test_suite(name): tags = [name], ) + analysis_runfiles_dsymutil_bundle_test( + name = "{}_runfiles_dsymutil_bundle_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/macos:app", + expected_runfiles = [ + "third_party/bazel_rules/rules_apple/test/starlark_tests/targets_under_test/macos/darwin_arm64/app.app.dSYM", + ], + tags = [name], + ) + infoplist_contents_test( name = "{}_plist_test".format(name), target_under_test = "//test/starlark_tests/targets_under_test/macos:app", diff --git a/test/starlark_tests/macos_bundle_tests.bzl b/test/starlark_tests/macos_bundle_tests.bzl index d336f8df81..d8e8635933 100644 --- a/test/starlark_tests/macos_bundle_tests.bzl +++ b/test/starlark_tests/macos_bundle_tests.bzl @@ -16,10 +16,12 @@ load( "//test/starlark_tests/rules:analysis_output_group_info_files_test.bzl", + "analysis_output_group_info_dsymutil_bundle_files_test", "analysis_output_group_info_files_test", ) load( "//test/starlark_tests/rules:apple_dsym_bundle_info_test.bzl", + "apple_dsym_bundle_info_dsymutil_bundle_test", "apple_dsym_bundle_info_test", ) load( @@ -163,6 +165,15 @@ def macos_bundle_test_suite(name): ], tags = [name], ) + analysis_output_group_info_dsymutil_bundle_files_test( + name = "{}_dsyms_output_group_info_dsymutil_bundle_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/macos:bundle", + output_group_name = "dsyms", + expected_outputs = [ + "bundle.bundle.dSYM", + ], + tags = [name], + ) apple_dsym_bundle_info_test( name = "{}_dsym_bundle_info_files_test".format(name), target_under_test = "//test/starlark_tests/targets_under_test/macos:bundle", @@ -170,6 +181,13 @@ def macos_bundle_test_suite(name): expected_transitive_dsyms = ["dSYMs/bundle.bundle.dSYM"], tags = [name], ) + apple_dsym_bundle_info_dsymutil_bundle_test( + name = "{}_dsym_bundle_info_dsymutil_bundle_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/macos:bundle", + expected_direct_dsyms = ["bundle.bundle.dSYM"], + expected_transitive_dsyms = ["bundle.bundle.dSYM"], + tags = [name], + ) infoplist_contents_test( name = "{}_capability_set_derived_bundle_id_plist_test".format(name), diff --git a/test/starlark_tests/macos_command_line_application_tests.bzl b/test/starlark_tests/macos_command_line_application_tests.bzl index 1f14b507e5..f871c536af 100644 --- a/test/starlark_tests/macos_command_line_application_tests.bzl +++ b/test/starlark_tests/macos_command_line_application_tests.bzl @@ -16,11 +16,13 @@ load( "//test/starlark_tests/rules:analysis_output_group_info_files_test.bzl", + "analysis_output_group_info_dsymutil_bundle_files_test", "analysis_output_group_info_files_test", ) load( "//test/starlark_tests/rules:analysis_runfiles_test.bzl", "analysis_runfiles_dsym_test", + "analysis_runfiles_dsymutil_bundle_test", ) load( "//test/starlark_tests/rules:analysis_target_actions_test.bzl", @@ -28,6 +30,7 @@ load( ) load( "//test/starlark_tests/rules:apple_dsym_bundle_info_test.bzl", + "apple_dsym_bundle_info_dsymutil_bundle_test", "apple_dsym_bundle_info_test", ) load( @@ -216,6 +219,15 @@ def macos_command_line_application_test_suite(name): ], tags = [name], ) + analysis_output_group_info_dsymutil_bundle_files_test( + name = "{}_dsyms_output_group_dsymutil_bundle_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/macos:cmd_app_basic", + output_group_name = "dsyms", + expected_outputs = [ + "cmd_app_basic.dSYM", + ], + tags = [name], + ) apple_dsym_bundle_info_test( name = "{}_dsym_bundle_info_files_test".format(name), target_under_test = "//test/starlark_tests/targets_under_test/macos:cmd_app_basic", @@ -223,6 +235,13 @@ def macos_command_line_application_test_suite(name): expected_transitive_dsyms = ["dSYMs/cmd_app_basic.dSYM"], tags = [name], ) + apple_dsym_bundle_info_dsymutil_bundle_test( + name = "{}_dsym_bundle_info_dsymutil_bundle_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/macos:cmd_app_basic", + expected_direct_dsyms = ["cmd_app_basic.dSYM"], + expected_transitive_dsyms = ["cmd_app_basic.dSYM"], + tags = [name], + ) infoplist_contents_test( name = "{}_infoplist_test".format(name), @@ -257,6 +276,15 @@ def macos_command_line_application_test_suite(name): tags = [name], ) + analysis_runfiles_dsymutil_bundle_test( + name = "{}_runfiles_dsymutil_bundle_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/macos:cmd_app_basic", + expected_runfiles = [ + "third_party/bazel_rules/rules_apple/test/starlark_tests/targets_under_test/macos/darwin_arm64/cmd_app_basic.dSYM", + ], + tags = [name], + ) + binary_contents_test( name = "{}_version_plist_test".format(name), build_type = "device", diff --git a/test/starlark_tests/macos_dylib_tests.bzl b/test/starlark_tests/macos_dylib_tests.bzl index e597b7b50f..2484616057 100644 --- a/test/starlark_tests/macos_dylib_tests.bzl +++ b/test/starlark_tests/macos_dylib_tests.bzl @@ -16,10 +16,12 @@ load( "//test/starlark_tests/rules:analysis_output_group_info_files_test.bzl", + "analysis_output_group_info_dsymutil_bundle_files_test", "analysis_output_group_info_files_test", ) load( "//test/starlark_tests/rules:apple_dsym_bundle_info_test.bzl", + "apple_dsym_bundle_info_dsymutil_bundle_test", "apple_dsym_bundle_info_test", ) load( @@ -97,6 +99,15 @@ def macos_dylib_test_suite(name): ], tags = [name], ) + analysis_output_group_info_dsymutil_bundle_files_test( + name = "{}_dsyms_output_group_info_dsymutil_bundle_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/macos:dylib", + output_group_name = "dsyms", + expected_outputs = [ + "dylib.dSYM", + ], + tags = [name], + ) apple_dsym_bundle_info_test( name = "{}_dsym_bundle_info_files_test".format(name), target_under_test = "//test/starlark_tests/targets_under_test/macos:dylib", @@ -104,6 +115,13 @@ def macos_dylib_test_suite(name): expected_transitive_dsyms = ["dSYMs/dylib.dSYM"], tags = [name], ) + apple_dsym_bundle_info_dsymutil_bundle_test( + name = "{}_dsym_bundle_info_dsymutil_bundle_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/macos:dylib", + expected_direct_dsyms = ["dylib.dSYM"], + expected_transitive_dsyms = ["dylib.dSYM"], + tags = [name], + ) infoplist_contents_test( name = "{}_infoplist_test".format(name), diff --git a/test/starlark_tests/macos_ui_test_tests.bzl b/test/starlark_tests/macos_ui_test_tests.bzl index 9d27d63d6e..d49f029723 100644 --- a/test/starlark_tests/macos_ui_test_tests.bzl +++ b/test/starlark_tests/macos_ui_test_tests.bzl @@ -20,10 +20,12 @@ load( ) load( "//test/starlark_tests/rules:analysis_output_group_info_files_test.bzl", + "analysis_output_group_info_dsymutil_bundle_files_test", "analysis_output_group_info_files_test", ) load( "//test/starlark_tests/rules:apple_dsym_bundle_info_test.bzl", + "apple_dsym_bundle_info_dsymutil_bundle_test", "apple_dsym_bundle_info_test", ) load( @@ -99,6 +101,16 @@ def macos_ui_test_test_suite(name): ], tags = [name], ) + analysis_output_group_info_dsymutil_bundle_files_test( + name = "{}_dsyms_output_group_info_dsymutil_bundle_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/macos:ui_test", + output_group_name = "dsyms", + expected_outputs = [ + "app.app.dSYM", + "ui_test.xctest.dSYM", + ], + tags = [name], + ) apple_dsym_bundle_info_test( name = "{}_apple_dsym_bundle_info_test".format(name), target_under_test = "//test/starlark_tests/targets_under_test/macos:ui_test", @@ -106,6 +118,13 @@ def macos_ui_test_test_suite(name): expected_transitive_dsyms = ["dSYMs/app.app.dSYM", "dSYMs/ui_test.xctest.dSYM"], tags = [name], ) + apple_dsym_bundle_info_dsymutil_bundle_test( + name = "{}_apple_dsym_bundle_info_dsymutil_bundle_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/macos:ui_test", + expected_direct_dsyms = ["ui_test.xctest.dSYM"], + expected_transitive_dsyms = ["app.app.dSYM", "ui_test.xctest.dSYM"], + tags = [name], + ) infoplist_contents_test( name = "{}_test_bundle_id_override".format(name), diff --git a/test/starlark_tests/macos_unit_test_tests.bzl b/test/starlark_tests/macos_unit_test_tests.bzl index ae7e1510d7..fffc847f52 100644 --- a/test/starlark_tests/macos_unit_test_tests.bzl +++ b/test/starlark_tests/macos_unit_test_tests.bzl @@ -20,6 +20,7 @@ load( ) load( "//test/starlark_tests/rules:analysis_output_group_info_files_test.bzl", + "analysis_output_group_info_dsymutil_bundle_files_test", "analysis_output_group_info_files_test", ) load( @@ -28,6 +29,7 @@ load( ) load( "//test/starlark_tests/rules:apple_dsym_bundle_info_test.bzl", + "apple_dsym_bundle_info_dsymutil_bundle_test", "apple_dsym_bundle_info_test", ) load( @@ -103,6 +105,16 @@ def macos_unit_test_test_suite(name): ], tags = [name], ) + analysis_output_group_info_dsymutil_bundle_files_test( + name = "{}_dsyms_output_group_info_dsymutil_bundle_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/macos:unit_test", + output_group_name = "dsyms", + expected_outputs = [ + "app.app.dSYM", + "unit_test.xctest.dSYM", + ], + tags = [name], + ) apple_dsym_bundle_info_test( name = "{}_apple_dsym_bundle_info_test".format(name), target_under_test = "//test/starlark_tests/targets_under_test/macos:unit_test", @@ -110,6 +122,13 @@ def macos_unit_test_test_suite(name): expected_transitive_dsyms = ["dSYMs/app.app.dSYM", "dSYMs/unit_test.xctest.dSYM"], tags = [name], ) + apple_dsym_bundle_info_dsymutil_bundle_test( + name = "{}_apple_dsym_bundle_info_dsymutil_bundle_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/macos:unit_test", + expected_direct_dsyms = ["unit_test.xctest.dSYM"], + expected_transitive_dsyms = ["app.app.dSYM", "unit_test.xctest.dSYM"], + tags = [name], + ) infoplist_contents_test( name = "{}_test_bundle_id_override".format(name), diff --git a/test/starlark_tests/rules/analysis_output_group_info_files_test.bzl b/test/starlark_tests/rules/analysis_output_group_info_files_test.bzl index 78f8945f37..3f36eb2268 100644 --- a/test/starlark_tests/rules/analysis_output_group_info_files_test.bzl +++ b/test/starlark_tests/rules/analysis_output_group_info_files_test.bzl @@ -14,6 +14,10 @@ """Starlark test rule for OutputGroupInfo output group files.""" +load( + "//apple/build_settings:build_settings.bzl", + "build_settings_labels", +) load( "//test/starlark_tests/rules:analysis_provider_test.bzl", "make_provider_test_rule", @@ -61,6 +65,7 @@ def make_analysis_output_group_info_files_test(config_settings = {}): ), }, config_settings = { + build_settings_labels.dsym_variant_flag: "flat", "//command_line_option:objc_generate_linkmap": "true", # output_group: linkmaps "//command_line_option:apple_generate_dsym": "true", # output_group: dsyms "//command_line_option:macos_cpus": "arm64,x86_64", @@ -72,3 +77,29 @@ def make_analysis_output_group_info_files_test(config_settings = {}): ) analysis_output_group_info_files_test = make_analysis_output_group_info_files_test() + +analysis_output_group_info_dsymutil_bundle_files_test = make_provider_test_rule( + provider = OutputGroupInfo, + provider_fn = _get_output_group_files, + assertion_fn = _analysis_output_group_info_files_test_assertion, + attrs = { + "output_group_name": attr.string( + mandatory = True, + doc = "Name of the output group to source files from.", + ), + "expected_outputs": attr.string_list( + mandatory = True, + doc = "List of relative output file paths expected as outputs of the output group.", + ), + }, + config_settings = { + build_settings_labels.dsym_variant_flag: "bundle", + "//command_line_option:objc_generate_linkmap": "true", # output_group: linkmaps + "//command_line_option:apple_generate_dsym": "true", # output_group: dsyms + "//command_line_option:macos_cpus": "arm64,x86_64", + "//command_line_option:ios_multi_cpus": "sim_arm64,x86_64", + "//command_line_option:tvos_cpus": "sim_arm64,x86_64", + "//command_line_option:visionos_cpus": "sim_arm64", + "//command_line_option:watchos_cpus": "arm64,x86_64", + }, +) diff --git a/test/starlark_tests/rules/analysis_runfiles_test.bzl b/test/starlark_tests/rules/analysis_runfiles_test.bzl index 98a26a1fdf..9451e1a367 100644 --- a/test/starlark_tests/rules/analysis_runfiles_test.bzl +++ b/test/starlark_tests/rules/analysis_runfiles_test.bzl @@ -19,6 +19,10 @@ load( "analysistest", "unittest", ) +load( + "//apple/build_settings:build_settings.bzl", + "build_settings_labels", +) def _analysis_runfiles_test_impl(ctx): "Test that runfiles of the given target under test is properly set." @@ -62,7 +66,15 @@ def make_analysis_runfiles_test_rule( # A generic analysis_runfiles_test with no custom settings. analysis_runfiles_test = make_analysis_runfiles_test_rule() -# An analysis_runfiles_test that generates dsyms. +# An analysis_runfiles_test that generates "flat file" dSYMs. analysis_runfiles_dsym_test = make_analysis_runfiles_test_rule(config_settings = { + build_settings_labels.dsym_variant_flag: "flat", + "//command_line_option:apple_generate_dsym": "true", + "//command_line_option:macos_cpus": "arm64", +}) + +# An analysis_runfiles_test that generates dSYMs bundles using dsymutil. +analysis_runfiles_dsymutil_bundle_test = make_analysis_runfiles_test_rule(config_settings = { + build_settings_labels.dsym_variant_flag: "bundle", "//command_line_option:apple_generate_dsym": "true", }) diff --git a/test/starlark_tests/rules/apple_dsym_bundle_info_test.bzl b/test/starlark_tests/rules/apple_dsym_bundle_info_test.bzl index ef00baa7bf..6f15a489a6 100644 --- a/test/starlark_tests/rules/apple_dsym_bundle_info_test.bzl +++ b/test/starlark_tests/rules/apple_dsym_bundle_info_test.bzl @@ -18,6 +18,10 @@ load( "//apple:providers.bzl", "AppleDsymBundleInfo", ) +load( + "//apple/build_settings:build_settings.bzl", + "build_settings_labels", +) load( "//test/starlark_tests/rules:analysis_provider_test.bzl", "make_provider_test_rule", @@ -45,26 +49,44 @@ def _assert_contains_expected_direct_and_transitive_dsyms( actual_files = apple_dsym_bundle_info.transitive_dsyms.to_list(), ) -apple_dsym_bundle_info_test = make_provider_test_rule( - provider = AppleDsymBundleInfo, - assertion_fn = _assert_contains_expected_direct_and_transitive_dsyms, - attrs = { - "expected_direct_dsyms": attr.string_list( - mandatory = True, - doc = """ +_SHARED_ATTRS = { + "expected_direct_dsyms": attr.string_list( + mandatory = True, + doc = """ List of bundle names in the format . to verify that dSYM bundles are created for them as direct dependencies of the given providers. """, - ), - "expected_transitive_dsyms": attr.string_list( - mandatory = True, - doc = """ + ), + "expected_transitive_dsyms": attr.string_list( + mandatory = True, + doc = """ List of bundle names in the format . to verify that dSYM bundles are created for them as transitive dependencies of the given providers. """, - ), + ), +} + +apple_dsym_bundle_info_test = make_provider_test_rule( + provider = AppleDsymBundleInfo, + assertion_fn = _assert_contains_expected_direct_and_transitive_dsyms, + attrs = _SHARED_ATTRS, + config_settings = { + build_settings_labels.dsym_variant_flag: "flat", + "//command_line_option:apple_generate_dsym": "true", + "//command_line_option:macos_cpus": "arm64,x86_64", + "//command_line_option:ios_multi_cpus": "sim_arm64,x86_64", + "//command_line_option:tvos_cpus": "sim_arm64,x86_64", + "//command_line_option:visionos_cpus": "sim_arm64", + "//command_line_option:watchos_cpus": "arm64,x86_64", }, +) + +apple_dsym_bundle_info_dsymutil_bundle_test = make_provider_test_rule( + provider = AppleDsymBundleInfo, + assertion_fn = _assert_contains_expected_direct_and_transitive_dsyms, + attrs = _SHARED_ATTRS, config_settings = { + build_settings_labels.dsym_variant_flag: "bundle", "//command_line_option:apple_generate_dsym": "true", "//command_line_option:macos_cpus": "arm64,x86_64", "//command_line_option:ios_multi_cpus": "sim_arm64,x86_64", diff --git a/test/starlark_tests/tvos_application_tests.bzl b/test/starlark_tests/tvos_application_tests.bzl index 5444ab893e..0064b52316 100644 --- a/test/starlark_tests/tvos_application_tests.bzl +++ b/test/starlark_tests/tvos_application_tests.bzl @@ -20,6 +20,7 @@ load( ) load( "//test/starlark_tests/rules:analysis_output_group_info_files_test.bzl", + "analysis_output_group_info_dsymutil_bundle_files_test", "analysis_output_group_info_files_test", ) load( @@ -29,6 +30,7 @@ load( ) load( "//test/starlark_tests/rules:apple_dsym_bundle_info_test.bzl", + "apple_dsym_bundle_info_dsymutil_bundle_test", "apple_dsym_bundle_info_test", ) load( @@ -239,6 +241,15 @@ def tvos_application_test_suite(name): ], tags = [name], ) + analysis_output_group_info_dsymutil_bundle_files_test( + name = "{}_dsyms_output_group_info_dsymutil_bundle_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/tvos:app", + output_group_name = "dsyms", + expected_outputs = [ + "app.app.dSYM", + ], + tags = [name], + ) apple_dsym_bundle_info_test( name = "{}_dsym_bundle_info_files_test".format(name), target_under_test = "//test/starlark_tests/targets_under_test/tvos:app", @@ -250,6 +261,17 @@ def tvos_application_test_suite(name): ], tags = [name], ) + apple_dsym_bundle_info_dsymutil_bundle_test( + name = "{}_dsym_bundle_info_dsymutil_bundle_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/tvos:app", + expected_direct_dsyms = [ + "app.app.dSYM", + ], + expected_transitive_dsyms = [ + "app.app.dSYM", + ], + tags = [name], + ) analysis_output_group_info_files_test( name = "{}_dsyms_output_group_transitive_files_test".format(name), @@ -263,6 +285,16 @@ def tvos_application_test_suite(name): ], tags = [name], ) + analysis_output_group_info_dsymutil_bundle_files_test( + name = "{}_dsyms_output_group_transitive_dsymutil_bundle_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/tvos:app_with_fmwk_with_fmwk_provisioned", + output_group_name = "dsyms", + expected_outputs = [ + "app_with_fmwk_with_fmwk_provisioned.app.dSYM", + "fmwk_with_provisioning.framework.dSYM", + ], + tags = [name], + ) apple_dsym_bundle_info_test( name = "{}_transitive_dsyms_test".format(name), target_under_test = "//test/starlark_tests/targets_under_test/tvos:app_with_fmwk_with_fmwk_provisioned", @@ -275,6 +307,18 @@ def tvos_application_test_suite(name): ], tags = [name], ) + apple_dsym_bundle_info_dsymutil_bundle_test( + name = "{}_transitive_dsyms_dsymutil_bundle_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/tvos:app_with_fmwk_with_fmwk_provisioned", + expected_direct_dsyms = [ + "app_with_fmwk_with_fmwk_provisioned.app.dSYM", + ], + expected_transitive_dsyms = [ + "fmwk_with_provisioning.framework.dSYM", + "app_with_fmwk_with_fmwk_provisioned.app.dSYM", + ], + tags = [name], + ) infoplist_contents_test( name = "{}_plist_test".format(name), @@ -696,6 +740,18 @@ def tvos_application_test_suite(name): ], tags = [name], ) + analysis_output_group_info_dsymutil_bundle_files_test( + name = "{}_with_runtime_framework_transitive_dsyms_output_group_info_dsymutil_bundle_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/tvos:app_with_fmwks_from_frameworks_and_objc_swift_libraries_using_data", + output_group_name = "dsyms", + expected_outputs = [ + "app_with_fmwks_from_frameworks_and_objc_swift_libraries_using_data.app.dSYM", + "fmwk.framework.dSYM", + "fmwk_with_resource_bundles.framework.dSYM", + "fmwk_with_structured_resources.framework.dSYM", + ], + tags = [name], + ) analysis_output_group_info_files_test( name = "{}_with_runtime_framework_transitive_linkmaps_output_group_info_test".format(name), target_under_test = "//test/starlark_tests/targets_under_test/tvos:app_with_fmwks_from_frameworks_and_objc_swift_libraries_using_data", @@ -728,6 +784,20 @@ def tvos_application_test_suite(name): ], tags = [name], ) + apple_dsym_bundle_info_dsymutil_bundle_test( + name = "{}_with_runtime_framework_dsym_bundle_info_dsymutil_bundle_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/tvos:app_with_fmwks_from_frameworks_and_objc_swift_libraries_using_data", + expected_direct_dsyms = [ + "app_with_fmwks_from_frameworks_and_objc_swift_libraries_using_data.app.dSYM", + ], + expected_transitive_dsyms = [ + "app_with_fmwks_from_frameworks_and_objc_swift_libraries_using_data.app.dSYM", + "fmwk.framework.dSYM", + "fmwk_with_resource_bundles.framework.dSYM", + "fmwk_with_structured_resources.framework.dSYM", + ], + tags = [name], + ) infoplist_contents_test( name = "{}_capability_set_derived_bundle_id_plist_test".format(name), diff --git a/test/starlark_tests/tvos_extension_tests.bzl b/test/starlark_tests/tvos_extension_tests.bzl index b1ee679c49..2833163cb6 100644 --- a/test/starlark_tests/tvos_extension_tests.bzl +++ b/test/starlark_tests/tvos_extension_tests.bzl @@ -16,10 +16,12 @@ load( "//test/starlark_tests/rules:analysis_output_group_info_files_test.bzl", + "analysis_output_group_info_dsymutil_bundle_files_test", "analysis_output_group_info_files_test", ) load( "//test/starlark_tests/rules:apple_dsym_bundle_info_test.bzl", + "apple_dsym_bundle_info_dsymutil_bundle_test", "apple_dsym_bundle_info_test", ) load( @@ -64,6 +66,15 @@ def tvos_extension_test_suite(name): ], tags = [name], ) + analysis_output_group_info_dsymutil_bundle_files_test( + name = "{}_dsyms_output_group_info_dsymutil_bundle_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/tvos:ext", + output_group_name = "dsyms", + expected_outputs = [ + "ext.appex.dSYM", + ], + tags = [name], + ) apple_dsym_bundle_info_test( name = "{}_dsym_bundle_info_files_test".format(name), target_under_test = "//test/starlark_tests/targets_under_test/tvos:ext", @@ -71,6 +82,13 @@ def tvos_extension_test_suite(name): expected_transitive_dsyms = ["dSYMs/ext.appex.dSYM"], tags = [name], ) + apple_dsym_bundle_info_dsymutil_bundle_test( + name = "{}_dsym_bundle_info_dsymutil_bundle_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/tvos:ext", + expected_direct_dsyms = ["ext.appex.dSYM"], + expected_transitive_dsyms = ["ext.appex.dSYM"], + tags = [name], + ) infoplist_contents_test( name = "{}_plist_test".format(name), @@ -158,6 +176,17 @@ def tvos_extension_test_suite(name): ], tags = [name], ) + analysis_output_group_info_dsymutil_bundle_files_test( + name = "{}_with_runtime_framework_transitive_dsyms_output_group_info_dsymutil_bundle_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/tvos:ext_with_fmwks_from_objc_swift_libraries_using_data", + output_group_name = "dsyms", + expected_outputs = [ + "ext_with_fmwks_from_objc_swift_libraries_using_data.appex.dSYM", + "fmwk_with_resource_bundles.framework.dSYM", + "fmwk_with_structured_resources.framework.dSYM", + ], + tags = [name], + ) analysis_output_group_info_files_test( name = "{}_with_runtime_framework_transitive_linkmaps_output_group_info_test".format(name), target_under_test = "//test/starlark_tests/targets_under_test/tvos:ext_with_fmwks_from_objc_swift_libraries_using_data", @@ -187,6 +216,19 @@ def tvos_extension_test_suite(name): ], tags = [name], ) + apple_dsym_bundle_info_dsymutil_bundle_test( + name = "{}_with_runtime_framework_dsym_bundle_info_dsymutil_bundle_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/tvos:ext_with_fmwks_from_objc_swift_libraries_using_data", + expected_direct_dsyms = [ + "ext_with_fmwks_from_objc_swift_libraries_using_data.appex.dSYM", + ], + expected_transitive_dsyms = [ + "ext_with_fmwks_from_objc_swift_libraries_using_data.appex.dSYM", + "fmwk_with_resource_bundles.framework.dSYM", + "fmwk_with_structured_resources.framework.dSYM", + ], + tags = [name], + ) infoplist_contents_test( name = "{}_capability_set_derived_bundle_id_plist_test".format(name), diff --git a/test/starlark_tests/tvos_framework_tests.bzl b/test/starlark_tests/tvos_framework_tests.bzl index 3a63e09be4..fd03c16201 100644 --- a/test/starlark_tests/tvos_framework_tests.bzl +++ b/test/starlark_tests/tvos_framework_tests.bzl @@ -16,10 +16,12 @@ load( "//test/starlark_tests/rules:analysis_output_group_info_files_test.bzl", + "analysis_output_group_info_dsymutil_bundle_files_test", "analysis_output_group_info_files_test", ) load( "//test/starlark_tests/rules:apple_dsym_bundle_info_test.bzl", + "apple_dsym_bundle_info_dsymutil_bundle_test", "apple_dsym_bundle_info_test", ) load( @@ -284,6 +286,17 @@ def tvos_framework_test_suite(name): ], tags = [name], ) + analysis_output_group_info_dsymutil_bundle_files_test( + name = "{}_with_runtime_framework_transitive_dsyms_output_group_info_dsymutil_bundle_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/tvos:fmwk_with_fmwks_from_objc_swift_libraries_using_data", + output_group_name = "dsyms", + expected_outputs = [ + "fmwk_with_fmwks_from_objc_swift_libraries_using_data.framework.dSYM", + "fmwk_with_resource_bundles.framework.dSYM", + "fmwk_with_structured_resources.framework.dSYM", + ], + tags = [name], + ) analysis_output_group_info_files_test( name = "{}_with_runtime_framework_transitive_linkmaps_output_group_info_test".format(name), target_under_test = "//test/starlark_tests/targets_under_test/tvos:fmwk_with_fmwks_from_objc_swift_libraries_using_data", @@ -313,6 +326,19 @@ def tvos_framework_test_suite(name): ], tags = [name], ) + apple_dsym_bundle_info_dsymutil_bundle_test( + name = "{}_with_runtime_framework_dsym_bundle_info_dsymutil_bundle_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/tvos:fmwk_with_fmwks_from_objc_swift_libraries_using_data", + expected_direct_dsyms = [ + "fmwk_with_fmwks_from_objc_swift_libraries_using_data.framework.dSYM", + ], + expected_transitive_dsyms = [ + "fmwk_with_fmwks_from_objc_swift_libraries_using_data.framework.dSYM", + "fmwk_with_resource_bundles.framework.dSYM", + "fmwk_with_structured_resources.framework.dSYM", + ], + tags = [name], + ) # Test that if a tvos_framework target depends on a prebuilt static library (i.e., # apple_static_framework_import), that the static library is defined in the tvos_framework. diff --git a/test/starlark_tests/tvos_ui_test_tests.bzl b/test/starlark_tests/tvos_ui_test_tests.bzl index 3a227f08e3..599e678b74 100644 --- a/test/starlark_tests/tvos_ui_test_tests.bzl +++ b/test/starlark_tests/tvos_ui_test_tests.bzl @@ -20,10 +20,12 @@ load( ) load( "//test/starlark_tests/rules:analysis_output_group_info_files_test.bzl", + "analysis_output_group_info_dsymutil_bundle_files_test", "analysis_output_group_info_files_test", ) load( "//test/starlark_tests/rules:apple_dsym_bundle_info_test.bzl", + "apple_dsym_bundle_info_dsymutil_bundle_test", "apple_dsym_bundle_info_test", ) load( @@ -65,6 +67,16 @@ def tvos_ui_test_test_suite(name): ], tags = [name], ) + analysis_output_group_info_dsymutil_bundle_files_test( + name = "{}_dsyms_output_group_info_dsymutil_bundle_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/tvos:ui_test", + output_group_name = "dsyms", + expected_outputs = [ + "app.app.dSYM", + "ui_test.xctest.dSYM", + ], + tags = [name], + ) apple_dsym_bundle_info_test( name = "{}_apple_dsym_bundle_info_test".format(name), target_under_test = "//test/starlark_tests/targets_under_test/tvos:ui_test", @@ -72,6 +84,13 @@ def tvos_ui_test_test_suite(name): expected_transitive_dsyms = ["dSYMs/app.app.dSYM", "dSYMs/ui_test.xctest.dSYM"], tags = [name], ) + apple_dsym_bundle_info_dsymutil_bundle_test( + name = "{}_apple_dsym_bundle_info_dsymutil_bundle_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/tvos:ui_test", + expected_direct_dsyms = ["ui_test.xctest.dSYM"], + expected_transitive_dsyms = ["app.app.dSYM", "ui_test.xctest.dSYM"], + tags = [name], + ) infoplist_contents_test( name = "{}_plist_test".format(name), diff --git a/test/starlark_tests/tvos_unit_test_tests.bzl b/test/starlark_tests/tvos_unit_test_tests.bzl index 01fd11ebb9..9ff38ff6b8 100644 --- a/test/starlark_tests/tvos_unit_test_tests.bzl +++ b/test/starlark_tests/tvos_unit_test_tests.bzl @@ -20,10 +20,12 @@ load( ) load( "//test/starlark_tests/rules:analysis_output_group_info_files_test.bzl", + "analysis_output_group_info_dsymutil_bundle_files_test", "analysis_output_group_info_files_test", ) load( "//test/starlark_tests/rules:apple_dsym_bundle_info_test.bzl", + "apple_dsym_bundle_info_dsymutil_bundle_test", "apple_dsym_bundle_info_test", ) load( @@ -69,6 +71,16 @@ def tvos_unit_test_test_suite(name): ], tags = [name], ) + analysis_output_group_info_dsymutil_bundle_files_test( + name = "{}_dsyms_output_group_info_dsymutil_bundle_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/tvos:unit_test", + output_group_name = "dsyms", + expected_outputs = [ + "app.app.dSYM", + "unit_test.xctest.dSYM", + ], + tags = [name], + ) apple_dsym_bundle_info_test( name = "{}_apple_dsym_bundle_info_test".format(name), target_under_test = "//test/starlark_tests/targets_under_test/tvos:unit_test", @@ -76,6 +88,13 @@ def tvos_unit_test_test_suite(name): expected_transitive_dsyms = ["dSYMs/app.app.dSYM", "dSYMs/unit_test.xctest.dSYM"], tags = [name], ) + apple_dsym_bundle_info_dsymutil_bundle_test( + name = "{}_apple_dsym_bundle_info_dsymutil_bundle_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/tvos:unit_test", + expected_direct_dsyms = ["unit_test.xctest.dSYM"], + expected_transitive_dsyms = ["app.app.dSYM", "unit_test.xctest.dSYM"], + tags = [name], + ) infoplist_contents_test( name = "{}_plist_test".format(name), diff --git a/test/starlark_tests/visionos_application_tests.bzl b/test/starlark_tests/visionos_application_tests.bzl index b7c83327cd..d44c18a2b5 100644 --- a/test/starlark_tests/visionos_application_tests.bzl +++ b/test/starlark_tests/visionos_application_tests.bzl @@ -16,6 +16,7 @@ load( "//test/starlark_tests/rules:analysis_output_group_info_files_test.bzl", + "analysis_output_group_info_dsymutil_bundle_files_test", "analysis_output_group_info_files_test", ) load( @@ -33,6 +34,7 @@ load( ) load( "//test/starlark_tests/rules:apple_dsym_bundle_info_test.bzl", + "apple_dsym_bundle_info_dsymutil_bundle_test", "apple_dsym_bundle_info_test", ) load( @@ -236,6 +238,17 @@ def visionos_application_test_suite(name): name, ], ) + analysis_output_group_info_dsymutil_bundle_files_test( + name = "{}_dsyms_output_group_info_dsymutil_bundle_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/visionos:app", + output_group_name = "dsyms", + expected_outputs = [ + "visionos_sim_arm64/app.app.dSYM", + ], + tags = [ + name, + ], + ) apple_dsym_bundle_info_test( name = "{}_dsym_bundle_info_files_test".format(name), @@ -250,6 +263,19 @@ def visionos_application_test_suite(name): name, ], ) + apple_dsym_bundle_info_dsymutil_bundle_test( + name = "{}_dsym_bundle_info_dsymutil_bundle_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/visionos:app", + expected_direct_dsyms = [ + "visionos_sim_arm64/app.app.dSYM", + ], + expected_transitive_dsyms = [ + "visionos_sim_arm64/app.app.dSYM", + ], + tags = [ + name, + ], + ) infoplist_contents_test( name = "{}_plist_test".format(name), diff --git a/test/starlark_tests/watchos_single_target_ui_test_tests.bzl b/test/starlark_tests/watchos_single_target_ui_test_tests.bzl index 909908839c..2bdd4c8eec 100644 --- a/test/starlark_tests/watchos_single_target_ui_test_tests.bzl +++ b/test/starlark_tests/watchos_single_target_ui_test_tests.bzl @@ -16,10 +16,12 @@ load( "//test/starlark_tests/rules:analysis_output_group_info_files_test.bzl", + "analysis_output_group_info_dsymutil_bundle_files_test", "analysis_output_group_info_files_test", ) load( "//test/starlark_tests/rules:apple_dsym_bundle_info_test.bzl", + "apple_dsym_bundle_info_dsymutil_bundle_test", "apple_dsym_bundle_info_test", ) load( @@ -62,6 +64,15 @@ def watchos_single_target_ui_test_test_suite(name): ], tags = [name], ) + analysis_output_group_info_dsymutil_bundle_files_test( + name = "{}_dsyms_output_group_info_dsymutil_bundle_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/watchos:single_target_ui_test", + output_group_name = "dsyms", + expected_outputs = [ + "single_target_ui_test.xctest.dSYM", + ], + tags = [name], + ) apple_dsym_bundle_info_test( name = "{}_dsym_bundle_info_files_test".format(name), target_under_test = "//test/starlark_tests/targets_under_test/watchos:single_target_ui_test", @@ -69,6 +80,13 @@ def watchos_single_target_ui_test_test_suite(name): expected_transitive_dsyms = ["dSYMs/single_target_ui_test.xctest.dSYM"], tags = [name], ) + apple_dsym_bundle_info_dsymutil_bundle_test( + name = "{}_dsym_bundle_info_dsymutil_bundle_test".format(name), + target_under_test = "//test/starlark_tests/targets_under_test/watchos:single_target_ui_test", + expected_direct_dsyms = ["single_target_ui_test.xctest.dSYM"], + expected_transitive_dsyms = ["single_target_ui_test.xctest.dSYM"], + tags = [name], + ) infoplist_contents_test( name = "{}_plist_test".format(name),