Age | Commit message (Collapse) | Author |
|
It will not work as expected, since config is already expanded by this point in options processing.
RELNOTES: None.
PiperOrigin-RevId: 193196664
GitOrigin-RevId: 9c8c77502ff52907a327e6bdc9ac282da0af6b44
Change-Id: I5fa3aaec852b2d16bb8974291735ba4da1709243
|
|
For a filter on option values (either by whitelist, allow_values, or blacklist, disallow_values), one of the options for what to do when encountering a disallowed value is to replace it with the default. This default must be itself an allowed value for this to make sense, so this is checked. This check, however, shouldn't apply to flags that are null by default, since these flags' default value is not parsed by the converter, so there is no guarantee that there exists an accepted user-input value that would also set the value to NULL. In these cases, we assume that "unset" is a distinct value that is always allowed.
RELNOTES: None.
PiperOrigin-RevId: 187475696
GitOrigin-RevId: 06e687495b4c85f86215c7cc7f1a01dc7f6709f9
Change-Id: I1949e180ce32094faf0f46bc7cd627f464ca53f6
|
|
It was added as a potential fix for --config (an expansion flag with values), but this would have required forcing the parser to know the config's expansions at parsing time, which is not currently possible. Instead, we will use the new addition of option-location tracking to make sure we expand options at a the correct place, even if the expansion is triggered after the fact.
This is mostly a straight forward undoing of https://github.com/bazelbuild/bazel/commit/7c7255ec8d6da20526c2c4078c57aadaf3dd3612, except where the context has changed. Notably, implicit requirements are effectively treated like expansion flags, so special casing in OptionDescription could be removed.
RELNOTES: None.
PiperOrigin-RevId: 172514997
GitOrigin-RevId: 34a9fea78f201caed8ace5c714a0cf288cb97c65
Change-Id: Ic26df46a5ff16f3b6dd89616ef9fcbe9a7971fa6
|
|
An option has precedence over previous options at the same enum-valued priority. Track its placement in this ordering explicitly.
This will allow after-the-fact expansion of expansion options such that they correctly take precedence or not compared to other mentions of the same flag. This is needed to fix --config's expansion.
RELNOTES: None.
PiperOrigin-RevId: 172367996
GitOrigin-RevId: 7cd9e883dd31f54cd505844aa1f1e0ed7bd9f380
Change-Id: Ia0c09601ac24ffceb31e47b9113a636849c9b2f4
|
|
OptionDescription is basically a hack to get the expansion data for options from outside the options parser, but it was being used at various points of invocation policy enforcement. In order to correctly track option origin, we only want to get this information once. Do it during the invocation policy expansion stage, not at enforcement, so that we track the information of the option's origin in the original invocation policy passed to the enforcer, not the expanded one.
PiperOrigin-RevId: 171661669
GitOrigin-RevId: ca74482825e0c0ca5d119eceab74ba4292428557
Change-Id: Ib57ed5c67054c051a420507506807a8eb6809f47
|
|
Unfortunately, since the invocation policy gets enforced on a user's command line early in the command environment setup, so the effective log level is not yet set. For this run, keep the logs at INFO, since any other level will disappear into the ether.
InvocationPolicy gets enforced not only at invocation startup but also elsewhere to recompute the default values. The log statements from these different runs overwhelm the log output from our tests, making it hard to find other events without filtering the log. Make all extra invocation policy enforcements log at FINE so that they only appear when extra detail is requested.
PiperOrigin-RevId: 171151573
GitOrigin-RevId: 334d2f155d85fca1797e249dc0acf2c47be089b0
Change-Id: I2bd3fbd782b2b077a8e82ae6e38abb07a9d8df5d
|
|
There is a vexingly large world of possible option types, each with its own quirks of how it interfaces with new inputs as they come in: values can be
- overridden (default)
- concatenated (allowMultiple)
- flattened (allowMultiple that accepts list inputs)
- disappear into additional flag inputs (expansion flags)
Or some combination of the above, in the case of flags with implicit dependencies and wrapper options.
Begin removing the error-prone treatment of all option types with conditional branches. This model of the different options will make it much easier to isolate the option-type specific logic with the command-line parsing logic. Flags that affect other flags (implicit requirements, expansions, and wrappers) will be migrated in a later change.
This CL does not change flag parsing semantics, just migrates the current parsing logic to the new class structure.
RELNOTES: None.
PiperOrigin-RevId: 169239182
GitOrigin-RevId: 3ab171a1b03861d40fcf49fb56e2d8df87db25ab
Change-Id: I2933cb6d69e3d5b3c605bc6d9308f8be84dd3714
|
|
We get UnparsedValues after ... parsing the options. So that doesn't
make sense. What was meant was that it wasn't converted to the final
value.
In an effort to make this distinction more clear, this change will
make the terminology more consistent. The `--foo=bar` step is
"parsing" and the `bar -> Object` step is "converting" (it is, in
fact, done by Converters).
RELNOTES: None.
PiperOrigin-RevId: 168852847
GitOrigin-RevId: fb153cd83c6f801271048ec1d62d17a68562376d
Change-Id: I90065b60724e698b93e685c045a21f901adb3c14
|
|
Stop breaking the value apart to be recombined later. Also stop using OptionValueDescriptions as though we have a final option when expanding flags for invocation policy. These values are explicitly the output from parsing the expansion strings, not yet converted or combined with other values of the same flag.
After this change, only UnparsedOptionValueDescription should be used when strings of flags are parsed, and OptionValueDescription should be used when the final version of a flag is created or used.
PiperOrigin-RevId: 168688063
GitOrigin-RevId: a8c0c8dfad38437bc617b4b66d271bc0beb1b7c1
Change-Id: I159b1a1a076704bc3b90760b8c8ad628a135830a
|
|
In preparation for linking the parsed and unparsed values of options, consolidate and standardize our representation of the flag values as we received them (what is meant by "unparsed" values in this case). This was being done separately in ParseOptionResult, which, with extra context added, is being folded into UnparsedOptionValueDescription. We now track how an option was provided and where it came from for all option parsing.
RELNOTES: None.
PiperOrigin-RevId: 168682082
GitOrigin-RevId: 5fe8e6629e09ce44c6835d1b8f3a36bc3d69f131
Change-Id: I3964b563289ee39ab3a9a7ac496ed033459546c0
|
|
These classes are mostly used during the options parsing process itself, and are barely a part of the options parser interface, so they really don't belong in OptionsParser.java. They are also about to change significantly, so taking this opportunity to split them out.
RELNOTES: None.
PiperOrigin-RevId: 168400162
GitOrigin-RevId: 7da54b5e2942bdb444abbf68ac3c7f34a453b4d9
Change-Id: I476d951094068ca828d3503c8c8af9dfe5648e5e
|
|
Now that we have a standard way of referring to an option, remove all of the places that we were referring to them by their name. Since options can have multiple names, this is more clear and provides the additional information needed to understand the option. It also stops the habit of requesting unqualified strings, which was hard to read.
RELNOTES: None.
PiperOrigin-RevId: 168254584
GitOrigin-RevId: 1dce09721f8361240bbf056fd508f1ac5fdcfd32
Change-Id: I5ca50358d96ed613c544248920ca51cbe856842e
|
|
RELNOTES: None.
PiperOrigin-RevId: 167505493
GitOrigin-RevId: 97abb524bacc6d8527744657642f79c25c843c59
Change-Id: I161c4340936e8f79553585ad37f54d0ee9f0cc06
|
|
Removes some duplicate computation by memoizing the results. Consolidates caching into a single optionDefinition object, instead of having multiple caches that go from the option name to different parts of what defines an option.
Fly-by cleanup of OptionDescription's contents, all contents that are statically defined as part of an option are in OptionDefintion, while expansion data, which depends on the existence of other options, is more clearly stored separately.
Will move the converter-to-option type matching sanity checks to a compile time check in a later change.
RELNOTES: None.
PiperOrigin-RevId: 166912716
GitOrigin-RevId: 00443495e002c9fc68adbcb708f223eb4b6a73c1
Change-Id: If3915782a59d520353f3e5daeb4e489484a3307c
|
|
the options parser.
Removes any direct reads of the annotation outside of OptionDefinition. This allows for fewer manual checks for the annotation's existence, unifies error wording, and paves the way for potentially generifying the OptionsParser to accept different @Option-equivalent annotations.
Also allows for cleanup of duplicate code by giving @Option-specific operations a clear home, such as sorts and default logic. In followup changes, we can eliminate some unnecessarily complex caching by instead memoizing values in the OptionDefinition. This will have the positive side effect of making sure reads come from the cached values.
RELNOTES: None.
PiperOrigin-RevId: 166019075
GitOrigin-RevId: e8aae03888a44ee8d5264c3d8f6b3adaeb830df5
Change-Id: Ie5ffe0c1983e89885a2bfcab8cf7565790f396fd
|
|
- Use Java 8 idioms more consistently.
- Use newer Guava idioms more consistently.
- Apply some IntelliJ IDEA refactoring suggestions.
- Other changes made for readability and/or brevity.
Closes #3462.
PiperOrigin-RevId: 164700946
GitOrigin-RevId: 0df3ddbdc289af97ffd2fb98197548f21b2c69a9
Change-Id: Ia18bac5af262592416cd560c60653c545b778882
|
|
Fix bug where a null value in the expansion text lead to a NullPointerException.
RELNOTES: None.
PiperOrigin-RevId: 164061496
GitOrigin-RevId: c331f24a3a8af5e19f2d603d0b77ca90923b3dc2
Change-Id: I99c3b94e95201f9cbad878bf2f06ea022830b26a
|
|
PiperOrigin-RevId: 163124023
GitOrigin-RevId: 8ea7685bd4db755be6c600dc1f800fc0af3a9771
Change-Id: Ic9275baba5e9134adb75c608efa6579879a32e00
|
|
This lets us change what it expands based on the argument passed to the flag.
RELNOTES: Allows flags that expand to take values.
PiperOrigin-RevId: 160298412
GitOrigin-RevId: 7c7255ec8d6da20526c2c4078c57aadaf3dd3612
Change-Id: I4e6d8d79a13ea89329d52280958122fa01e91872
|
|
It was originally included in runtime due to external dependencies, and
a desire to keep the options parser a general options library. These
dependencies have been or will be removed, and there are plenty of other
general flag libraries.
InvocationPolicy is fundamentally acting on the properties of this
specific OptionsParser and needs proper access to it for the proper
solution to a number of existing bugs, which means having access to
things that should be package private.
PiperOrigin-RevId: 158523111
GitOrigin-RevId: f39dc6fc707cca9496d5baef5549bb7c24933776
Change-Id: I9f71233464721a0ab4c885d8e70f1d4e6fbd4127
|