Add the names of the mandatory inputs to the action key for actions that discover their inputs.
This makes the case work where an extra input is added to an action, but it's still an action cache hit because the discovered inputs did not change, and thus the set of inputs action cache becomes stale.
--
MOS_MIGRATED_REVID=115060976
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 e7cc0e6..9d1c291 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
@@ -21,6 +21,7 @@
import com.google.common.base.Predicate;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
+import com.google.common.collect.Ordering;
import com.google.devtools.build.lib.actions.Action.MiddlemanType;
import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable;
@@ -797,6 +798,15 @@
return ImmutableList.copyOf(Iterables.transform(artifacts, EXEC_PATH_FORMATTER));
}
+ /**
+ * Returns the exec paths of the input artifacts in alphabetical order.
+ */
+ public static ImmutableList<PathFragment> asSortedPathFragments(Iterable<Artifact> input) {
+ return Ordering.natural().immutableSortedCopy(Iterables.transform(
+ input, EXEC_PATH_FORMATTER));
+ }
+
+
static final ArtifactOwner DESERIALIZED_MARKER_OWNER = new ArtifactOwner() {
@Override
public Label getLabel() {