From 0474511201b66ba5b456f90c5e4beb7b1a1ef00f Mon Sep 17 00:00:00 2001 From: Googler Date: Wed, 7 Sep 2016 09:37:35 +0000 Subject: Disable pruning header modules for FakeCppCompileActions. Those currently run a build first before discovering their inputs and this build doesn't properly declare its inputs if we do pruning. -- MOS_MIGRATED_REVID=132414200 --- .../devtools/build/lib/rules/cpp/CppCompileActionBuilder.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/main/java/com/google/devtools/build/lib/rules/cpp') 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 95bac0bed5..00a26ce192 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 @@ -245,10 +245,12 @@ public class CppCompileActionBuilder { // finalizeCompileActionBuilder on this builder. Preconditions.checkNotNull(shouldScanIncludes); + boolean fake = tempOutputFile != null; + // Configuration can be null in tests. NestedSetBuilder realMandatoryInputsBuilder = NestedSetBuilder.compileOrder(); realMandatoryInputsBuilder.addTransitive(mandatoryInputsBuilder.build()); - if (tempOutputFile == null && !shouldScanIncludes) { + if (!fake && !shouldScanIncludes) { realMandatoryInputsBuilder.addTransitive(context.getDeclaredIncludeSrcs()); } // We disable pruning header modules in CPP_MODULE_COMPILEs as that would lead to @@ -258,8 +260,11 @@ public class CppCompileActionBuilder { // something that uses A (a header of it), we mark A and all of its transitive deps as inputs. // We still don't need to rebuild A, as none of its inputs have changed, but we do rebuild B // now and then the two modules are out of sync. + // We also have to disable this for fake C++ compile actions as those currently do a build first + // before discovering inputs and thus would not declare their inputs properly. boolean shouldPruneModules = shouldScanIncludes + && !fake && !getActionName().equals(CppCompileAction.CPP_MODULE_COMPILE) && featureConfiguration.isEnabled(CppRuleClasses.PRUNE_HEADER_MODULES); if (featureConfiguration.isEnabled(CppRuleClasses.USE_HEADER_MODULES) && !shouldPruneModules) { @@ -268,7 +273,6 @@ public class CppCompileActionBuilder { realMandatoryInputsBuilder.addTransitive(context.getAdditionalInputs()); realMandatoryInputsBuilder.add(sourceFile); - boolean fake = tempOutputFile != null; // If the crosstool uses action_configs to configure cc compilation, collect execution info // from there, otherwise, use no execution info. -- cgit v1.2.3