-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use
flags-as-proto
to determine command line schema (take two) (#8155)
We now use `bazel help flags-as-proto` as the primary method of determining the command line schema, only falling back to the usage-based parsing if the bazel version is too old to support `flags-as-proto`. Switched from using `BoolLike` to the more-specific `RequiresValue` and `HasNegative`, as those are what is present in the `FlagCollection` proto. They also allow us to tell the difference between boolean options (or boolean/enum options) and expansion options, which allows us more precision and accuracy in parsing: we can now remove values specified via `=` to expansion options (which improves our canonicalization). Added a test to confirm that `flags-as-proto` allows us to correctly handle undocumented options that are specified via `common` in a `bazelrc` file (which was the primary motivation for this change). Added a mock help function in the tests that uses `flags-as-proto` help and tested it everywhere the usage-style help was tested to ensure there were no regressions. Added some options to the canonicalization tests to ensure we are handling expansion options and options that use `BoolOrEnumConverter` in bazel (`--subcommands` and `--experimental_convenience_symlinks`) correctly. Added a test to ensure the options produced through `flags-as-proto` match up with those produced by parsing usage. --------- Co-authored-by: Brandon Duffany <[email protected]>
- Loading branch information
Showing
16 changed files
with
1,588 additions
and
854 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
* text=auto | ||
|
||
# base64 files are technically all valid ASCII characters, but are not | ||
# human-readable, not diff-able in a meaningful way, and we do not want | ||
# git to fix line endings for them. Thus they are, per | ||
# https://git-scm.com/book/ms/v2/Customizing-Git-Git-Attribute, "files [that] | ||
# look like text files but for all intents and purposes are to be treated as | ||
# binary data." | ||
*.b64 binary |
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
Oops, something went wrong.