From 788801a8fd30985a1831de805172d257c6f63691 Mon Sep 17 00:00:00 2001 From: Konstantin Erman Date: Mon, 3 Apr 2023 06:52:47 -0700 Subject: [PATCH] Enable C++ deps pruning on Windows when PARSE_SHOWINCLUDES is available. This fixes #14947. Closes #17928. PiperOrigin-RevId: 521446074 Change-Id: I4bc155f0245bc1933e86cd0b37762263437ed1fe --- .../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 99efb2865a6492..63d5c5f192b4d7 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 @@ -346,6 +346,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. */ @@ -361,7 +365,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); } @@ -482,8 +486,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() {