diff options
author | 2018-07-17 16:40:58 -0700 | |
---|---|---|
committer | 2018-07-17 16:42:50 -0700 | |
commit | f309ad3be36363070e87eef0ee04b12f4956d601 (patch) | |
tree | db154ca3e5b54bb4470ea9b5d071dd17f33c927c /src/main/java/com/google/devtools/build/lib/actions/Actions.java | |
parent | ceafeaef5977d0671c44c86864b9a4b2b0e5ee04 (diff) |
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
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/actions/Actions.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/actions/Actions.java | 30 |
1 files changed, 3 insertions, 27 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 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<Artifact> iterable1, Iterable<Artifact> iterable2) { - if (iterable1 instanceof Collection && iterable2 instanceof Collection) { - Collection<?> collection1 = (Collection<?>) iterable1; - Collection<?> collection2 = (Collection<?>) iterable2; - if (collection1.size() != collection2.size()) { - return false; - } - } - Iterator<Artifact> iterator1 = iterable1.iterator(); - Iterator<Artifact> 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. |