diff --git a/src/main/java/com/google/devtools/build/lib/analysis/producers/BuildConfigurationKeyProducer.java b/src/main/java/com/google/devtools/build/lib/analysis/producers/BuildConfigurationKeyProducer.java index d1560741b1361f..dd043672944300 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/producers/BuildConfigurationKeyProducer.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/producers/BuildConfigurationKeyProducer.java @@ -201,7 +201,7 @@ private StateMachine finishConfigurationKeyProcessing(BuildConfigurationKey newC private BuildConfigurationKey applyFlagsForOptions(BuildOptions options) throws OptionsParsingException { // Does the target platform provide any flags? - if (this.platformFlags != null) { + if (this.platformFlags != null && !this.platformFlags.isEmpty()) { OptionsParsingResult parsingResult = platformFlags.parse(); BuildOptions updatedOptions = options.applyParsingResult(parsingResult); return BuildConfigurationKey.create(updatedOptions); diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/config/NativeAndStarlarkFlags.java b/src/main/java/com/google/devtools/build/lib/skyframe/config/NativeAndStarlarkFlags.java index b605b83874df4c..97fbdb15444ede 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/config/NativeAndStarlarkFlags.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/config/NativeAndStarlarkFlags.java @@ -64,6 +64,10 @@ public static Builder builder() { @Nullable abstract RepositoryMapping repoMapping(); + public boolean isEmpty() { + return nativeFlags().isEmpty() && starlarkFlags().isEmpty(); + } + public OptionsParsingResult parse() throws OptionsParsingException { OptionsParser parser = OptionsParser.builder()