aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/skyframe/SkyframePackageLoaderWithValueEnvironment.java
diff options
context:
space:
mode:
authorGravatar Janak Ramakrishnan <janakr@google.com>2015-09-17 00:37:58 +0000
committerGravatar David Chen <dzc@google.com>2015-09-17 19:32:54 +0000
commit0a4c6e4608121eb1ef3f62dda5bddc8a9fed308d (patch)
treef214f6c39d8ffe9f9aeba6419b9a0243d71686d6 /src/main/java/com/google/devtools/build/lib/skyframe/SkyframePackageLoaderWithValueEnvironment.java
parent44a7a6c10b621d0ef8aea40d93fa82591e67d555 (diff)
Stop throwing an exception if a Package was successfully created but contains errors. Instead, require callers to process the package and throw if they need to.
This allows us to avoid embedding a Package in an exception, which is icky. This also allows us to remove Package#containsTemporaryErrors. Most callers' changes are fairly straightforward. The exception is EnvironmentBackedRecursivePackageProvider, which cannot throw an exception of its own in case of a package with errors (because it doesn't do that in keep_going mode), but whose request for a package with errors *should* shut down the build in case of nokeep_going mode. To do this in Skyframe, we have a new PackageErrorFunction which is to be called only in this situation, and will unconditionally throw. EnvironmentBackedRecursivePackageProvider can then catch this exception and continue on as usual, except that the exception will shut down the thread pool in a nokeep_going build. -- MOS_MIGRATED_REVID=103247761
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/SkyframePackageLoaderWithValueEnvironment.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/SkyframePackageLoaderWithValueEnvironment.java17
1 files changed, 3 insertions, 14 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframePackageLoaderWithValueEnvironment.java b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframePackageLoaderWithValueEnvironment.java
index 80ccb1380e..b7d94e7dd7 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframePackageLoaderWithValueEnvironment.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframePackageLoaderWithValueEnvironment.java
@@ -46,7 +46,9 @@ class SkyframePackageLoaderWithValueEnvironment implements
this.env = env;
}
- private Package getPackage(PackageIdentifier pkgIdentifier) throws NoSuchPackageException{
+ @Override
+ public Package getLoadedPackage(final PackageIdentifier pkgIdentifier)
+ throws NoSuchPackageException {
SkyKey key = PackageValue.key(pkgIdentifier);
PackageValue value = (PackageValue) env.getValueOrThrow(key, NoSuchPackageException.class);
if (value != null) {
@@ -56,19 +58,6 @@ class SkyframePackageLoaderWithValueEnvironment implements
}
@Override
- public Package getLoadedPackage(final PackageIdentifier pkgIdentifier)
- throws NoSuchPackageException {
- try {
- return getPackage(pkgIdentifier);
- } catch (NoSuchPackageException e) {
- if (e.getPackage() != null) {
- return e.getPackage();
- }
- throw e;
- }
- }
-
- @Override
public Target getLoadedTarget(Label label) throws NoSuchPackageException,
NoSuchTargetException {
Package pkg = getLoadedPackage(label.getPackageIdentifier());