diff options
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/runtime/BlazeOptionHandler.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/BlazeOptionHandler.java b/src/main/java/com/google/devtools/build/lib/runtime/BlazeOptionHandler.java index f2510a447e..436a96d25e 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/BlazeOptionHandler.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/BlazeOptionHandler.java @@ -457,6 +457,24 @@ public abstract class BlazeOptionHandler { String.format("expanded from --%s", configValueToExpand), expansion); } + + // At this point, we've expanded everything, identify duplicates, if any, to warn about + // re-application. + List<String> configs = optionsParser.getOptions(CommonCommandOptions.class).configs; + Set<String> configSet = new HashSet<>(); + LinkedHashSet<String> duplicateConfigs = new LinkedHashSet<>(); + for (String configValue : configs) { + if (!configSet.add(configValue)) { + duplicateConfigs.add(configValue); + } + } + if (!duplicateConfigs.isEmpty()) { + eventHandler.handle(Event.warn( + String.format( + "The following configs were expanded more than once: %s. For repeatable flags, " + + "repeats are counted twice and may lead to unexpected behavior.", + duplicateConfigs))); + } } private List<String> getExpansion( |