Skip to content

Commit 2907937

Browse files
committed
Starlarkify default_features_and_action_configs
Compute _default_features_and_action_configs in create_cc_toolchain_config_info after legacy feature and action config injection. Expose the same list through CcToolchainInfo and use it in configure_features instead of calling CcToolchainFeatures.default_features_and_action_configs().
1 parent 8169167 commit 2907937

3 files changed

Lines changed: 15 additions & 1 deletion

File tree

cc/private/rules_impl/cc_toolchain_info.bzl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ def _create_cc_toolchain_info(
137137
_build_info_files = build_info_files,
138138
_supports_header_parsing = supports_header_parsing,
139139
_supports_param_files = supports_param_files,
140+
_default_features_and_action_configs = toolchain_config_info._default_features_and_action_configs,
140141
_toolchain_features = toolchain_features,
141142
_toolchain_label = toolchain_label,
142143
_cpp_configuration = cpp_configuration,
@@ -232,6 +233,7 @@ CcToolchainInfo, _ = provider(
232233
# Fields still used by native code - will be used by Starlark in the future.
233234
"_supports_header_parsing": "INTERNAL API, DO NOT USE!",
234235
"_supports_param_files": "INTERNAL API, DO NOT USE!",
236+
"_default_features_and_action_configs": "INTERNAL API, DO NOT USE!",
235237
"_toolchain_features": "INTERNAL API, DO NOT USE!",
236238
"_toolchain_label": "INTERNAL API, DO NOT USE!",
237239
"_cpp_configuration": "INTERNAL API, DO NOT USE!",

cc/private/toolchain_config/cc_toolchain_config_info.bzl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ CcToolchainConfigInfo, _new_cc_toolchain_config_info = provider(
3333
fields = [
3434
"_action_configs_DO_NOT_USE",
3535
"_artifact_name_patterns_DO_NOT_USE",
36+
"_default_features_and_action_configs",
3637
"_exec_os_DO_NOT_USE",
3738
"_features_DO_NOT_USE",
3839
"abi_libc_version",
@@ -124,9 +125,20 @@ def create_cc_toolchain_config_info(
124125
features = legacy_features
125126
action_configs = legacy_action_configs
126127

128+
default_features_and_action_configs = [
129+
feature.name
130+
for feature in features
131+
if feature.enabled
132+
] + [
133+
action_config.action_name
134+
for action_config in action_configs
135+
if action_config.enabled
136+
]
137+
127138
return _new_cc_toolchain_config_info(
128139
_action_configs_DO_NOT_USE = action_configs,
129140
_artifact_name_patterns_DO_NOT_USE = artifact_name_patterns,
141+
_default_features_and_action_configs = default_features_and_action_configs,
130142
_features_DO_NOT_USE = features,
131143
_exec_os_DO_NOT_USE = _cc_internal.exec_os(ctx),
132144
abi_libc_version = abi_libc_version or "",

cc/private/toolchain_config/configure_features.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def configure_features(
142142
all_features = [cpp_configuration.compilation_mode()]
143143
all_features.extend(DEFAULT_ACTION_CONFIGS)
144144
all_features.extend(requested_features)
145-
all_features.extend(cc_toolchain._toolchain_features.default_features_and_action_configs())
145+
all_features.extend(cc_toolchain._default_features_and_action_configs)
146146

147147
if language == "objc" or language == "objcpp":
148148
all_features.extend(OBJC_ACTIONS)

0 commit comments

Comments
 (0)