aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/actions/Artifact.java
diff options
context:
space:
mode:
authorGravatar felly <felly@google.com>2018-02-23 12:23:56 -0800
committerGravatar Copybara-Service <copybara-piper@google.com>2018-02-23 12:25:25 -0800
commit9f7eb09e53ed7720a5e0b038df67263e44c28101 (patch)
treebbecf5e070d191a7349d339fbdd6f75226fc1bef /src/main/java/com/google/devtools/build/lib/actions/Artifact.java
parent054cf789556c36181196be391d47344186283bb5 (diff)
Fix Fix crash on incremental builds across configuration changes when using Skyframe native Filesets which reference output files.
We were failing to override equality of Artifact to use the artifact owner. See the javadocs on ArtifactSkyKey for more discussion of this. Before this change, the weak interning of keys done in LegacySkyKey and FilesetEntryKey spuriously matched keys across incremental builds in cases where Artifacts differed only in their owner. PiperOrigin-RevId: 186805663
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/actions/Artifact.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/actions/Artifact.java12
1 files changed, 12 insertions, 0 deletions
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 91b5313502..85873b27a0 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
@@ -645,6 +645,18 @@ public class Artifact
return Objects.equals(this.execPath, that.execPath) && Objects.equals(this.root, that.root);
}
+ /**
+ * Compare equality including Artifact owner equality, a notable difference compared to the
+ * {@link #equals(Object)} method of {@link Artifact}.
+ */
+ public static boolean equalWithOwner(@Nullable Artifact first, @Nullable Artifact second) {
+ if (first != null) {
+ return first.equals(second) && first.getArtifactOwner().equals(second.getArtifactOwner());
+ } else {
+ return second == null;
+ }
+ }
+
@Override
public final int hashCode() {
// This is just path.hashCode(). We cache a copy in the Artifact object to reduce LLC misses