9191 "//apple/internal:outputs.bzl" ,
9292 "outputs" ,
9393)
94+ load (
95+ "//apple/internal:providers.bzl" ,
96+ "new_applebundlearchivesupportinfo" ,
97+ )
9498load (
9599 "//apple/internal/utils:bundle_paths.bzl" ,
96100 "bundle_paths" ,
@@ -316,7 +320,7 @@ def _bundle_partial_outputs_files(
316320 for partial_output in partial_outputs :
317321 for location , parent_dir , files in getattr (partial_output , "bundle_files" , []):
318322 if tree_artifact_is_enabled and location == _LOCATION_ENUM .archive :
319- # Skip bundling archive related files, as we're only building the bundle directory .
323+ # These files get relayed via AppleBundleArchiveSupportInfo instead .
320324 continue
321325
322326 if trim_locales :
@@ -353,7 +357,7 @@ def _bundle_partial_outputs_files(
353357
354358 for location , parent_dir , zip_files in getattr (partial_output , "bundle_zips" , []):
355359 if tree_artifact_is_enabled and location == _LOCATION_ENUM .archive :
356- # Skip bundling archive related files, as we're only building the bundle directory .
360+ # These zips get relayed via AppleBundleArchiveSupportInfo instead .
357361 continue
358362
359363 parent_dir_is_valid = _is_parent_dir_valid (
@@ -505,6 +509,9 @@ def _bundle_post_process_and_sign(
505509 provisioning_profile: File for the provisioning profile.
506510 rule_descriptor: A rule descriptor for platform and product types from the rule context.
507511 rule_label: The label of the target being analyzed.
512+
513+ Returns:
514+ A List of providers if any were created during bundling. Can be an empty List.
508515 """
509516 tree_artifact_is_enabled = is_experimental_tree_artifact_enabled (
510517 platform_prerequisites = platform_prerequisites ,
@@ -515,13 +522,33 @@ def _bundle_post_process_and_sign(
515522 rule_descriptor = rule_descriptor ,
516523 tree_artifact_is_enabled = tree_artifact_is_enabled ,
517524 )
525+ bundling_providers = []
518526 signed_frameworks_depsets = []
519527 for partial_output in partial_outputs :
520528 if hasattr (partial_output , "signed_frameworks" ):
521529 signed_frameworks_depsets .append (partial_output .signed_frameworks )
522530 transitive_signed_frameworks = depset (transitive = signed_frameworks_depsets )
523531
524532 if tree_artifact_is_enabled :
533+ bundle_files_for_xcarchive = []
534+ bundle_zips_for_xcarchive = []
535+
536+ for partial_output in partial_outputs :
537+ for location , parent_dir , files in getattr (partial_output , "bundle_files" , []):
538+ if location == _LOCATION_ENUM .archive :
539+ bundle_files_for_xcarchive .append ((parent_dir , files ))
540+
541+ for location , parent_dir , zip_files in getattr (partial_output , "bundle_zips" , []):
542+ if location == _LOCATION_ENUM .archive :
543+ bundle_zips_for_xcarchive .append ((parent_dir , zip_files ))
544+
545+ bundling_providers .append (
546+ new_applebundlearchivesupportinfo (
547+ bundle_files = bundle_files_for_xcarchive ,
548+ bundle_zips = bundle_zips_for_xcarchive ,
549+ ),
550+ )
551+
525552 extra_input_files = []
526553
527554 if entitlements :
@@ -690,6 +717,8 @@ def _bundle_post_process_and_sign(
690717 signed_frameworks = transitive_signed_frameworks ,
691718 )
692719
720+ return bundling_providers
721+
693722def _process (
694723 * ,
695724 actions ,
@@ -746,6 +775,7 @@ def _process(
746775 """
747776
748777 partial_outputs = [partial .call (p ) for p in partials ]
778+ providers = []
749779
750780 if bundle_post_process_and_sign :
751781 output_archive = outputs .archive (
@@ -757,7 +787,7 @@ def _process(
757787 predeclared_outputs = predeclared_outputs ,
758788 rule_descriptor = rule_descriptor ,
759789 )
760- _bundle_post_process_and_sign (
790+ bundling_providers = _bundle_post_process_and_sign (
761791 actions = actions ,
762792 apple_mac_toolchain_info = apple_mac_toolchain_info ,
763793 apple_xplat_toolchain_info = apple_xplat_toolchain_info ,
@@ -779,11 +809,11 @@ def _process(
779809 rule_descriptor = rule_descriptor ,
780810 rule_label = rule_label ,
781811 )
812+ providers .extend (bundling_providers )
782813 transitive_output_files = [depset ([output_archive ])]
783814 else :
784815 transitive_output_files = []
785816
786- providers = []
787817 output_group_dicts = []
788818 for partial_output in partial_outputs :
789819 if hasattr (partial_output , "providers" ):
0 commit comments