-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add rule class definitions to query proto output
As rules are starlarkified and migrated out of Bazel, tools cannot rely any longer on the (undocumented and deprecated) `info build-language` output to find the definitions of rule classes. Moreover, the name of the rule class is no longer unique: two different .bzl files might define different rule classes with the same name - and both might be used in the same package. For starlarkified rules, tools could use `starlark_doc_extract` targets to get the rule class definition in proto form. However, this requires (1) knowing in advance which .bzl file to introspect (2) adding a `starlark_doc_extract` target to perform this introspection. This is obviously not ideal when a tool needs to introspect targets without changing the state of a repo. The solution is to add `starlark_doc_extract`-like rule class definitions to `query` command output. Since a RuleInfo proto (the rule class definition as output by starlark_doc_extract and Stardoc) is large and expensive to generate, we want to * only output it optionally, when --proto:rule_classes flag is set * only output each rule class definition once per output stream - in the first rule target having a given rule class key. * add a rule class key, unique per rule class definition (not just rule class name!), so that later rule targets in the stream with the same rule class definition can be connected with the rule class definition provided in the first target. RELNOTES: If --proto:rule_classes flag is enabled, query proto output will contain rule class definitions in Stardoc proto format. PiperOrigin-RevId: 680642590 Change-Id: Ibdeb9c8acb7368b510f62d945c361a86cdb6f447
- Loading branch information
1 parent
3312f4e
commit 31b4125
Showing
6 changed files
with
100 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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