aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Rumou Duan <rduan@google.com>2016-10-14 23:41:41 +0000
committerGravatar Philipp Wollermann <philwo@google.com>2016-10-17 11:19:30 +0000
commit88cf8e380d3cc3333e7903d4d67987dcc195c968 (patch)
tree9681a873db6fd0f9aa404a559bccf42ec5811d4d
parentdb6f5f26b50e6b0aa3837e7cb3cd595c9ae47ecf (diff)
Fix a bug in which Bazel reports action conflicts between ActionTemplates and associated expanded actions.
-- MOS_MIGRATED_REVID=136212908
-rw-r--r--src/main/java/com/google/devtools/build/lib/actions/Actions.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/actions/Actions.java b/src/main/java/com/google/devtools/build/lib/actions/Actions.java
index 44397d8e97..b8bd981156 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/Actions.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/Actions.java
@@ -190,6 +190,19 @@ public final class Actions {
if (pathJ.startsWith(pathI)) { // prefix conflict.
Artifact artifactI = Preconditions.checkNotNull(artifactPathMap.get(pathI), pathI);
Artifact artifactJ = Preconditions.checkNotNull(artifactPathMap.get(pathJ), pathJ);
+
+ // We ignore the artifact prefix conflict between a TreeFileArtifact and its parent
+ // TreeArtifact.
+ // We can only have such a conflict here if:
+ // 1. The TreeArtifact is generated by an ActionTemplate. And the TreeFileArtifact is
+ // generated by an expanded action created at execution time from the ActionTemplate.
+ // 2. This is an incremental build with invalidated configured targets. In this case,
+ // the action graph contains expanded actions from previous builds and they will be
+ // checked for artifact conflicts.
+ if (artifactJ.hasParent() && artifactJ.getParent().equals(artifactI)) {
+ continue;
+ }
+
ActionAnalysisMetadata actionI =
Preconditions.checkNotNull(actionGraph.getGeneratingAction(artifactI), artifactI);
ActionAnalysisMetadata actionJ =