From d3b59ad6895980ecade13119424e3cf4635bdebb Mon Sep 17 00:00:00 2001 From: kshyanashree <109167932+kshyanashree@users.noreply.github.com> Date: Tue, 4 Apr 2023 09:58:25 -0700 Subject: [PATCH] Enable C++ deps pruning on Windows when PARSE_SHOWINCLUDES is available. (#17957) This fixes #14947. Closes #17928. PiperOrigin-RevId: 521446074 Change-Id: I4bc155f0245bc1933e86cd0b37762263437ed1fe Co-authored-by: Konstantin Erman --- .../build/lib/rules/cpp/CppCompileActionBuilder.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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() {