Skip to content

Commit c23720d

Browse files
googlewaltbrentleyjones
authored andcommitted
[rules_apple] Propagate CcInfos in binary and framework providers
These providers contain linking info to support avoid_deps, so they need to propagate CcInfo in preparation for migrating linking info to CcInfo. A previous bazel change has added cc_info to those providers. PiperOrigin-RevId: 487378744 (cherry picked from commit c13da60)
1 parent 037b8e0 commit c23720d

9 files changed

Lines changed: 24 additions & 0 deletions

apple/apple_binary.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ def _apple_binary_impl(ctx):
9898
if binary_type == "executable":
9999
providers.append(
100100
apple_common.new_executable_binary_provider(
101+
cc_info = link_result.cc_info,
101102
objc = link_result.objc,
102103
binary = binary_artifact,
103104
),

apple/internal/apple_framework_import.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ def _apple_dynamic_framework_import_impl(ctx):
272272
framework_dirs_set = depset(framework_groups.keys())
273273
providers.append(apple_common.new_dynamic_framework_provider(
274274
objc = objc_provider,
275+
cc_info = cc_info,
275276
framework_dirs = framework_dirs_set,
276277
framework_files = depset(framework_imports),
277278
))

apple/internal/apple_xcframework_import.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,7 @@ def _apple_dynamic_xcframework_import_impl(ctx):
461461
# Create AppleDynamicFrameworkInfo provider
462462
apple_dynamic_framework_info = apple_common.new_dynamic_framework_provider(
463463
objc = objc_provider,
464+
cc_info = cc_info,
464465
framework_dirs = depset(xcframework_library.framework_dirs),
465466
framework_files = depset(xcframework_library.framework_files),
466467
)

apple/internal/ios_rules.bzl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,7 @@ def _ios_application_impl(ctx):
416416
),
417417
apple_common.new_executable_binary_provider(
418418
binary = binary_artifact,
419+
cc_info = link_result.cc_info,
419420
objc = link_result.objc,
420421
),
421422
# TODO(b/228856372): Remove when downstream users are migrated off this provider.
@@ -673,6 +674,7 @@ def _ios_app_clip_impl(ctx):
673674
),
674675
apple_common.new_executable_binary_provider(
675676
binary = binary_artifact,
677+
cc_info = link_result.cc_info,
676678
objc = link_result.objc,
677679
),
678680
# TODO(b/228856372): Remove when downstream users are migrated off this provider.
@@ -826,6 +828,7 @@ def _ios_framework_impl(ctx):
826828
binary_artifact = binary_artifact,
827829
bundle_name = bundle_name,
828830
bundle_only = ctx.attr.bundle_only,
831+
cc_info = link_result.cc_info,
829832
objc_provider = link_result.objc,
830833
rule_label = label,
831834
),
@@ -1297,6 +1300,7 @@ def _ios_dynamic_framework_impl(ctx):
12971300
binary_artifact = binary_artifact,
12981301
bundle_name = bundle_name,
12991302
bundle_only = False,
1303+
cc_info = link_result.cc_info,
13001304
objc_provider = link_result.objc,
13011305
rule_label = label,
13021306
),

