Add feature injection#52
Open
nradakovic wants to merge 1 commit into
Open
Conversation
Open
10 tasks
36afac3 to
c78d5e9
Compare
Open
10 tasks
There was a problem hiding this comment.
Pull request overview
Adds “feature injection” plumbing to GCC toolchain configuration so consumers can supply external cc_feature-based features (via FeatureInfo) and have them appended to the generated toolchain config.
Changes:
- Add
extra_enabled_features/extra_known_featuresattributes to the Linux and QNXcc_toolchain_configtemplates and extend the toolchainfeatureslist viaconvert_feature(...). - Thread the new attributes through the GCC module extension/repository rule generation (plus a small helper to stringify label lists).
- Update the examples to a newer
rules_ccversion and disable/remove sanitizer-related example tests.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| templates/qnx/cc_toolchain_config.bzl.template | Adds support for injecting external cc_feature features into the QNX toolchain config. |
| templates/linux/cc_toolchain_config.bzl.template | Adds feature injection loading + wiring, and removes previously inlined features (sanitizers/gnu11). |
| rules/gcc.bzl | Threads injected-feature labels into the generated Linux cc_toolchain_config(...) call. |
| rules/common.bzl | Adds label_list_to_string() helper used by rules/gcc.bzl. |
| extensions/gcc.bzl | Exposes injected-feature label lists on the module extension toolchain tag API. |
| examples/MODULE.bazel | Bumps rules_cc version used by the examples. |
| examples/MODULE.bazel.lock | Lockfile updates corresponding to the examples’ dependency bump and tag schema changes. |
| examples/BUILD | Comments out sanitizer-related example tests. |
| examples/tsan_test.cpp | Removes the TSAN repro test source. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
45278c5 to
afddadc
Compare
Add feature injection to toolchain gcc extension. This option will allow users to add external defined features.
afddadc to
942559c
Compare
Comment on lines
+475
to
+476
| extra_rules_based_features = depset(ctx.attr.extra_enabled_features + ctx.attr.extra_known_features) | ||
| features.extend([convert_feature(extra_feature[FeatureInfo], enabled = extra_feature in ctx.attr.extra_enabled_features) for extra_feature in extra_rules_based_features.to_list()]) |
Comment on lines
+481
to
+482
| extra_rules_based_features = depset(ctx.attr.extra_enabled_features + ctx.attr.extra_known_features) | ||
| features.extend([convert_feature(extra_feature[FeatureInfo], enabled = extra_feature in ctx.attr.extra_enabled_features) for extra_feature in extra_rules_based_features.to_list()]) |
Comment on lines
+52
to
+56
| Args: | ||
| input_list (list[labels]): A list of Bazel labels. | ||
|
|
||
| Return: | ||
| str: Formated string |
Comment on lines
+93
to
+97
| Sanitizer features are not included by default by the generated toolchains. | ||
| If a workspace wants to use targets such as `asan_test`, it must first | ||
| register the sanitizer `cc_feature` definitions explicitly, for example via | ||
| `extra_known_features` or `extra_enabled_features` when declaring the | ||
| toolchain and by providing the feature definitions from `score_cpp_policies`. No newline at end of file |
Comment on lines
+21
to
+22
| Without that explicit registration, sanitizer-specific example targets are not | ||
| expected to build. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add feature injection to toolchain gcc extension. This option will allow users to add external defined features.
resolves #45