aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/skyframe/TreeArtifactValue.java
diff options
context:
space:
mode:
authorGravatar Rumou Duan <rduan@google.com>2016-10-19 19:28:06 +0000
committerGravatar Philipp Wollermann <philwo@google.com>2016-10-19 19:44:52 +0000
commit9ad28cd6001feb5dd8afda5878ebacfe25efe254 (patch)
tree7fd858ca933ef88504a5d4ded21bde7e655fa531 /src/main/java/com/google/devtools/build/lib/skyframe/TreeArtifactValue.java
parentca9a425a4825b5fd9892ec55051e7ffb2025bea2 (diff)
Proper action output checks for TreeArtifacts. Instead of crashing Bazel, we now handle failed TreeArtifact output checks gracefully.
-- MOS_MIGRATED_REVID=136627086
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/TreeArtifactValue.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/TreeArtifactValue.java32
1 files changed, 10 insertions, 22 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/TreeArtifactValue.java b/src/main/java/com/google/devtools/build/lib/skyframe/TreeArtifactValue.java
index e37be07a5c..b523c92e37 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/TreeArtifactValue.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/TreeArtifactValue.java
@@ -180,29 +180,18 @@ class TreeArtifactValue implements SkyValue {
}
};
- /**
- * Exception used when the contents of a directory do not form a valid SetArtifact.
- * (We cannot use IOException because ActionMetadataHandler, in some code paths,
- * interprets IOExceptions as missing files.)
- */
- static class TreeArtifactException extends Exception {
- TreeArtifactException(String message) {
- super(message);
- }
- }
-
- private static void explodeDirectory(Artifact rootArtifact,
+ private static void explodeDirectory(Artifact treeArtifact,
PathFragment pathToExplode, ImmutableSet.Builder<PathFragment> valuesBuilder)
- throws IOException, TreeArtifactException {
- for (Path subpath : rootArtifact.getPath().getRelative(pathToExplode).getDirectoryEntries()) {
+ throws IOException {
+ for (Path subpath : treeArtifact.getPath().getRelative(pathToExplode).getDirectoryEntries()) {
PathFragment canonicalSubpathFragment =
pathToExplode.getChild(subpath.getBaseName()).normalize();
if (subpath.isDirectory()) {
- explodeDirectory(rootArtifact,
+ explodeDirectory(treeArtifact,
pathToExplode.getChild(subpath.getBaseName()), valuesBuilder);
} else if (subpath.isSymbolicLink()) {
- throw new TreeArtifactException(
- "A SetArtifact may not contain a symlink, found " + subpath);
+ throw new IOException(
+ "A TreeArtifact may not contain a symlink, found " + subpath);
} else if (subpath.isFile()) {
valuesBuilder.add(canonicalSubpathFragment);
} else {
@@ -215,13 +204,12 @@ class TreeArtifactValue implements SkyValue {
/**
* Recursively get all child files in a directory
* (excluding child directories themselves, but including all files in them).
- * @throws IOException if one was thrown reading directory contents from disk.
- * @throws TreeArtifactException if the on-disk directory is not a valid TreeArtifact.
+ * @throws IOException if there is any problem reading or validating outputs under the given
+ * tree artifact.
*/
- static Set<PathFragment> explodeDirectory(Artifact rootArtifact)
- throws IOException, TreeArtifactException {
+ static Set<PathFragment> explodeDirectory(Artifact treeArtifact) throws IOException {
ImmutableSet.Builder<PathFragment> explodedDirectory = ImmutableSet.builder();
- explodeDirectory(rootArtifact, PathFragment.EMPTY_FRAGMENT, explodedDirectory);
+ explodeDirectory(treeArtifact, PathFragment.EMPTY_FRAGMENT, explodedDirectory);
return explodedDirectory.build();
}
}