aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupValue.java
diff options
context:
space:
mode:
authorGravatar ulfjack <ulfjack@google.com>2017-04-20 13:45:25 +0200
committerGravatar Klaus Aehlig <aehlig@google.com>2017-04-20 15:39:11 +0200
commit8989e19ab957a18f4937531dd55b5c30b207e6df (patch)
treeaa9c24c56059ae4b33fb484b7499b68d16127eaa /src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupValue.java
parentde48d7d8cf0fe3d87e348e74e10506d160495428 (diff)
Rewrite repository lookup to return a failed value rather than throw
We need to lookup repositories as part of converting exec paths to artifacts, which in turn is needed for action cache lookups. These lookups should not cause a Skyframe exit, so we must not throw an exception here, unless the error makes it impossible to continue. Instead, we need to leave the decision whether to error out or not to the caller. Note that we may unnecessarily fetch a remote repository in order to do the action cache lookup, even if the action no longer depends on the input file, although this should only be possible for C++ compile actions. It's possible that there's another bug in the C++ compile action key computation that also contributes. This change also makes it so that the post-resolution action cache code ignores any errors wrt. repository lookup rather than throwing. If any of the paths could not be found, then the action cache lookup fails and we re-execute the corresponding action, which is exactly what should happen. Fixes #2759. PiperOrigin-RevId: 153696243
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupValue.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupValue.java32
1 files changed, 28 insertions, 4 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupValue.java b/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupValue.java
index 7db3a2abdd..5ed0e55e5c 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupValue.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupValue.java
@@ -88,16 +88,21 @@ public abstract class PackageLookupValue implements SkyValue {
new NoBuildFilePackageLookupValue();
public static final DeletedPackageLookupValue DELETED_PACKAGE_VALUE =
new DeletedPackageLookupValue();
+ public static final NoRepositoryPackageLookupValue NO_SUCH_REPOSITORY_VALUE =
+ new NoRepositoryPackageLookupValue();
enum ErrorReason {
- // There is no BUILD file.
+ /** There is no BUILD file. */
NO_BUILD_FILE,
- // The package name is invalid.
+ /** The package name is invalid. */
INVALID_PACKAGE_NAME,
- // The package is considered deleted because of --deleted_packages.
- DELETED_PACKAGE
+ /** The package is considered deleted because of --deleted_packages. */
+ DELETED_PACKAGE,
+
+ /** The repository was not found. */
+ REPOSITORY_NOT_FOUND
}
protected PackageLookupValue() {
@@ -290,4 +295,23 @@ public abstract class PackageLookupValue implements SkyValue {
return "Package is considered deleted due to --deleted_packages";
}
}
+
+ /**
+ * Marker value for repository we could not find. This can happen when looking for a label that
+ * specifies a non-existent repository.
+ */
+ public static class NoRepositoryPackageLookupValue extends UnsuccessfulPackageLookupValue {
+
+ private NoRepositoryPackageLookupValue() {}
+
+ @Override
+ ErrorReason getErrorReason() {
+ return ErrorReason.REPOSITORY_NOT_FOUND;
+ }
+
+ @Override
+ public String getErrorMsg() {
+ return "The repository could not be resolved";
+ }
+ }
}