diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileActionBuilder.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileActionBuilder.java index 7a9305a34dd21e..fa31f110a38fe2 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileActionBuilder.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileActionBuilder.java @@ -337,6 +337,10 @@ private ImmutableList getBuiltinIncludeFiles() { return result.build(); } + private boolean shouldParseShowIncludes() { + return featureConfiguration.isEnabled(CppRuleClasses.PARSE_SHOWINCLUDES); + } + /** * Returns the list of mandatory inputs for the {@link CppCompileAction} as configured. */ @@ -352,7 +356,7 @@ NestedSet buildMandatoryInputs() { if (grepIncludes != null) { realMandatoryInputsBuilder.add(grepIncludes); } - if (!shouldScanIncludes && dotdFile == null) { + if (!shouldScanIncludes && dotdFile == null && !shouldParseShowIncludes()) { realMandatoryInputsBuilder.addTransitive(ccCompilationContext.getDeclaredIncludeSrcs()); realMandatoryInputsBuilder.addTransitive(additionalPrunableHeaders); } @@ -473,8 +477,7 @@ public boolean useDotdFile(Artifact sourceFile) { } public boolean dotdFilesEnabled() { - return cppSemantics.needsDotdInputPruning(configuration) - && !featureConfiguration.isEnabled(CppRuleClasses.PARSE_SHOWINCLUDES); + return cppSemantics.needsDotdInputPruning(configuration) && !shouldParseShowIncludes(); } public boolean serializedDiagnosticsFilesEnabled() {