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 (
@@ -503,6 +507,9 @@ def _bundle_post_process_and_sign(
503507 provisioning_profile: File for the provisioning profile.
504508 rule_descriptor: A rule descriptor for platform and product types from the rule context.
505509 rule_label: The label of the target being analyzed.
510+
511+ Returns:
512+ A List of providers if any were created during bundling. Can be an empty List.
506513 """
507514 tree_artifact_is_enabled = is_experimental_tree_artifact_enabled (
508515 platform_prerequisites = platform_prerequisites ,
@@ -513,13 +520,33 @@ def _bundle_post_process_and_sign(
513520 rule_descriptor = rule_descriptor ,
514521 tree_artifact_is_enabled = tree_artifact_is_enabled ,
515522 )
523+ bundling_providers = []
516524 signed_frameworks_depsets = []
517525 for partial_output in partial_outputs :
518526 if hasattr (partial_output , "signed_frameworks" ):
519527 signed_frameworks_depsets .append (partial_output .signed_frameworks )
520528 transitive_signed_frameworks = depset (transitive = signed_frameworks_depsets )
521529
522530 if tree_artifact_is_enabled :
531+ bundle_files_for_xcarchive = []
532+ bundle_zips_for_xcarchive = []
533+
534+ for partial_output in partial_outputs :
535+ for location , parent_dir , files in getattr (partial_output , "bundle_files" , []):
536+ if location == _LOCATION_ENUM .archive :
537+ bundle_files_for_xcarchive .append ((parent_dir , files ))
538+
539+ for location , parent_dir , zip_files in getattr (partial_output , "bundle_zips" , []):
540+ if location == _LOCATION_ENUM .archive :
541+ bundle_zips_for_xcarchive .append ((parent_dir , zip_files ))
542+
543+ bundling_providers .append (
544+ new_applebundlearchivesupportinfo (
545+ bundle_files = bundle_files_for_xcarchive ,
546+ bundle_zips = bundle_zips_for_xcarchive ,
547+ ),
548+ )
549+
523550 extra_input_files = []
524551
525552 if entitlements :
@@ -688,6 +715,8 @@ def _bundle_post_process_and_sign(
688715 signed_frameworks = transitive_signed_frameworks ,
689716 )
690717
718+ return bundling_providers
719+
691720def _process (
692721 * ,
693722 actions ,
@@ -744,6 +773,7 @@ def _process(
744773 """
745774
746775 partial_outputs = [partial .call (p ) for p in partials ]
776+ providers = []
747777
748778 if bundle_post_process_and_sign :
749779 output_archive = outputs .archive (
@@ -755,7 +785,7 @@ def _process(
755785 predeclared_outputs = predeclared_outputs ,
756786 rule_descriptor = rule_descriptor ,
757787 )
758- _bundle_post_process_and_sign (
788+ bundling_providers = _bundle_post_process_and_sign (
759789 actions = actions ,
760790 apple_mac_toolchain_info = apple_mac_toolchain_info ,
761791 apple_xplat_toolchain_info = apple_xplat_toolchain_info ,
@@ -777,11 +807,11 @@ def _process(
777807 rule_descriptor = rule_descriptor ,
778808 rule_label = rule_label ,
779809 )
810+ providers .extend (bundling_providers )
780811 transitive_output_files = [depset ([output_archive ])]
781812 else :
782813 transitive_output_files = []
783814
784- providers = []
785815 output_group_dicts = []
786816 for partial_output in partial_outputs :
787817 if hasattr (partial_output , "providers" ):
0 commit comments