Tolerate situation of Artifacts without generating action keys being compared for equality: this can happen when a set of artifacts is being constructed inside a configured target/aspect with one artifact from an already-existing configured target, another one just constructed here, and the two artifacts being shared.
Writing test now, but want to submit this ASAP to unblock release.
PiperOrigin-RevId: 252450064
diff --git a/src/main/java/com/google/devtools/build/lib/actions/Artifact.java b/src/main/java/com/google/devtools/build/lib/actions/Artifact.java
index a067437..9f8680a 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/Artifact.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/Artifact.java
@@ -337,15 +337,9 @@
boolean ownersEqual(Artifact other) {
DerivedArtifact that = (DerivedArtifact) other;
if (!(this.owner instanceof ActionLookupData) || !(that.owner instanceof ActionLookupData)) {
- // Happens only intra-analysis of a configured target. Tolerate.
- Preconditions.checkState(
- this.getArtifactOwner().equals(that.getArtifactOwner()),
- "Mismatched owners: %s %s %s %s",
- this,
- that,
- this.getArtifactOwner(),
- that.getArtifactOwner());
- return true;
+ // Happens when at least one of these artifacts hasn't had its generating action key set
+ // yet, so its configured target is still being analyzed. Tolerate.
+ return this.getArtifactOwner().equals(that.getArtifactOwner());
}
return this.owner.equals(that.owner);
}