apple/internal/linking_support.bzl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ def _register_binary_linking_action(
140140
* `binary`: The final binary `File` that was linked. If only one architecture was
141141
requested, then it is a symlink to that single architecture binary. Otherwise, it
142142
is a new universal (fat) binary obtained by invoking `lipo`.
143+
* `cc_info`: The CcInfo provider containing information about the targets that were
144+
linked.
143145
* `objc`: The `apple_common.Objc` provider containing information about the targets
144146
that were linked.
145147
* `outputs`: A `list` of `struct`s containing the single-architecture binaries and
@@ -206,6 +208,7 @@ def _register_binary_linking_action(
206208

207209
return struct(
208210
binary = fat_binary,
211+
cc_info = linking_outputs.cc_info,
209212
debug_outputs_provider = linking_outputs.debug_outputs_provider,
210213
objc = linking_outputs.objc,
211214
outputs = linking_outputs.outputs,

apple/internal/macos_rules.bzl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ def _macos_application_impl(ctx):
330330
),
331331
apple_common.new_executable_binary_provider(
332332
binary = binary_artifact,
333+
cc_info = link_result.cc_info,
333334
objc = link_result.objc,
334335
),
335336
# TODO(b/228856372): Remove when downstream users are migrated off this provider.
@@ -1632,6 +1633,7 @@ def _macos_command_line_application_impl(ctx):
16321633
),
16331634
apple_common.new_executable_binary_provider(
16341635
binary = output_file,
1636+
cc_info = link_result.cc_info,
16351637
objc = link_result.objc,
16361638
),
16371639
# TODO(b/228856372): Remove when downstream users are migrated off this provider.

apple/internal/partials/framework_provider.bzl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ def _framework_provider_partial_impl(
3030
binary_artifact,
3131
bundle_name,
3232
bundle_only,
33+
cc_info,
3334
objc_provider,
3435
rule_label):
3536
"""Implementation for the framework provider partial."""
@@ -62,6 +63,7 @@ def _framework_provider_partial_impl(
6263

6364
framework_provider = apple_common.new_dynamic_framework_provider(
6465
binary = binary_artifact,
66+
cc_info = cc_info,
6567
framework_dirs = depset([absolute_framework_dir]),
6668
framework_files = depset([framework_file]),
6769
objc = legacy_objc_provider,
@@ -78,6 +80,7 @@ def framework_provider_partial(
7880
binary_artifact,
7981
bundle_name,
8082
bundle_only,
83+
cc_info,
8184
objc_provider,
8285
rule_label):
8386
"""Constructor for the framework provider partial.
@@ -93,13 +96,16 @@ def framework_provider_partial(
9396
binary_artifact: The linked dynamic framework binary.
9497
bundle_name: The name of the output bundle.
9598
bundle_only: Only include the bundle but do not link the framework
99+
cc_info: The CcInfo provider containing information about the
100+
targets linked into the dynamic framework.
96101
objc_provider: The `apple_common.Objc` provider containing information
97102
about the targets linked into the dynamic framework.
98103
rule_label: The label of the target being analyzed.
99104
100105
Returns:
101106
A partial that returns the AppleDynamicFrameworkInfo provider used to link
102107
this framework into the final binary.
108+
103109
"""
104110
return partial.make(
105111
_framework_provider_partial_impl,
@@ -108,6 +114,7 @@ def framework_provider_partial(
108114
binary_artifact = binary_artifact,
109115
bundle_name = bundle_name,
110116
bundle_only = bundle_only,
117+
cc_info = cc_info,
111118
objc_provider = objc_provider,
112119
rule_label = rule_label,
113120
)

apple/internal/tvos_rules.bzl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,7 @@ def _tvos_application_impl(ctx):
365365
TvosApplicationBundleInfo(),
366366
apple_common.new_executable_binary_provider(
367367
binary = binary_artifact,
368+
cc_info = link_result.cc_info,
368369
objc = link_result.objc,
369370
),
370371
# TODO(b/228856372): Remove when downstream users are migrated off this provider.
@@ -526,6 +527,7 @@ def _tvos_dynamic_framework_impl(ctx):
526527
binary_artifact = binary_artifact,
527528
bundle_name = bundle_name,
528529
bundle_only = ctx.attr.bundle_only,
530+
cc_info = link_result.cc_info,
529531
objc_provider = link_result.objc,
530532
rule_label = label,
531533
),
@@ -748,6 +750,7 @@ def _tvos_framework_impl(ctx):
748750
binary_artifact = binary_artifact,
749751
bundle_name = bundle_name,
750752
bundle_only = ctx.attr.bundle_only,
753+
cc_info = link_result.cc_info,
751754
objc_provider = link_result.objc,
752755
rule_label = label,
753756
),

apple/internal/watchos_rules.bzl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ def _watchos_framework_impl(ctx):
256256
binary_artifact = binary_artifact,
257257
bundle_name = bundle_name,
258258
bundle_only = ctx.attr.bundle_only,
259+
cc_info = link_result.cc_info,
259260
objc_provider = link_result.objc,
260261
rule_label = label,
261262
),
@@ -492,6 +493,7 @@ def _watchos_dynamic_framework_impl(ctx):
492493
binary_artifact = binary_artifact,
493494
bundle_name = bundle_name,
494495
bundle_only = ctx.attr.bundle_only,
496+
cc_info = link_result.cc_info,
495497
objc_provider = link_result.objc,
496498
rule_label = label,
497499
),

0 commit comments

Comments
 (0)