[8.0.0] Symbolic macro attribute inheritance #24280
Merged
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.
Allows the following syntax:
Fixes #24066
Tricky parts:
native rule "license" and "distribs" attrs have defaults which fail type check if
lifted. The only sane way of handling such attrs, if the attribute is unset in
the macro function call, to pass the value as None to the implementation function
so that the implementation function will pass None to the rule function, which
will thus set the default appropriately.
alas, or we get a circular dependency) to express the type of inherit_attrs param
need to look at builtins (since the ConfiguredRuleClassProvider may have stubs for
java rules overridden by builtins). This is already correctly handled by
bazel info build-language
, so let's move the logic into a utility class.RELNOTES: Add inherit_attrs param to macro() to allow symbolic macros to
inherit attributes from rules or other symbolic macros.
PiperOrigin-RevId: 694154352
Change-Id: I849a7f16b4da8eb2829cdbc6a131d85a28bc4740
Commit eec5305