9191 "@build_bazel_rules_apple//apple/internal:outputs.bzl" ,
9292 "outputs" ,
9393)
94+ load (
95+ "@build_bazel_rules_apple//apple/internal:providers.bzl" ,
96+ "new_applebundlearchivesupportinfo" ,
97+ )
9498load (
9599 "@build_bazel_rules_apple//apple/internal/utils:bundle_paths.bzl" ,
96100 "bundle_paths" ,
@@ -315,7 +319,7 @@ def _bundle_partial_outputs_files(
315319 for partial_output in partial_outputs :
316320 for location , parent_dir , files in getattr (partial_output , "bundle_files" , []):
317321 if tree_artifact_is_enabled and location == _LOCATION_ENUM .archive :
318- # Skip bundling archive related files, as we're only building the bundle directory .
322+ # These files get relayed via AppleBundleArchiveSupportInfo instead .
319323 continue
320324
321325 if trim_locales :
@@ -352,7 +356,7 @@ def _bundle_partial_outputs_files(
352356
353357 for location , parent_dir , zip_files in getattr (partial_output , "bundle_zips" , []):
354358 if tree_artifact_is_enabled and location == _LOCATION_ENUM .archive :
355- # Skip bundling archive related files, as we're only building the bundle directory .
359+ # These zips get relayed via AppleBundleArchiveSupportInfo instead .
356360 continue
357361
358362 parent_dir_is_valid = _is_parent_dir_valid (
@@ -497,6 +501,9 @@ def _bundle_post_process_and_sign(
497501 rule_descriptor: A rule descriptor for platform and product types from the rule context.
498502 rule_label: The label of the target being analyzed.
499503 xplat_exec_group: A String. The exec_group for actions using the xplat toolchain.
504+
505+ Returns:
506+ A List of providers if any were created during bundling. Can be an empty List.
500507 """
501508 tree_artifact_is_enabled = is_experimental_tree_artifact_enabled (
502509 platform_prerequisites = platform_prerequisites ,
@@ -507,13 +514,33 @@ def _bundle_post_process_and_sign(
507514 rule_descriptor = rule_descriptor ,
508515 tree_artifact_is_enabled = tree_artifact_is_enabled ,
509516 )
517+ bundling_providers = []
510518 signed_frameworks_depsets = []
511519 for partial_output in partial_outputs :
512520 if hasattr (partial_output , "signed_frameworks" ):
513521 signed_frameworks_depsets .append (partial_output .signed_frameworks )
514522 transitive_signed_frameworks = depset (transitive = signed_frameworks_depsets )
515523
516524 if tree_artifact_is_enabled :
525+ bundle_files_for_xcarchive = []
526+ bundle_zips_for_xcarchive = []
527+
528+ for partial_output in partial_outputs :
529+ for location , parent_dir , files in getattr (partial_output , "bundle_files" , []):
530+ if location == _LOCATION_ENUM .archive :
531+ bundle_files_for_xcarchive .append ((parent_dir , files ))
532+
533+ for location , parent_dir , zip_files in getattr (partial_output , "bundle_zips" , []):
534+ if location == _LOCATION_ENUM .archive :
535+ bundle_zips_for_xcarchive .append ((parent_dir , zip_files ))
536+
537+ bundling_providers .append (
538+ new_applebundlearchivesupportinfo (
539+ bundle_files = bundle_files_for_xcarchive ,
540+ bundle_zips = bundle_zips_for_xcarchive ,
541+ ),
542+ )
543+
517544 extra_input_files = []
518545
519546 if entitlements :
@@ -683,6 +710,8 @@ def _bundle_post_process_and_sign(
683710 signed_frameworks = transitive_signed_frameworks ,
684711 )
685712
713+ return bundling_providers
714+
686715def _process (
687716 * ,
688717 actions ,
@@ -737,6 +766,7 @@ def _process(
737766 """
738767
739768 partial_outputs = [partial .call (p ) for p in partials ]
769+ providers = []
740770
741771 if bundle_post_process_and_sign :
742772 output_archive = outputs .archive (
@@ -746,7 +776,7 @@ def _process(
746776 platform_prerequisites = platform_prerequisites ,
747777 predeclared_outputs = predeclared_outputs ,
748778 )
749- _bundle_post_process_and_sign (
779+ bundling_providers = _bundle_post_process_and_sign (
750780 actions = actions ,
751781 apple_mac_toolchain_info = apple_mac_toolchain_info ,
752782 apple_xplat_toolchain_info = apple_xplat_toolchain_info ,
@@ -767,11 +797,11 @@ def _process(
767797 rule_label = rule_label ,
768798 xplat_exec_group = xplat_exec_group ,
769799 )
800+ providers .extend (bundling_providers )
770801 transitive_output_files = [depset ([output_archive ])]
771802 else :
772803 transitive_output_files = []
773804
774- providers = []
775805 output_group_dicts = []
776806 for partial_output in partial_outputs :
777807 if hasattr (partial_output , "providers" ):
0 commit comments