From ceb1013c1ca0238188e2714442fcfb2efb16bc6a Mon Sep 17 00:00:00 2001 From: ccalvarin Date: Tue, 10 Oct 2017 05:29:56 +0200 Subject: Report the structured Bazel command line via the BEP. 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 --- .../com/google/devtools/common/options/OptionValueDescription.java | 7 +++++-- .../java/com/google/devtools/common/options/OptionsProvider.java | 6 ++++-- .../google/devtools/common/options/ParsedOptionDescription.java | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) (limited to 'src/main/java/com/google/devtools/common') diff --git a/src/main/java/com/google/devtools/common/options/OptionValueDescription.java b/src/main/java/com/google/devtools/common/options/OptionValueDescription.java index 0d81d49a84..aa808e2141 100644 --- a/src/main/java/com/google/devtools/common/options/OptionValueDescription.java +++ b/src/main/java/com/google/devtools/common/options/OptionValueDescription.java @@ -208,8 +208,11 @@ public abstract class OptionValueDescription { // The new value does not override the old value, as it has lower priority. warnings.add( String.format( - "The lower priority option '%s' does not override the previous value '%s'", - parsedOption.getCommandLineForm(), effectiveOptionInstance.getCommandLineForm())); + "The lower priority option '%s' (source %s) does not override the previous value " + + "'%s'", + parsedOption.getCommandLineForm(), + parsedOption.getSource(), + effectiveOptionInstance.getCommandLineForm())); } } diff --git a/src/main/java/com/google/devtools/common/options/OptionsProvider.java b/src/main/java/com/google/devtools/common/options/OptionsProvider.java index 1c7737fbda..5fd8ac00c1 100644 --- a/src/main/java/com/google/devtools/common/options/OptionsProvider.java +++ b/src/main/java/com/google/devtools/common/options/OptionsProvider.java @@ -39,8 +39,10 @@ public interface OptionsProvider extends OptionsClassProvider { * specified. If an option was specified multiple times, it is included in the result multiple * times. Does not include the residue. * - *

The returned list can be filtered if undocumented, hidden or implicit options should not be - * displayed. + *

The returned list includes undocumented, hidden or implicit options, and should be filtered + * as needed. Since it includes all options parsed, it will also include both an expansion option + * and the options it expanded to, and so blindly using this list for a new invocation will cause + * double-application of these options. */ List asCompleteListOfParsedOptions(); diff --git a/src/main/java/com/google/devtools/common/options/ParsedOptionDescription.java b/src/main/java/com/google/devtools/common/options/ParsedOptionDescription.java index 1f43172fb2..d5582635e3 100644 --- a/src/main/java/com/google/devtools/common/options/ParsedOptionDescription.java +++ b/src/main/java/com/google/devtools/common/options/ParsedOptionDescription.java @@ -115,7 +115,7 @@ public final class ParsedOptionDescription { return unconvertedValue; } - OptionPriority getPriority() { + public OptionPriority getPriority() { return origin.getPriority(); } -- cgit v1.2.3