Skip to content

Commit 7bc20cc

Browse files
luispadronnglevin
andauthored
Remove usage of legacy apple_common.get_split_build_configs(...), retrieving configs from the cc_toolchains that are the source of truth for the linking via public starlark APIs. (#2860)
Required for Bazel 9+ Cherry-pick: cd1e1a4 Co-authored-by: Nicholas Levin <nglevin@google.com>
1 parent 2cdb0dc commit 7bc20cc

5 files changed

Lines changed: 11 additions & 9 deletions

File tree

apple/internal/linking_support.bzl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,6 @@ def _link_multi_arch_binary(
204204
stamp = stamp,
205205
)
206206

207-
split_build_configs = apple_common.get_split_build_configs(ctx)
208207
split_deps = ctx.split_attr.deps
209208

210209
if split_deps and split_deps.keys() != cc_toolchains.keys():
@@ -272,7 +271,7 @@ def _link_multi_arch_binary(
272271
avoid_dep_linking_contexts = avoid_cc_linking_contexts,
273272
)
274273

275-
child_config = split_build_configs.get(split_transition_key)
274+
child_config = child_toolchain[ApplePlatformInfo].target_build_config
276275

277276
additional_outputs = []
278277
extensions = {}

apple/internal/platform_support.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ def _apple_platform_info_from_rule_ctx(ctx):
112112
"""Returns an ApplePlatformInfo provider from a rule context, needed to resolve constraints."""
113113
return new_appleplatforminfo(
114114
target_arch = apple_support.target_arch_from_rule_ctx(ctx),
115+
target_build_config = ctx.configuration,
115116
target_environment = apple_support.target_environment_from_rule_ctx(ctx),
116117
target_os = apple_support.target_os_from_rule_ctx(ctx),
117118
)

apple/internal/providers.bzl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -392,14 +392,17 @@ def merge_apple_framework_import_info(apple_framework_import_infos):
392392
ApplePlatformInfo, new_appleplatforminfo = provider(
393393
doc = "Provides information for the currently selected Apple platforms.",
394394
fields = {
395-
"target_os": """
396-
`String` representing the selected Apple OS.
397-
""",
398395
"target_arch": """
399396
`String` representing the selected target architecture or cpu type.
397+
""",
398+
"target_build_config": """
399+
'configuration' representing the selected target's build configuration.
400400
""",
401401
"target_environment": """
402402
`String` representing the selected target environment (e.g. "device", "simulator").
403+
""",
404+
"target_os": """
405+
`String` representing the selected Apple OS.
403406
""",
404407
},
405408
init = _make_banned_init(provider_name = "ApplePlatformInfo"),

apple/internal/rule_attrs.bzl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,7 @@ def _common_linking_api_attrs(*, deps_cfg):
125125
providers = [cc_common.CcToolchainInfo, ApplePlatformInfo],
126126
default = "//apple:default_cc_toolchain_forwarder",
127127
),
128-
# TODO(b/251837356): Eliminate this attr when the Bazel Starlark API
129-
# `apple_common.get_split_build_configs(...)`` doesn't require that this attr be called
130-
# `_child_configuration_dummy` in Apple multiarch APIs.
128+
# TODO: Remove this when we drop bazel 7.x
131129
"_child_configuration_dummy": attr.label(
132130
cfg = deps_cfg,
133131
providers = [cc_common.CcToolchainInfo, ApplePlatformInfo],

doc/providers.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,9 +413,10 @@ Provides information for the currently selected Apple platforms.
413413

414414
| Name | Description |
415415
| :------------- | :------------- |
416-
| <a id="ApplePlatformInfo-target_os"></a>target_os | `String` representing the selected Apple OS. |
417416
| <a id="ApplePlatformInfo-target_arch"></a>target_arch | `String` representing the selected target architecture or cpu type. |
417+
| <a id="ApplePlatformInfo-target_build_config"></a>target_build_config | 'configuration' representing the selected target's build configuration. |
418418
| <a id="ApplePlatformInfo-target_environment"></a>target_environment | `String` representing the selected target environment (e.g. "device", "simulator"). |
419+
| <a id="ApplePlatformInfo-target_os"></a>target_os | `String` representing the selected Apple OS. |
419420

420421

421422
<a id="AppleProvisioningProfileInfo"></a>

0 commit comments

Comments
 (0)