aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/exec
diff options
context:
space:
mode:
authorGravatar felly <felly@google.com>2018-08-09 12:55:47 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-08-09 12:57:32 -0700
commit943a9c792032c75b25a1665e7143409fe3950041 (patch)
tree4c7d5ad6cf65f670252149c230704c4b98481c0d /src/main/java/com/google/devtools/build/lib/exec
parentdec4e17a98477162ef42ab610b1e94b7cdaaf438 (diff)
Pass Fileset information to the Action filesystem.
PiperOrigin-RevId: 208096548
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/exec')
-rw-r--r--src/main/java/com/google/devtools/build/lib/exec/FilesetManifest.java29
1 files changed, 22 insertions, 7 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/exec/FilesetManifest.java b/src/main/java/com/google/devtools/build/lib/exec/FilesetManifest.java
index 1b35631108..af6232b750 100644
--- a/src/main/java/com/google/devtools/build/lib/exec/FilesetManifest.java
+++ b/src/main/java/com/google/devtools/build/lib/exec/FilesetManifest.java
@@ -15,7 +15,9 @@ package com.google.devtools.build.lib.exec;
import static java.nio.charset.StandardCharsets.UTF_8;
+import com.google.common.collect.ImmutableMap;
import com.google.common.io.LineProcessor;
+import com.google.devtools.build.lib.actions.FileArtifactValue;
import com.google.devtools.build.lib.actions.FilesetOutputSymlink;
import com.google.devtools.build.lib.analysis.AnalysisUtils;
import com.google.devtools.build.lib.vfs.FileSystemUtils;
@@ -57,7 +59,7 @@ public final class FilesetManifest {
Path execRoot,
String workspaceName,
RelativeSymlinkBehavior relSymlinkBehavior)
- throws IOException {
+ throws IOException {
Path file = execRoot.getRelative(AnalysisUtils.getManifestPathFromFilesetPath(manifest));
try {
return FileSystemUtils.asByteSource(file).asCharSource(UTF_8)
@@ -77,13 +79,17 @@ public final class FilesetManifest {
throws IOException {
LinkedHashMap<PathFragment, String> entries = new LinkedHashMap<>();
Map<PathFragment, String> relativeLinks = new HashMap<>();
+ Map<String, FileArtifactValue> artifactValues = new HashMap<>();
for (FilesetOutputSymlink outputSymlink : outputSymlinks) {
PathFragment fullLocation = targetPrefix.getRelative(outputSymlink.getName());
String artifact = outputSymlink.getTargetPath().getPathString();
artifact = artifact.isEmpty() ? null : artifact;
addSymlinkEntry(artifact, fullLocation, relSymlinkbehavior, entries, relativeLinks);
+ if (outputSymlink.getMetadata() instanceof FileArtifactValue) {
+ artifactValues.put(artifact, (FileArtifactValue) outputSymlink.getMetadata());
+ }
}
- return constructFilesetManifest(entries, relativeLinks);
+ return constructFilesetManifest(entries, relativeLinks, artifactValues);
}
private static final class ManifestLineProcessor implements LineProcessor<FilesetManifest> {
@@ -147,7 +153,7 @@ public final class FilesetManifest {
@Override
public FilesetManifest getResult() {
- return constructFilesetManifest(entries, relativeLinks);
+ return constructFilesetManifest(entries, relativeLinks, ImmutableMap.of());
}
}
@@ -173,7 +179,8 @@ public final class FilesetManifest {
}
private static FilesetManifest constructFilesetManifest(
- Map<PathFragment, String> entries, Map<PathFragment, String> relativeLinks) {
+ Map<PathFragment, String> entries, Map<PathFragment, String> relativeLinks,
+ Map<String, FileArtifactValue> artifactValues) {
// Resolve relative symlinks if possible. Note that relativeLinks only contains entries in
// RESOLVE mode.
for (Map.Entry<PathFragment, String> e : relativeLinks.entrySet()) {
@@ -196,16 +203,24 @@ public final class FilesetManifest {
}
entries.put(location, actual);
}
- return new FilesetManifest(entries);
+ return new FilesetManifest(entries, artifactValues);
}
private final Map<PathFragment, String> entries;
+ private final Map<String, FileArtifactValue> artifactValues;
- private FilesetManifest(Map<PathFragment, String> entries) {
+ private FilesetManifest(Map<PathFragment, String> entries,
+ Map<String, FileArtifactValue> artifactValues) {
this.entries = Collections.unmodifiableMap(entries);
+ this.artifactValues = artifactValues;
}
public Map<PathFragment, String> getEntries() {
return entries;
}
-}
+
+ public Map<String, FileArtifactValue> getArtifactValues() {
+ return artifactValues;
+ }
+
+} \ No newline at end of file