From f309ad3be36363070e87eef0ee04b12f4956d601 Mon Sep 17 00:00:00 2001 From: janakr Date: Tue, 17 Jul 2018 16:40:58 -0700 Subject: Automated rollback of commit d491bf10f42e213292382c98a1dc439537f00f43. *** Reason for rollback *** Still bugs lurking. See linked bug. *** Original change description *** Automated rollback of commit eb587075b0d6ffab1cf9e69ede1b7e547905e547. *** Reason for rollback *** Depot has been fixed. RELNOTES[INC]: If the same artifact is generated by two distinct but identical actions, and a downstream action has both those actions' outputs in its inputs, the artifact will now appear twice in the downstream action's inputs. If this causes problems in Skylark actions, you can use the uniquify=True argument in Args.add_args. PiperOrigin-RevId: 204997569 --- .../google/devtools/build/lib/actions/Actions.java | 30 +++------------------- 1 file changed, 3 insertions(+), 27 deletions(-) (limited to 'src/main/java/com/google/devtools/build/lib/actions/Actions.java') 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 a3a6ba6b58..5364316f0c 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 @@ -17,6 +17,7 @@ package com.google.devtools.build.lib.actions; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; +import com.google.common.collect.Iterables; import com.google.common.escape.Escaper; import com.google.common.escape.Escapers; import com.google.devtools.build.lib.actions.MutableActionGraph.ActionConflictException; @@ -24,7 +25,6 @@ import com.google.devtools.build.lib.cmdline.Label; import com.google.devtools.build.lib.concurrent.ThreadSafety.ThreadSafe; import com.google.devtools.build.lib.vfs.OsPathPolicy; import com.google.devtools.build.lib.vfs.PathFragment; -import java.util.Collection; import java.util.Comparator; import java.util.HashMap; import java.util.Iterator; @@ -74,39 +74,15 @@ public final class Actions { } // Don't bother to check input and output counts first; the expected result for these tests is // to always be true (i.e., that this method returns true). - if (!artifactsEqualWithoutOwner(actionA.getMandatoryInputs(), actionB.getMandatoryInputs())) { + if (!Iterables.elementsEqual(actionA.getMandatoryInputs(), actionB.getMandatoryInputs())) { return false; } - if (!artifactsEqualWithoutOwner(actionA.getOutputs(), actionB.getOutputs())) { + if (!Iterables.elementsEqual(actionA.getOutputs(), actionB.getOutputs())) { return false; } return true; } - private static boolean artifactsEqualWithoutOwner( - Iterable iterable1, Iterable iterable2) { - if (iterable1 instanceof Collection && iterable2 instanceof Collection) { - Collection collection1 = (Collection) iterable1; - Collection collection2 = (Collection) iterable2; - if (collection1.size() != collection2.size()) { - return false; - } - } - Iterator iterator1 = iterable1.iterator(); - Iterator iterator2 = iterable2.iterator(); - while (iterator1.hasNext()) { - if (!iterator2.hasNext()) { - return false; - } - Artifact artifact1 = iterator1.next(); - Artifact artifact2 = iterator2.next(); - if (!artifact1.equalsWithoutOwner(artifact2)) { - return false; - } - } - return !iterator2.hasNext(); - } - /** * Finds action conflicts. An action conflict happens if two actions generate the same output * artifact. Shared actions are tolerated. See {@link #canBeShared} for details. -- cgit v1.2.3