summaryrefslogtreecommitdiff
path: root/java
AgeCommit message (Collapse)Author
2017-12-14Correct stack map frame computation. When visiting CHOP Frame (discarding n ↵cnsun
local local variables), the current implementation deletes n local slots, which is wrong when the local variable to delete is of type category 2. This CL deletes local variables instead of local slots. Another change is using the Label objects to identify uninitialized values, instead of the offsets of labels, because the offsets of labels might not be computed. RELNOTES:n/a. PiperOrigin-RevId: 178762969 GitOrigin-RevId: 770b1779dfd4e673e1523bc7e6f1772d4f4dfc04 Change-Id: Ib1ae1a813a51649d5d9522bdf393f48e56432b66
2017-12-06Merge remote-tracking branch 'aosp/upstream-master' into desugarColin Cross
* aosp/upstream-master: Improve exception message to output more information. RELNOTES:None. Remove static import of inner class InferredType's fields Automatic code cleanup. Let to push lambda arguments not only with *LOAD instructions but with SIPUSH and *CONST_*. Fix canonical option list for options that implicitly require options with allowMultiple=true Change config expansion application order, gated by startup flag --expand_configs_in_place. Specialize $closeResource(Throwable, AutoCloseable) so that desugared code does not depend on AutoCloseable, as it is not available before API 19. Fix EnclosingMethod attribute when moving interface methods to companion class RELNOTES: None. Cleanup stream use in canonical list of options. Remove unused LegacyParamsFilePreProcessor. Removed test cases from OptionsParserTest are implemented in ParamsFilePreProcessorTest, ShellQuotedParamsFilePreProcessorTest and UnquotedParamsFilePreProcessorTest. Switch on tracking of specific option priorities. Compute canonical list of options using OptionValueDescription's tracking of instances. Test: m checkbuild Change-Id: Idb762b0dabc9660d9116d1b976fb2f74aa7f5e09
2017-12-06Improve exception message to output more information.cnsun
RELNOTES:None. PiperOrigin-RevId: 177875613 GitOrigin-RevId: ddd5ac16aeffa6c4693c348f73e7365240b1abc5 Change-Id: Id8e000ab3d3ef7b35cfa008e5a84b130e0e79e57
2017-12-06Remove static import of inner class InferredType's fieldsccross
A few of the InferredType's fields were being static imported, but not all of them, and the use of the statically imported fields was inconsistent. Statically importing the inner class causes strange errors when building desugar in the Android platform build with OpenJDK8, but not OpenJDK9: external/desugar/java/com/google/devtools/build/android/desugar/BytecodeTypeInference.java:1015: error: cannot find symbol @AutoValue ^ symbol: class AutoValue location: class BytecodeTypeInference 1 error Remove the static imports to make the build work and to make the usage consistent. RELNOTES:None. PiperOrigin-RevId: 177875501 GitOrigin-RevId: b0fb55ad19e4751b61cbbf79ba60748b6e594100 Change-Id: I0c467abeeaac31fad138c7e2a90535740e68e8e9
2017-11-29Automatic code cleanup.cushon
PiperOrigin-RevId: 177261837 GitOrigin-RevId: 85d69f2397d7b54fa8b8c69b7bc9ec6d36cb1d49 Change-Id: Iab3521ac7d7a5c1340ba85fa036686a622f1065e
2017-11-29Let to push lambda arguments not only with *LOAD instructions but with ↵Googler
SIPUSH and *CONST_*. RELNOTES: None PiperOrigin-RevId: 177149410 GitOrigin-RevId: af10f2a83bdda8406a8c0a012db6d38e19d022b0 Change-Id: Ica86f3606d70b1cd25e336eb2cce5e369138ba76
2017-11-29Fix canonical option list for options that implicitly require options with ↵ccalvarin
allowMultiple=true Was filtering for the implicit options in SingleOptionValue, but forgot the check in RepeatableOptionValue. This is now fixed. RELNOTES: None. PiperOrigin-RevId: 176669853 GitOrigin-RevId: d55acc31ec7c731481a3691e6cf91c53869e9c67 Change-Id: I22d16447e5ad977ec890008e25be4d396a2523ed
2017-11-29Change config expansion application order, gated by startup flag ↵ccalvarin
--expand_configs_in_place. --config options were expanded in a fix-point expansion, where in practice, the flags that --config values expanded to ended up between the normal bazelrc options and the command line's explicit options. Since the options parser has an order-based priority scheme and it accepts multiple mentions of a single-valued option, this conflicts with users' expectations of being able to override these config expansions by using the order in which they are mentioned. This change makes it possible to expand the config values defined in your bazelrc (or blazerc) files to occur in-place: --stuff --config=something --laterstuff will interpret the options that --config=something expands to as if they had been mentioned explicitly between --stuff and --laterstuff. In order to not break users relying on complex flag combinations to configure their builds, this behavior will not yet be turned on by default. Instead, use --expand_configs_in_place as a startup flag to test this feature. --announce_rc may be helpful for debugging any differences between the fixed point and in-place expansions. Once you've debugged your problems, add "startup --expand_configs_in_place" to your blazerc to stick to the new behavior. RELNOTES: Use --expand_configs_in_place as a startup argument to change the order in which --config expansions are interpreted. PiperOrigin-RevId: 176371289 GitOrigin-RevId: 6364017ef95353969a8297c99a07c2a52102d9cc Change-Id: Id8b305db7a336132ee157cd0998330333888a139
2017-11-29Specialize $closeResource(Throwable, AutoCloseable) so that desugared code ↵cnsun
does not depend on AutoCloseable, as it is not available before API 19. This CL includes the following: 1. A type inference algorithm based on ASM. It relies on the stack map frames to compute type information at the entry of basic blocks. 2. The type inference is used to infer the types of the resources to be closed. Then for each concrete resource type, we specialize the synthetic $closeResource method to $closeResource(Throwable, <concrete resource type>). RELNOTES: None PiperOrigin-RevId: 175731437 GitOrigin-RevId: e83f3b1fb010298cbe1e16e5f7f2f39bfb045cef Change-Id: I347f8e4058a191621fb21bf2e81d7cf8f39ce6aa
2017-11-29Fix EnclosingMethod attribute when moving interface methods to companion classkmb
RELNOTES: None. PiperOrigin-RevId: 175613518 GitOrigin-RevId: f581da7375d8548ffaac61ead74cdc3519eeb5b2 Change-Id: I2333812920923fa8050022b8f482e139c37f9027
2017-11-29Cleanup stream use in canonical list of options.ccalvarin
Follow up to https://github.com/bazelbuild/bazel/commit/c50cd13c75a2a1685f5ac9bd70561ac1e50722e7 RELNOTES: None. PiperOrigin-RevId: 174498205 GitOrigin-RevId: fecf464ec3bf2593e31fa6cd25a45ce149c2dd75 Change-Id: Ife1674dc14b8276510df9730e84416863b79a59f
2017-11-29Remove unused LegacyParamsFilePreProcessor. Removed test cases from ↵apell
OptionsParserTest are implemented in ParamsFilePreProcessorTest, ShellQuotedParamsFilePreProcessorTest and UnquotedParamsFilePreProcessorTest. RELNOTES: None. PiperOrigin-RevId: 174359569 GitOrigin-RevId: 1ce985a704357c35d6691a80d94ca55372593b16 Change-Id: Ibc27b64d110861b1a2248227e1d59e4bc7fee953
2017-11-29Switch on tracking of specific option priorities.ccalvarin
Make sure that multiple calls to parse() follow each other sequentially. This is necessary for blazerc expansion, which occurs first in command order, then blazerc order. RELNOTES: None. PiperOrigin-RevId: 174343241 GitOrigin-RevId: 4871bf7f50dc889985ae25102c3fb9de869b50bc Change-Id: Ieaa99adffd4d7f33167b18635641d4d3439d5a64
2017-11-29Compute canonical list of options using OptionValueDescription's tracking of ↵ccalvarin
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
2017-10-24Merge remote-tracking branch 'aosp/upstream-master' into masterandroid-o-mr1-iot-preview-6o-mr1-iot-preview-6Colin Cross
Also delete java/com/google/devtools/build/android/desugar/dependencies/MetadataCollector.java to avoid a proto dependency. * aosp/upstream-master: Record dependencies when directly calling moved interface methods. RELNOTES: None. Exclude Android dependency checking from Bazel's singlejar build. This should also address https://github.com/bazelbuild/bazel/issues/3903 RELNOTES: None. Track expansions in OptionValueDescription. Remove feature to allow expansion flags to have values. Migrate all users of OptionsParser.enableParamsFileSupport to use the ShellQuotedParamsFilePreProcessor. This covers all of the tools packaged in the ResourceProcessorBusyBox. Track Option placement within a priority category. Make option conflicts less spammy. Desugar-singlejar integration tests for double-checking default methods. Expand implicitRequirements in the location of the option that required it. Remove the implicit requirement of core_library. Clean up InvocationPolicy's use of OptionDescription. Report the structured Bazel command line via the BEP. Do not rewrite static interface method invocations from bootclasspath Downgrade the default invocation policy log levels to fine. Categorize build options for BuildConfiguration. add flags to desugar to emit metadata that can be used for double-checking correctness of default and static interface desugaring. RELNOTES: none Add new option categorization and tagging information to HelpCommand's output. Move the canonicalization of an option value to the option value itself. Test: m checkbuild Change-Id: Ie86c647a0350bea0986bd1d8df95486b3fe585c3
2017-10-24Record dependencies when directly calling moved interface methods.kmb
RELNOTES: None. PiperOrigin-RevId: 173154512 GitOrigin-RevId: a01493b751fa1a31e1cef929b36ee030402909fa Change-Id: Id96eb89cbca159e7ce7f0e72ec3c3312a7ba4071
2017-10-24Track expansions in OptionValueDescription.ccalvarin
Add warnings for behavior that is likely unexpected. Expansion values do not accept values at all, and implicit requirements are set regardless of whether the option was turned "on" or not, so warn in the cases where this weird behavior might rear its ugly head. RELNOTES: None PiperOrigin-RevId: 172883214 GitOrigin-RevId: 1a4f4264492a0b37a4132d629342aa961fa1c6b0 Change-Id: I7f125848d4ee9b56184f1ac46343187bd7b79ddf
2017-10-24Remove feature to allow expansion flags to have values.ccalvarin
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
2017-10-24Migrate all users of OptionsParser.enableParamsFileSupport to use the ↵apell
ShellQuotedParamsFilePreProcessor. This covers all of the tools packaged in the ResourceProcessorBusyBox. RELNOTES: None. PiperOrigin-RevId: 172485486 GitOrigin-RevId: 20264552e18d8413f77b22b124e84e0267ce2b5e Change-Id: I124e1843794e7c6f6deb8e30305546cf1dd944ee
2017-10-24Track Option placement within a priority category.ccalvarin
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
2017-10-24Make option conflicts less spammy.ccalvarin
Remove an unnecessary warning and make all warnings for option conflicts print only if the option values are not equal. RELNOTES: None. PiperOrigin-RevId: 172124261 GitOrigin-RevId: 2553875c285dcca454ee830182d238296ce70aa2 Change-Id: I335a346ac2f8c92deba52fc3b5ce582f8d0fa20e
2017-10-24Expand implicitRequirements in the location of the option that required it.ccalvarin
Removes the special casing of implicit requirements. Accumulating them and parsing them at the end of the parse() function was never enough to actually guarantee that the value not be replaced. I've gone through all options with implicit requirements to make sure that the expectation is checked after options parsing, so this change should be relatively safe. Implicit requirements is still a broken concept - they don't actually expand based on the value given, so a user that is explicitly NOT setting a flag might unwittingly be setting all the requirements for that unset flag. Removing it fully requires redesigning or removing the flags that set it, though, so for now we are standardizing the behavior so that it behaves like any other expansion options, just one with a value. Also consolidate the deprecated wrapper option behavior into the expansion work. It will soon be removed entirely, but for now it can get grouped in with the expansion logic, so that its differences are more explicit. RELNOTES: None. PiperOrigin-RevId: 171957502 GitOrigin-RevId: faf2db22277bd0b074a0a8c5cd4533a735eff31a Change-Id: I84a1461624207d3d43786ebc69d17ab6f16f9ec8
2017-10-24Remove the implicit requirement of core_library.ccalvarin
The semantics of implicit requirements will soon change to adding the requirements in-place in the command line. This particular implicit requirement was not necessary. RELNOTES: None. PiperOrigin-RevId: 171841036 GitOrigin-RevId: b95f41b7aa8a53bee1fe0d4dc8dc843ddc22d2f7 Change-Id: Id8fda8f69c2ad6be85b381be4bc0d06ece4d0ceb
2017-10-24Clean up InvocationPolicy's use of OptionDescription.ccalvarin
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
2017-10-24Report the structured Bazel command line via the BEP.ccalvarin
This is part of the effort outlined in https://bazel.build/designs/2017/07/13/improved-command-line-reporting.html. The refactoring of the options parser is not yet complete, so we still do not have complete & correct information about the canonical command line. Where the information is blatantly incorrect, a best approximation was made, with comments and tests documenting the deficiencies. Change the names of the initial CommandLine fields in the BEP to be explicitly identified as unstructured. RELNOTES: None. PiperOrigin-RevId: 171625377 GitOrigin-RevId: ceb1013c1ca0238188e2714442fcfb2efb16bc6a Change-Id: I3a40b8e1ebd5d6a7d7e893be369d6d25de758ac7
2017-10-24Do not rewrite static interface method invocations from bootclasspathGoogler
RELNOTES: n/a PiperOrigin-RevId: 171344856 GitOrigin-RevId: 38da0c2e6e082964e32e8646439cdec7cd50808f Change-Id: Ice56501cd04133409dacde89318abac85b1828b9
2017-10-24Downgrade the default invocation policy log levels to fine.ccalvarin
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
2017-10-24Categorize build options for BuildConfiguration.gregce
PiperOrigin-RevId: 171017483 GitOrigin-RevId: e1b09f2f072231ed882c1de364fe3ea5c1f7d5af Change-Id: I697b9bfbf16dbd4186ec50362795d8a0f937dd73
2017-10-24add flags to desugar to emit metadata that can be used for double-checking ↵kmb
correctness of default and static interface desugaring. RELNOTES: none PiperOrigin-RevId: 170779637 GitOrigin-RevId: bdb12ceeb7c23d7d2293e8006d0aa7127a91b973 Change-Id: I6969cc42323b5299a90af9e8084658e9f654825f
2017-10-24Add new option categorization and tagging information to HelpCommand's output.ccalvarin
If setting flag --use_new_category_enum, group the options by the new categories in both the command line output and the "everything-as-html" output used for the generated docs at https://bazel.build/versions/master/docs/command-line-reference.html. In the html output, the effect and metadata tags are listed for each option, with links to their descriptions at the bottom of the page. The tags only appear in the terminal output in -l/--long/--help_verbosity=long, and only the names appear. This is still experimental as the majority of options do not yet use the new categorization system. The new output can be seen in command-line-reference.html format by adding the new flag to the "help everything-as-html" line in //src/main/java/com/google/devtools/build/lib:gen_command-line-reference. The html output is in the same order as before (by blaze rule, with inherited options not repeated), which means it still has duplicate options, that should ideally be fixed separately. I propose either dropping the high-level grouping and just grouping the options by documentation category, or potentially grouping them by optionsbase in some non-class-naming way, and listing the commands that they apply to, as more and more optionsbases are used by multiple commands without being inherited (for example, all BuildEventServiceOptions are listed 20 times). People probably use ctrl-f to navigate this page anyway. Once we know that we only list each option once, we can actually have links to the options, which will make it possible to have links in the expansion lists. Issue #3758 RELNOTES: added experimental --use_new_category_enum to the help command to output options grouped by the new type of category. PiperOrigin-RevId: 170116553 GitOrigin-RevId: 77e3a5ca955a3834406a837dbd4607b0b432b2d8 Change-Id: Id3f1fea6833f0cc05d127eb1454f21c92b22e03a
2017-10-24Move the canonicalization of an option value to the option value itself.ccalvarin
Ideally, the canonical form we output from OptionUtils would be the same as for the command canonicalize-flags, but that must wait for dependencies to be cleaned up. Still, in the meantime, keep the --foo=1 normalization of --foo, and apply it to all other boolean flag values (t,true,yes,y, and false equivalents), so that the canoncalize-flags output is more canonical, even if it isn't using the --[no]foo form yet. RELNOTES: Boolean flag values will now get normalized to 1 or 0 in canonicalize-flags output. PiperOrigin-RevId: 170084599 GitOrigin-RevId: 659feca7dee332f75801010b018505b7ba5a185e Change-Id: I65e969918c0ce0129d52e3fcdda4d95cde5175b7
2017-09-25Merge remote-tracking branch 'aosp/upstream-master'Ivan Gavrilovic
* aosp/upstream-master: (25 commits) Track the origin of an option in the option instance, not its final value. Deprecate wrapperOptions. Track all option instances. Cleanup of expansion option naming Create multiple ParamsFilePreProcessors to allow parsing files using the formats specified in ParameterFile.ParameterFileType. Also maintain the currently used parsing style of whitespace split arguments that allows single and double quoting and whitespace and quote escaping. This style of parsing is for a format not currently generated and will be removed once all consuming actions have been converted to using a supported format explicitly. Document the options in smaller commands. Treat parsed option values differently by option type. Throw away the confusing UnparsedOptionValueDescription name. Introduce "bazel help flags-as-proto" to print information about supported flags as a text protobuf. Pass the UnparsedOptionValues when setting or adding option values. Consolidate the "unparsed" option value tracking. Open source tests for Android desugarer. Move option value tracking classes to their own file. Replace referrals to options by their name to option definitions. Option value tracking should refer to the option definitions, not just track option name. Options with oldNames will no longer get reported twice in the effective option lists. fix for legacy jacoco instrumentation in interfaces behind flag RELNOTES: n/a Expansion flags need some restraints. Rename all logger instances to "logger" (instead "LOG" or "log"). Update comments about the option processor. ... Test: mma external/desugar Change-Id: I718bba35f1eb9eaacd68cb37d79a5c2068d3b9c1
2017-09-22Track the origin of an option in the option instance, not its final value.ccalvarin
A single instance of an option has a single origin, but the final value only has a single origin if it has a single value. For multi-valued options, it is wrong to expect that the final value of an option will have a single parent. Track the option parents (which option expanded to the current instance, if any) in the right place, with the ParsedOptionDescription. Also fix some inconsistent spelling of 'dependent,' in favor of the American English standard. RELNOTES: None. PiperOrigin-RevId: 169487515 GitOrigin-RevId: 3a0df3cb0637d71dfcf0add7057332c09cd508c5 Change-Id: Ic187397f8204aea3638b109b71d590920e968bdb
2017-09-22Deprecate wrapperOptions.ccalvarin
In order to discourage new uses (there shouldn't be any, but just in case), make it illegal to set wrapperOption=true for non deprecated options. RELNOTES: None. PiperOrigin-RevId: 169477990 GitOrigin-RevId: 125e88d693f04df7f9039906dc7bb03245fb61f7 Change-Id: Iab3e66245c1cfb53aada05654cc304a4334ddd9a
2017-09-22Track all option instances.ccalvarin
Regardless of option type, have the OptionValueDescription track information about the parsed option. This does not yet change the values that we output as part of the GotOptionsEvent, as the expansion, implicit req, and wrapper options still don't actually track anything in their option value. RELNOTES: None. PiperOrigin-RevId: 169469793 GitOrigin-RevId: 1ad38ea0dd4eb10cad92daf0fb2710ff118147c9 Change-Id: If2f29862ffabb190cbb9fcdc1a56685fa2916a5e
2017-09-22Cleanup of expansion option namingccalvarin
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
2017-09-22Create multiple ParamsFilePreProcessors to allow parsing files using the ↵apell
formats specified in ParameterFile.ParameterFileType. Also maintain the currently used parsing style of whitespace split arguments that allows single and double quoting and whitespace and quote escaping. This style of parsing is for a format not currently generated and will be removed once all consuming actions have been converted to using a supported format explicitly. RELNOTES: None. PiperOrigin-RevId: 169437362 GitOrigin-RevId: bcb3c5798390d6901681e74e19099378a9afae0a Change-Id: I203a3cabbf693bc3e85ed1d63e7001e9787aa036
2017-09-22Document the options in smaller commands.ccalvarin
RELNOTES: None. PiperOrigin-RevId: 169258065 GitOrigin-RevId: 2573540ae538f117a7ac919783298561ed484e3e Change-Id: Ib1f1f1e1ae7b082c70bb5d65b4a9044aa8b0e24f
2017-09-22Treat parsed option values differently by option type.ccalvarin
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
2017-09-22Throw away the confusing UnparsedOptionValueDescription name.ccalvarin
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
2017-09-22Introduce "bazel help flags-as-proto" to print information about supported ↵fwe
flags as a text protobuf. PiperOrigin-RevId: 168695297 GitOrigin-RevId: 346c8ff48419cf612c34a2fc9d7daa885f8f16c0 Change-Id: I80a6d82222886c97da2aa56db7bcefc2acbdd5e3
2017-09-22Pass the UnparsedOptionValues when setting or adding option values.ccalvarin
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
2017-09-22Consolidate the "unparsed" option value tracking.ccalvarin
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
2017-09-22Move option value tracking classes to their own file.ccalvarin
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
2017-09-12Replace referrals to options by their name to option definitions.ccalvarin
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
2017-09-12Option value tracking should refer to the option definitions, not just track ↵ccalvarin
option name. UnparsedOptionValueDescription and OptionValueDescription both had redundant information about options, since they tracked options by their names, and not their definition. Remove the redundancy. For getEffectiveOptions, the old behavior was relying on the fact that all options were given allowmulitple=false, which was wrong, so stop passing in the default value where it would get confused with values that have been created and tracked by the options parser. Instead, passing value=null is the way to indicate that an option is unset. RELNOTES: None. PiperOrigin-RevId: 168038067 GitOrigin-RevId: 95c1ee3261c6cd2263a954dc45611248ca4d5ce7 Change-Id: I2e9c6fd2580fcdc3eec2795d8b9c0d95c05905b4
2017-09-12Options with oldNames will no longer get reported twice in the effective ↵ccalvarin
option lists. Tracking the names together for option identification was useful, but then the same list was being used as the source of options for the parser, which lead to some options being listed twice. Also complete a few tests that should have already been tested in different orders. PiperOrigin-RevId: 168024719 GitOrigin-RevId: 80399bc14ced39936ef19a20f3b8c2d1536aa6c2 Change-Id: Id2d7edfcace3f21b9ed4997fc9b94e4c39731a4a
2017-09-06fix for legacy jacoco instrumentation in interfaces behind flagkmb
RELNOTES: n/a PiperOrigin-RevId: 167619442 GitOrigin-RevId: 831f7e179f8760cb31fb884c85fca1ea8197bdf5 Change-Id: Icc02e2af284406f69caacb74644a9c048c32acd1
2017-09-06Expansion flags need some restraints.ccalvarin
How expanding flags interact with other possible flag qualities is not defined. Should repeated values have effects multiple times and accumulate? This doesn't really make sense, expansion flags don't have values that would accumulate. For this reason, don't allow expansion options to have allowMultiple set to true. Likewise for other behaviors. PiperOrigin-RevId: 167580641 GitOrigin-RevId: 5b79925cc00396329fef9ba447cc45fc1bdf39a8 Change-Id: I815d05b4d4ecd1a21028242903cb8c266a6472a8
2017-09-06Rename all logger instances to "logger" (instead "LOG" or "log").lberki
RELNOTES: None. PiperOrigin-RevId: 167505493 GitOrigin-RevId: 97abb524bacc6d8527744657642f79c25c843c59 Change-Id: I161c4340936e8f79553585ad37f54d0ee9f0cc06