History log of /external/desugar/java/com/google/devtools/common/options/OptionDefinition.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
d95ce7f66a7a1d94e124e299f1613e4da7e4af7d 30-Oct-2017 ccalvarin <ccalvarin@google.com> Compute canonical list of options using OptionValueDescription's tracking of instances.

Stop storing the canonical list of arguments separately. For the canonicalize-flags command, we want to avoid showing options that either have no values in their own right (such as expansion options and wrapper options) and instances of options that did not make it to the final value. This is work we already do in OptionValueDescription, so we can generate the canonical form from the values tracked there, instead of tracking it separately.

This means the canonical list is more correct where implicit requirements are concerned: implicit requirements are not listed in the canonical form, but now the values they overwrote will be correctly absent as well.

Use this improved list for the effective command line published to the BEP.

RELNOTES: Published command lines should have improved lists of effective options.
PiperOrigin-RevId: 173873154
GitOrigin-RevId: c50cd13c75a2a1685f5ac9bd70561ac1e50722e7
Change-Id: I9c6802dc3ab1e263048862f931f0c5f4933576ae
/external/desugar/java/com/google/devtools/common/options/OptionDefinition.java
195dd40824457bb0b3b934ec2c14ab36840f1ff0 16-Oct-2017 ccalvarin <ccalvarin@google.com> Track Option placement within a priority category.

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
/external/desugar/java/com/google/devtools/common/options/OptionDefinition.java
2c366b859ba2c84184e38450786e33368c9c39c2 21-Sep-2017 ccalvarin <ccalvarin@google.com> Cleanup of expansion option naming

Options that expand to other options are expansion options and the options they expand to have values that were expansions. This can be a bit confusing. Removes the isExpansion() call that is somewhat ambiguous, and forces option users to explicitly check the option definition for this information.

Also provide a parallel boolean function for implicit requirements, so that we stop querying for the length of the implicit requirement all over the place.

RELNOTES: None.
PiperOrigin-RevId: 169461566
GitOrigin-RevId: 4acb36c048a620abd7a0f5dff274851bd6dd9c28
Change-Id: I75068dceefa40f56201d3b6817d551741137085d
/external/desugar/java/com/google/devtools/common/options/OptionDefinition.java
65ff0d12d93274074e869054f75a1b930670aea0 14-Sep-2017 fwe <fwe@google.com> Introduce "bazel help flags-as-proto" to print information about supported flags as a text protobuf.

PiperOrigin-RevId: 168695297
GitOrigin-RevId: 346c8ff48419cf612c34a2fc9d7daa885f8f16c0
Change-Id: I80a6d82222886c97da2aa56db7bcefc2acbdd5e3
/external/desugar/java/com/google/devtools/common/options/OptionDefinition.java
bf096ba935f132b5da0ad941f41897f7a7409fb3 14-Sep-2017 ccalvarin <ccalvarin@google.com> Consolidate the "unparsed" option value tracking.

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
/external/desugar/java/com/google/devtools/common/options/OptionDefinition.java
7508b18d2fe907db9ffa1f065c05cd194674685e 11-Sep-2017 ccalvarin <ccalvarin@google.com> Replace referrals to options by their name to option definitions.

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
/external/desugar/java/com/google/devtools/common/options/OptionDefinition.java
e84b17f3ad086a72068d5c185d99e1c0364458da 31-Aug-2017 ccalvarin <ccalvarin@google.com> Move caching of OptionDefinitions to be static, and remove uncached extractions of OptionDefinitions.

We already had caching of OptionsData objects, for a list of OptionsBases, but repeated the reflective work for the same OptionsBase if it appeared in different lists. Now that the @Option-annotation specific state is isolated to the OptionDefinition object, this can be trivially cached by OptionsBase.

There are a few additional convenient side effects to this change. This should slightly decrease the memory use of the OptionsParser, since it already cached this map per options-base, and now only requires a single copy. It also means that parts of the code base that needed details of an option's definition no longer need to either obtain an option definition themselves or need access to an OptionsData object, which should be private to the OptionsParser anyway.

PiperOrigin-RevId: 167158902
GitOrigin-RevId: 987f09f0cf3c5bf2fc5157c20fe0f7979978a40b
Change-Id: I5ceeb8e2b12215f5702a8731b9a94b97bd48792a
/external/desugar/java/com/google/devtools/common/options/OptionDefinition.java
d862ad355b5c16ac8956a506853c6f0a0a1a3759 31-Aug-2017 ccalvarin <ccalvarin@google.com> Move static converter legality checks to compile time.

The information about whether a converter correctly matches the type of option it is meant to convert strings to is available at compile time. There is no reason to do this check at runtime.

Now, for an option to compile, it will need to have a converter that matches the option's type, taking into account whether the option is expected to accumulate multiple values. If it does not specify its own converter, a matching converter in the Converters.DEFAULT_CONVERTER list must be found, and the default value provided must be parseable by the matching default converter.

Remove tests that were testing failure modes which no longer compile.

RELNOTES: None.
PiperOrigin-RevId: 167092773
GitOrigin-RevId: 3e44d5b0de694632ac802c81838063d7f8563998
Change-Id: Ia5b5e462353f070276c311247758dba3a28be16a
/external/desugar/java/com/google/devtools/common/options/OptionDefinition.java
f317207148cc37de89df67aae4ab5b5efc354d49 30-Aug-2017 ccalvarin <ccalvarin@google.com> Move default value & converter finding logic to the OptionDefinition class.

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
/external/desugar/java/com/google/devtools/common/options/OptionDefinition.java
dfb8518e3845f1dbdd1b7dfada2e682c9dff6b02 22-Aug-2017 ccalvarin <ccalvarin@google.com> Add OptionDefinition layer between the @Option annotation and its fields and 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
/external/desugar/java/com/google/devtools/common/options/OptionDefinition.java