Refactor FileArtifactValue and ArtifactValue now that presence of mtime and digest are mutually exclusive.
--
MOS_MIGRATED_REVID=128843642
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ArtifactFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/ArtifactFunction.java
index 5393d19..f7007b7 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/ArtifactFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/ArtifactFunction.java
@@ -30,7 +30,7 @@
import com.google.devtools.build.lib.events.Event;
import com.google.devtools.build.lib.events.EventHandler;
import com.google.devtools.build.lib.skyframe.ActionLookupValue.ActionLookupKey;
-import com.google.devtools.build.lib.skyframe.ArtifactValue.OwnedArtifact;
+import com.google.devtools.build.lib.skyframe.ArtifactSkyKey.OwnedArtifact;
import com.google.devtools.build.lib.util.Pair;
import com.google.devtools.build.lib.util.Preconditions;
import com.google.devtools.build.lib.vfs.FileSystemUtils;
@@ -41,13 +41,10 @@
import com.google.devtools.build.skyframe.SkyFunctionException.Transience;
import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.SkyValue;
-
import java.io.IOException;
import java.util.Map;
-/**
- * A builder for {@link ArtifactValue}s.
- */
+/** A builder of values for {@link ArtifactSkyKey} keys. */
class ArtifactFunction implements SkyFunction {
private final Predicate<PathFragment> allowedMissingInputs;
@@ -169,7 +166,7 @@
return TreeArtifactValue.create(map.build());
}
- private ArtifactValue createSourceValue(Artifact artifact, boolean mandatory, Environment env)
+ private FileArtifactValue createSourceValue(Artifact artifact, boolean mandatory, Environment env)
throws MissingInputFileException {
SkyKey fileSkyKey = FileValue.key(RootedPath.toRootedPath(artifact.getRoot().getPath(),
artifact.getPath()));
@@ -204,8 +201,9 @@
return allowedMissingInputs.apply(((RootedPath) fileSkyKey.argument()).getRelativePath());
}
- private static ArtifactValue missingInputFile(Artifact artifact, boolean mandatory,
- Exception failure, EventHandler reporter) throws MissingInputFileException {
+ private static FileArtifactValue missingInputFile(
+ Artifact artifact, boolean mandatory, Exception failure, EventHandler reporter)
+ throws MissingInputFileException {
if (!mandatory) {
return FileArtifactValue.MISSING_FILE_MARKER;
}
@@ -251,14 +249,17 @@
}
}
- private AggregatingArtifactValue createAggregatingValue(Artifact artifact,
- ActionAnalysisMetadata action, FileArtifactValue value, SkyFunction.Environment env) {
+ private static AggregatingArtifactValue createAggregatingValue(
+ Artifact artifact,
+ ActionAnalysisMetadata action,
+ FileArtifactValue value,
+ SkyFunction.Environment env) {
// This artifact aggregates other artifacts. Keep track of them so callers can find them.
ImmutableList.Builder<Pair<Artifact, FileArtifactValue>> inputs = ImmutableList.builder();
for (Map.Entry<SkyKey, SkyValue> entry :
- env.getValues(ArtifactValue.mandatoryKeys(action.getInputs())).entrySet()) {
- Artifact input = ArtifactValue.artifact(entry.getKey());
- ArtifactValue inputValue = (ArtifactValue) entry.getValue();
+ env.getValues(ArtifactSkyKey.mandatoryKeys(action.getInputs())).entrySet()) {
+ Artifact input = ArtifactSkyKey.artifact(entry.getKey());
+ SkyValue inputValue = entry.getValue();
Preconditions.checkNotNull(inputValue, "%s has null dep %s", artifact, input);
if (!(inputValue instanceof FileArtifactValue)) {
// We do not recurse in aggregating middleman artifacts.