Skip to content

Commit fc6a0d1

Browse files
nglevinluispadron
authored andcommitted
Remove bin_root_path reference from the dynamic framework provider partial along with dead code that was present from use of the vestigial AppleDynamicFrameworkInfo fields.
Cherry-pick: 28d227a
1 parent 1e74f4b commit fc6a0d1

File tree

9 files changed

+49
-127
lines changed

9 files changed

+49
-127
lines changed

apple/internal/apple_framework_import.bzl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,12 +245,8 @@ def _apple_dynamic_framework_import_impl(ctx):
245245
providers.append(cc_info)
246246

247247
# Create AppleDynamicFramework provider.
248-
framework_groups = _grouped_framework_files(framework_imports)
249-
framework_dirs_set = depset(framework_groups.keys())
250248
providers.append(new_appledynamicframeworkinfo(
251249
cc_info = cc_info,
252-
framework_dirs = framework_dirs_set,
253-
framework_files = depset(framework_imports),
254250
))
255251

256252
if "apple._import_framework_via_swiftinterface" in features and framework.swift_interface_imports:

apple/internal/ios_rules.bzl

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,6 @@ def _ios_framework_impl(ctx):
877877
actions = ctx.actions
878878
apple_mac_toolchain_info = ctx.attr._mac_toolchain[AppleMacToolsToolchainInfo]
879879
apple_xplat_toolchain_info = ctx.attr._xplat_toolchain[AppleXPlatToolsToolchainInfo]
880-
bin_root_path = ctx.bin_dir.path
881880
bundle_name, bundle_extension = bundling_support.bundle_full_name(
882881
custom_bundle_name = ctx.attr.bundle_name,
883882
label_name = ctx.label.name,
@@ -892,13 +891,6 @@ def _ios_framework_impl(ctx):
892891
)
893892
cc_toolchain = find_cpp_toolchain(ctx)
894893
cc_toolchain_forwarder = ctx.split_attr._cc_toolchain_forwarder
895-
cc_features = cc_common.configure_features(
896-
ctx = ctx,
897-
cc_toolchain = cc_toolchain,
898-
language = "objc",
899-
requested_features = ctx.features,
900-
unsupported_features = ctx.disabled_features,
901-
)
902894
executable_name = ctx.attr.executable_name
903895
features = features_support.compute_enabled_features(
904896
requested_features = ctx.features,
@@ -1059,13 +1051,13 @@ def _ios_framework_impl(ctx):
10591051
partials.framework_headers_partial(hdrs = ctx.files.hdrs),
10601052
partials.framework_provider_partial(
10611053
actions = actions,
1062-
bin_root_path = bin_root_path,
10631054
binary_artifact = binary_artifact,
1064-
bundle_name = bundle_name,
10651055
bundle_only = ctx.attr.bundle_only,
1066-
cc_features = cc_features,
1056+
cc_configured_features_init = features_support.make_cc_configured_features_init(ctx),
10671057
cc_info = link_result.cc_info,
10681058
cc_toolchain = cc_toolchain,
1059+
features = features,
1060+
disabled_features = ctx.disabled_features,
10691061
rule_label = label,
10701062
),
10711063
partials.resources_partial(
@@ -1473,7 +1465,6 @@ def _ios_dynamic_framework_impl(ctx):
14731465
actions = ctx.actions
14741466
apple_mac_toolchain_info = ctx.attr._mac_toolchain[AppleMacToolsToolchainInfo]
14751467
apple_xplat_toolchain_info = ctx.attr._xplat_toolchain[AppleXPlatToolsToolchainInfo]
1476-
bin_root_path = ctx.bin_dir.path
14771468
bundle_id = ctx.attr.bundle_id
14781469
bundle_name, bundle_extension = bundling_support.bundle_full_name(
14791470
custom_bundle_name = ctx.attr.bundle_name,
@@ -1653,13 +1644,13 @@ def _ios_dynamic_framework_impl(ctx):
16531644
),
16541645
partials.framework_provider_partial(
16551646
actions = actions,
1656-
bin_root_path = bin_root_path,
16571647
binary_artifact = binary_artifact,
1658-
bundle_name = bundle_name,
16591648
bundle_only = False,
1660-
cc_features = cc_features,
1649+
cc_configured_features_init = features_support.make_cc_configured_features_init(ctx),
16611650
cc_info = link_result.cc_info,
16621651
cc_toolchain = cc_toolchain,
1652+
features = features,
1653+
disabled_features = ctx.disabled_features,
16631654
rule_label = label,
16641655
),
16651656
partials.resources_partial(

apple/internal/macos_rules.bzl

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2796,7 +2796,6 @@ def _macos_framework_impl(ctx):
27962796
actions = ctx.actions
27972797
apple_mac_toolchain_info = ctx.attr._mac_toolchain[AppleMacToolsToolchainInfo]
27982798
apple_xplat_toolchain_info = ctx.attr._xplat_toolchain[AppleXPlatToolsToolchainInfo]
2799-
bin_root_path = ctx.bin_dir.path
28002799
bundle_id = ctx.attr.bundle_id
28012800
bundle_name, bundle_extension = bundling_support.bundle_full_name(
28022801
custom_bundle_name = ctx.attr.bundle_name,
@@ -2806,13 +2805,6 @@ def _macos_framework_impl(ctx):
28062805
executable_name = ctx.attr.executable_name
28072806
cc_toolchain = find_cpp_toolchain(ctx)
28082807
cc_toolchain_forwarder = ctx.split_attr._cc_toolchain_forwarder
2809-
cc_features = cc_common.configure_features(
2810-
ctx = ctx,
2811-
cc_toolchain = cc_toolchain,
2812-
language = "objc",
2813-
requested_features = ctx.features,
2814-
unsupported_features = ctx.disabled_features,
2815-
)
28162808
features = features_support.compute_enabled_features(
28172809
requested_features = ctx.features,
28182810
unsupported_features = ctx.disabled_features,
@@ -2972,13 +2964,13 @@ def _macos_framework_impl(ctx):
29722964
partials.framework_headers_partial(hdrs = ctx.files.hdrs),
29732965
partials.framework_provider_partial(
29742966
actions = actions,
2975-
bin_root_path = bin_root_path,
29762967
binary_artifact = binary_artifact,
2977-
bundle_name = bundle_name,
29782968
bundle_only = ctx.attr.bundle_only,
2979-
cc_features = cc_features,
2969+
cc_configured_features_init = features_support.make_cc_configured_features_init(ctx),
29802970
cc_info = link_result.cc_info,
29812971
cc_toolchain = cc_toolchain,
2972+
features = features,
2973+
disabled_features = ctx.disabled_features,
29822974
rule_label = label,
29832975
),
29842976
partials.resources_partial(
@@ -3073,7 +3065,6 @@ def _macos_dynamic_framework_impl(ctx):
30733065
actions = ctx.actions
30743066
apple_mac_toolchain_info = ctx.attr._mac_toolchain[AppleMacToolsToolchainInfo]
30753067
apple_xplat_toolchain_info = ctx.attr._xplat_toolchain[AppleXPlatToolsToolchainInfo]
3076-
bin_root_path = ctx.bin_dir.path
30773068
bundle_id = ctx.attr.bundle_id
30783069
bundle_name, bundle_extension = bundling_support.bundle_full_name(
30793070
custom_bundle_name = ctx.attr.bundle_name,
@@ -3253,13 +3244,13 @@ def _macos_dynamic_framework_impl(ctx):
32533244
),
32543245
partials.framework_provider_partial(
32553246
actions = actions,
3256-
bin_root_path = bin_root_path,
32573247
binary_artifact = binary_artifact,
3258-
bundle_name = bundle_name,
32593248
bundle_only = False,
3260-
cc_features = cc_features,
3249+
cc_configured_features_init = features_support.make_cc_configured_features_init(ctx),
32613250
cc_info = link_result.cc_info,
32623251
cc_toolchain = cc_toolchain,
3252+
features = features,
3253+
disabled_features = ctx.disabled_features,
32633254
rule_label = label,
32643255
),
32653256
partials.resources_partial(

apple/internal/partials/BUILD

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,6 @@ bzl_library(
236236
"//apple/internal:framework_import_support",
237237
"//apple/internal:providers",
238238
"@bazel_skylib//lib:partial",
239-
"@bazel_skylib//lib:paths",
240239
],
241240
)
242241

apple/internal/partials/framework_provider.bzl

Lines changed: 19 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -18,50 +18,33 @@ load(
1818
"@bazel_skylib//lib:partial.bzl",
1919
"partial",
2020
)
21-
load(
22-
"@bazel_skylib//lib:paths.bzl",
23-
"paths",
24-
)
2521
load("@rules_cc//cc/common:cc_common.bzl", "cc_common")
2622
load("@rules_cc//cc/common:cc_info.bzl", "CcInfo")
2723
load("//apple/internal:providers.bzl", "new_appledynamicframeworkinfo")
2824

2925
def _framework_provider_partial_impl(
3026
*,
3127
actions,
32-
bin_root_path,
3328
binary_artifact,
34-
bundle_name,
3529
bundle_only,
36-
cc_features,
30+
cc_configured_features_init,
3731
cc_info,
3832
cc_toolchain,
33+
disabled_features,
34+
features,
3935
rule_label):
4036
"""Implementation for the framework provider partial."""
4137

42-
# Create a directory structure that the linker can use to reference this
43-
# framework. It follows the pattern of
44-
# any_path/MyFramework.framework/MyFramework. The absolute path and files are
45-
# propagated using the AppleDynamicFrameworkInfo provider.
46-
framework_dir = paths.join("frameworks", "%s.framework" % bundle_name)
47-
framework_file = actions.declare_file(
48-
paths.join(framework_dir, bundle_name),
49-
)
50-
actions.symlink(
51-
target_file = binary_artifact,
52-
output = framework_file,
53-
)
54-
55-
absolute_framework_dir = paths.join(
56-
bin_root_path,
57-
rule_label.package,
58-
framework_dir,
38+
feature_configuration = cc_configured_features_init(
39+
cc_toolchain = cc_toolchain,
40+
language = "objc",
41+
requested_features = features,
42+
unsupported_features = disabled_features,
5943
)
60-
6144
library_to_link = cc_common.create_library_to_link(
6245
actions = actions,
6346
cc_toolchain = cc_toolchain,
64-
feature_configuration = cc_features,
47+
feature_configuration = feature_configuration,
6548
dynamic_library = binary_artifact,
6649
)
6750
linker_input = cc_common.create_linker_input(
@@ -80,10 +63,7 @@ def _framework_provider_partial_impl(
8063
)
8164

8265
framework_provider = new_appledynamicframeworkinfo(
83-
binary = binary_artifact,
8466
cc_info = wrapper_cc_info,
85-
framework_dirs = depset([absolute_framework_dir]),
86-
framework_files = depset([framework_file]),
8767
)
8868

8969
return struct(
@@ -93,13 +73,13 @@ def _framework_provider_partial_impl(
9373
def framework_provider_partial(
9474
*,
9575
actions,
96-
bin_root_path,
9776
binary_artifact,
98-
bundle_name,
9977
bundle_only,
100-
cc_features,
78+
cc_configured_features_init,
10179
cc_info,
10280
cc_toolchain,
81+
disabled_features,
82+
features,
10383
rule_label):
10484
"""Constructor for the framework provider partial.
10585
@@ -110,14 +90,15 @@ def framework_provider_partial(
11090
11191
Args:
11292
actions: The actions provider from `ctx.actions`.
113-
bin_root_path: The path to the root `-bin` directory.
11493
binary_artifact: The linked dynamic framework binary.
115-
bundle_name: The name of the output bundle.
11694
bundle_only: Only include the bundle but do not link the framework
117-
cc_features: List of enabled C++ features.
95+
cc_configured_features_init: A lambda that is the same as cc_common.configure_features(...)
96+
without the need for a `ctx`.
11897
cc_info: The CcInfo provider containing information about the
11998
targets linked into the dynamic framework.
12099
cc_toolchain: The C++ toolchain to use.
100+
disabled_features: List of features to be disabled for C++ actions.
101+
features: List of features to be enabled for C++ actions.
121102
rule_label: The label of the target being analyzed.
122103
123104
Returns:
@@ -128,12 +109,12 @@ def framework_provider_partial(
128109
return partial.make(
129110
_framework_provider_partial_impl,
130111
actions = actions,
131-
bin_root_path = bin_root_path,
132112
binary_artifact = binary_artifact,
133-
bundle_name = bundle_name,
134113
bundle_only = bundle_only,
135-
cc_features = cc_features,
114+
cc_configured_features_init = cc_configured_features_init,
136115
cc_info = cc_info,
137116
cc_toolchain = cc_toolchain,
117+
disabled_features = disabled_features,
118+
features = features,
138119
rule_label = rule_label,
139120
)

apple/internal/providers.bzl

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -232,15 +232,6 @@ dependencies of the given target if any were generated.
232232
_AppleDynamicFrameworkInfo = provider(
233233
doc = "Contains information about an Apple dynamic framework.",
234234
fields = {
235-
"framework_dirs": """\
236-
The framework path names used as link inputs in order to link against the
237-
dynamic framework.
238-
""",
239-
"framework_files": """\
240-
The full set of artifacts that should be included as inputs to link against the
241-
dynamic framework.
242-
""",
243-
"binary": "The dylib binary artifact of the dynamic framework.",
244235
"cc_info": """\
245236
A `CcInfo` which contains information about the transitive dependencies linked
246237
into the binary.

apple/internal/tvos_rules.bzl

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,6 @@ def _tvos_dynamic_framework_impl(ctx):
497497
actions = ctx.actions
498498
apple_mac_toolchain_info = ctx.attr._mac_toolchain[AppleMacToolsToolchainInfo]
499499
apple_xplat_toolchain_info = ctx.attr._xplat_toolchain[AppleXPlatToolsToolchainInfo]
500-
bin_root_path = ctx.bin_dir.path
501500
bundle_id = ctx.attr.bundle_id
502501
bundle_name, bundle_extension = bundling_support.bundle_full_name(
503502
custom_bundle_name = ctx.attr.bundle_name,
@@ -672,13 +671,13 @@ def _tvos_dynamic_framework_impl(ctx):
672671
),
673672
partials.framework_provider_partial(
674673
actions = actions,
675-
bin_root_path = bin_root_path,
676674
binary_artifact = binary_artifact,
677-
bundle_name = bundle_name,
678675
bundle_only = ctx.attr.bundle_only,
679-
cc_features = cc_features,
676+
cc_configured_features_init = features_support.make_cc_configured_features_init(ctx),
680677
cc_info = link_result.cc_info,
681678
cc_toolchain = cc_toolchain,
679+
features = features,
680+
disabled_features = ctx.disabled_features,
682681
rule_label = label,
683682
),
684683
partials.resources_partial(
@@ -785,7 +784,6 @@ def _tvos_framework_impl(ctx):
785784
actions = ctx.actions
786785
apple_mac_toolchain_info = ctx.attr._mac_toolchain[AppleMacToolsToolchainInfo]
787786
apple_xplat_toolchain_info = ctx.attr._xplat_toolchain[AppleXPlatToolsToolchainInfo]
788-
bin_root_path = ctx.bin_dir.path
789787
bundle_name, bundle_extension = bundling_support.bundle_full_name(
790788
custom_bundle_name = ctx.attr.bundle_name,
791789
label_name = ctx.label.name,
@@ -800,13 +798,6 @@ def _tvos_framework_impl(ctx):
800798
)
801799
cc_toolchain = find_cpp_toolchain(ctx)
802800
cc_toolchain_forwarder = ctx.split_attr._cc_toolchain_forwarder
803-
cc_features = cc_common.configure_features(
804-
ctx = ctx,
805-
cc_toolchain = cc_toolchain,
806-
language = "objc",
807-
requested_features = ctx.features,
808-
unsupported_features = ctx.disabled_features,
809-
)
810801
executable_name = ctx.attr.executable_name
811802
features = features_support.compute_enabled_features(
812803
requested_features = ctx.features,
@@ -963,13 +954,13 @@ def _tvos_framework_impl(ctx):
963954
partials.framework_headers_partial(hdrs = ctx.files.hdrs),
964955
partials.framework_provider_partial(
965956
actions = actions,
966-
bin_root_path = bin_root_path,
967957
binary_artifact = binary_artifact,
968-
bundle_name = bundle_name,
969958
bundle_only = ctx.attr.bundle_only,
970-
cc_features = cc_features,
959+
cc_configured_features_init = features_support.make_cc_configured_features_init(ctx),
971960
cc_info = link_result.cc_info,
972961
cc_toolchain = cc_toolchain,
962+
features = features,
963+
disabled_features = ctx.disabled_features,
973964
rule_label = label,
974965
),
975966
partials.resources_partial(

0 commit comments

Comments
 (0)