forked from bazelbuild/bazel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[6.2.0] TargetPattern parsing fixes (bazelbuild#17945)
* Tests for TargetPattern parsing, and some sanity fixes - TargetPatternTest isn't testing much right now. This CL changes it to actually assert the result of parsing is as expected, and also test a few different parser setups (in main repo, with a relative directory, in a non-main repo). - This necessitated adding #toString methods to all TargetPattern subclasses. - Also rearranged the parameters in the constructors of all subclasses so that `originalPattern` is always the first parameter. - Removed the always-true `checkWildcardConflict` parameter in `TargetsInPackage`. - Removed the weak check before `interpretPathAsTarget` as it was not only weak, but wrong. It made parsing `Bar\\java` a failure at the repo root but a success in a subdirectory. Work towards bazelbuild#4385 PiperOrigin-RevId: 520630430 Change-Id: Icee98f38134fe274ba800d2e949c83f0ae18c247 * Switch TargetPattern.Parser to use LabelParser - Target patterns and labels have very similar syntax, yet are parsed completely separately. Furthermore, the code for target pattern parsing wasn't written with repos in mind, causing some corner cases such as bazelbuild#4385. - This CL augments LabelParser to deal with some syntax specific to target patterns (mostly the '...' thing), and switches TargetPattern.Parser to use LabelParser instead. - This fixes some inconsistencies between the two and eliminates the bug linked above. - Added LabelParserTest to make sure that the table in the javadoc of LabelParser.Parts#parse is actually accurate. - Switched LabelParser.Parts to use AutoValue instead to enable testing. - Some more cleanup in TargetPattern.Parser; removing outdated fields/methods/etc. Fixes bazelbuild#4385. RELNOTES: `@foo` labels can now be used on the command line as the top-level target (that is, `bazel build @foo` now works). Double-dot syntax is now forbidden (`bazel build ../foo` will no longer work). PiperOrigin-RevId: 520902549 Change-Id: I38d6400381a3c4ac4c370360578702d5dd870909
- Loading branch information
Showing
11 changed files
with
537 additions
and
353 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
Oops, something went wrong.