aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/cpp
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2016-09-07 09:37:35 +0000
committerGravatar Yue Gan <yueg@google.com>2016-09-07 10:44:29 +0000
commit0474511201b66ba5b456f90c5e4beb7b1a1ef00f (patch)
tree197e4de46a32043eb613efb12a9de1f0e654ffb3 /src/main/java/com/google/devtools/build/lib/rules/cpp
parent0d32fc88d6d179bedef4a04bc22c44583365b859 (diff)
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
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/cpp')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileActionBuilder.java8
1 files changed, 6 insertions, 2 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 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<Artifact> 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.