aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/skyframe/FilesystemValueChecker.java
diff options
context:
space:
mode:
authorGravatar Michael Thvedt <mthvedt@google.com>2016-02-09 03:06:34 +0000
committerGravatar Dmitry Lomov <dslomov@google.com>2016-02-09 12:20:48 +0000
commit8d5a7bbcf4e4cc59774312bc8abd0403c0655fce (patch)
treee9013bc151bbddb055d996769269871a3e094eaf /src/main/java/com/google/devtools/build/lib/skyframe/FilesystemValueChecker.java
parent434e68ebae77b4fd89c05ac676f20406e1c5b368 (diff)
Support for handling TreeArtifact metadata and returning TreeArtifacts from ArtifactFunction.
-- MOS_MIGRATED_REVID=114174899
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/FilesystemValueChecker.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/FilesystemValueChecker.java32
1 files changed, 19 insertions, 13 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/FilesystemValueChecker.java b/src/main/java/com/google/devtools/build/lib/skyframe/FilesystemValueChecker.java
index 0067dc8b2d..6b4bc3c0e9 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/FilesystemValueChecker.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/FilesystemValueChecker.java
@@ -21,6 +21,7 @@ import com.google.common.collect.Range;
import com.google.common.collect.Sets;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.google.devtools.build.lib.actions.Artifact;
+import com.google.devtools.build.lib.actions.ArtifactFile;
import com.google.devtools.build.lib.concurrent.ExecutorUtil;
import com.google.devtools.build.lib.concurrent.Sharder;
import com.google.devtools.build.lib.concurrent.ThrowableRecordingRunnableWrapper;
@@ -219,9 +220,13 @@ public class FilesystemValueChecker {
if (actionValue == null) {
dirtyKeys.add(keyAndValue.getFirst());
} else {
- for (Artifact artifact : actionValue.getAllOutputArtifactData().keySet()) {
- if (shouldCheckArtifact(knownModifiedOutputFiles, artifact)) {
- artifactToKeyAndValue.put(artifact, keyAndValue);
+ for (ArtifactFile file : actionValue.getAllFileValues().keySet()) {
+ // File system value checking for non-Artifacts is not yet implemented.
+ if (file instanceof Artifact) {
+ Artifact artifact = (Artifact) file;
+ if (shouldCheckArtifact(knownModifiedOutputFiles, artifact)) {
+ artifactToKeyAndValue.put(artifact, keyAndValue);
+ }
}
}
}
@@ -231,7 +236,7 @@ public class FilesystemValueChecker {
List<FileStatusWithDigest> stats;
try {
stats = batchStatter.batchStat(/*includeDigest=*/true, /*includeLinks=*/true,
- Artifact.asPathFragments(artifacts));
+ Artifact.asPathFragments(artifacts));
} catch (IOException e) {
// Batch stat did not work. Log an exception and fall back on system calls.
LoggingUtil.logToRemote(Level.WARNING, "Unable to process batch stat", e);
@@ -250,9 +255,10 @@ public class FilesystemValueChecker {
Pair<SkyKey, ActionExecutionValue> keyAndValue = artifactToKeyAndValue.get(artifact);
ActionExecutionValue actionValue = keyAndValue.getSecond();
SkyKey key = keyAndValue.getFirst();
- FileValue lastKnownData = actionValue.getAllOutputArtifactData().get(artifact);
+ FileValue lastKnownData = actionValue.getAllFileValues().get(artifact);
try {
- FileValue newData = ActionMetadataHandler.fileValueFromArtifact(artifact, stat, tsgm);
+ FileValue newData = ActionMetadataHandler.fileValueFromArtifactFile(artifact, stat,
+ tsgm);
if (!newData.equals(lastKnownData)) {
updateIntraBuildModifiedCounter(stat != null ? stat.getLastChangeTime() : -1,
lastKnownData.isSymlink(), newData.isSymlink());
@@ -310,13 +316,13 @@ public class FilesystemValueChecker {
private boolean actionValueIsDirtyWithDirectSystemCalls(ActionExecutionValue actionValue,
ImmutableSet<PathFragment> knownModifiedOutputFiles) {
boolean isDirty = false;
- for (Map.Entry<Artifact, FileValue> entry :
- actionValue.getAllOutputArtifactData().entrySet()) {
- Artifact artifact = entry.getKey();
+ for (Map.Entry<ArtifactFile, FileValue> entry : actionValue.getAllFileValues().entrySet()) {
+ ArtifactFile file = entry.getKey();
FileValue lastKnownData = entry.getValue();
- if (shouldCheckArtifact(knownModifiedOutputFiles, artifact)) {
+ if (shouldCheckArtifact(knownModifiedOutputFiles, file)) {
try {
- FileValue fileValue = ActionMetadataHandler.fileValueFromArtifact(artifact, null, tsgm);
+ FileValue fileValue = ActionMetadataHandler.fileValueFromArtifactFile(file, null,
+ tsgm);
if (!fileValue.equals(lastKnownData)) {
updateIntraBuildModifiedCounter(fileValue.exists()
? fileValue.realRootedPath().asPath().getLastModifiedTime()
@@ -335,9 +341,9 @@ public class FilesystemValueChecker {
}
private static boolean shouldCheckArtifact(ImmutableSet<PathFragment> knownModifiedOutputFiles,
- Artifact artifact) {
+ ArtifactFile file) {
return knownModifiedOutputFiles == null
- || knownModifiedOutputFiles.contains(artifact.getExecPath());
+ || knownModifiedOutputFiles.contains(file.getExecPath());
}
private BatchDirtyResult getDirtyValues(ValueFetcher fetcher,