aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/actions/ArtifactFactory.java
diff options
context:
space:
mode:
authorGravatar Michajlo Matijkiw <michajlo@google.com>2015-06-09 22:09:03 +0000
committerGravatar Philipp Wollermann <philwo@google.com>2015-06-10 16:02:26 +0000
commit331633c7c22a9ae00f26e11fb6c54a9bd2b83097 (patch)
tree69a0ae31a464a35b49ab149ff60bd26ef2f90627 /src/main/java/com/google/devtools/build/lib/actions/ArtifactFactory.java
parent1cad714e2157dd940cc75428e8bb4d682b1bef28 (diff)
Handle exceptions encountered resolving packages during the execution phase
Currently we may do lookups of not-already-cached packages during the execution phase for actions that discover inputs. Exceptions encountered during this would go unhandled and result in a crash. Here we introduce PackageRootResolutionException which wraps these exceptions and triggers an ActionExecutionException which is cleanly handled in the exec phase. As part of this change SkyframeActionExecutor#getArtifactRoots(...) will fail properly on errors getting package roots. -- MOS_MIGRATED_REVID=95578891
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/actions/ArtifactFactory.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/actions/ArtifactFactory.java11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/actions/ArtifactFactory.java b/src/main/java/com/google/devtools/build/lib/actions/ArtifactFactory.java
index f9c0e75fe7..db94639861 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/ArtifactFactory.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/ArtifactFactory.java
@@ -255,7 +255,8 @@ public class ArtifactFactory implements ArtifactResolver, ArtifactSerializer, Ar
@Override
public synchronized Map<PathFragment, Artifact> resolveSourceArtifacts(
- Iterable<PathFragment> execPaths, PackageRootResolver resolver) {
+ Iterable<PathFragment> execPaths, PackageRootResolver resolver)
+ throws PackageRootResolutionException {
Map<PathFragment, Artifact> result = new HashMap<>();
ArrayList<PathFragment> unresolvedPaths = new ArrayList<>();
@@ -346,15 +347,17 @@ public class ArtifactFactory implements ArtifactResolver, ArtifactSerializer, Ar
* cannot be created. Unfortunately, we currently need this in some cases.
*
* @param execPath the exec path of the artifact
+ * @throws PackageRootResolutionException on failure to determine the package roots of
+ * {@code execPath}
*/
- public Artifact deserializeArtifact(PathFragment execPath, PackageRootResolver resolver) {
+ public Artifact deserializeArtifact(PathFragment execPath, PackageRootResolver resolver)
+ throws PackageRootResolutionException {
Preconditions.checkArgument(!execPath.isAbsolute(), execPath);
Path path = execRoot.getRelative(execPath);
Root root = findDerivedRoot(path);
- Artifact result;
if (root != null) {
- result = getDerivedArtifact(path.relativeTo(root.getPath()), root,
+ Artifact result = getDerivedArtifact(path.relativeTo(root.getPath()), root,
Artifact.DESERIALIZED_MARKER_OWNER);
Artifact oldResult = deserializedArtifacts.putIfAbsent(execPath, result);
if (oldResult != null) {