diff options
author | 2016-08-16 18:24:25 +0000 | |
---|---|---|
committer | 2016-08-17 11:24:21 +0000 | |
commit | d503fdcc7dfc61b53b7843585fde4aec5bbf03da (patch) | |
tree | aaa0fba169813ebcadb55a0bf8f3b303f98d2741 /src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java | |
parent | 10b382587a79bdd431f7b2630d445561585f097c (diff) |
Simplify SkyframeExecutor#evaluateSkyKeyForCodeMigration and allow it to throw InterruptedException.
--
MOS_MIGRATED_REVID=130424634
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java | 48 |
1 files changed, 19 insertions, 29 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java index a735261a9e..343e59dbe8 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java @@ -43,6 +43,7 @@ import com.google.devtools.build.lib.actions.ActionLogBufferPathGenerator; import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.actions.ArtifactFactory; import com.google.devtools.build.lib.actions.ArtifactOwner; +import com.google.devtools.build.lib.actions.EnvironmentalExecException; import com.google.devtools.build.lib.actions.Executor; import com.google.devtools.build.lib.actions.PackageRootResolutionException; import com.google.devtools.build.lib.actions.ResourceManager; @@ -486,35 +487,24 @@ public abstract class SkyframeExecutor implements WalkableGraphFactory { * This method exists only to allow a module to make a top-level Skyframe call during the * transition to making it fully Skyframe-compatible. Do not add additional callers! */ - public <E extends Exception> SkyValue evaluateSkyKeyForCodeMigration( - final EventHandler eventHandler, final SkyKey key, final Class<E> clazz) throws E { - try { - return callUninterruptibly(new Callable<SkyValue>() { - @Override - public SkyValue call() throws E, InterruptedException { - synchronized (valueLookupLock) { - // We evaluate in keepGoing mode because in the case that the graph does not store its - // edges, nokeepGoing builds are not allowed, whereas keepGoing builds are always - // permitted. - EvaluationResult<SkyValue> result = buildDriver.evaluate( - ImmutableList.of(key), true, ResourceUsage.getAvailableProcessors(), - eventHandler); - if (!result.hasError()) { - return Preconditions.checkNotNull(result.get(key), "%s %s", result, key); - } - ErrorInfo errorInfo = Preconditions.checkNotNull(result.getError(key), - "%s %s", key, result); - Throwables.propagateIfPossible(errorInfo.getException(), clazz); - if (errorInfo.getException() != null) { - throw new IllegalStateException(errorInfo.getException()); - } - throw new IllegalStateException(errorInfo.toString()); - } - } - }); - } catch (Exception e) { - Throwables.propagateIfPossible(e, clazz); - throw new IllegalStateException(e); + public SkyValue evaluateSkyKeyForExecutionSetup(final EventHandler eventHandler, final SkyKey key) + throws EnvironmentalExecException, InterruptedException { + synchronized (valueLookupLock) { + // We evaluate in keepGoing mode because in the case that the graph does not store its + // edges, nokeepGoing builds are not allowed, whereas keepGoing builds are always + // permitted. + EvaluationResult<SkyValue> result = + buildDriver.evaluate( + ImmutableList.of(key), true, ResourceUsage.getAvailableProcessors(), eventHandler); + if (!result.hasError()) { + return Preconditions.checkNotNull(result.get(key), "%s %s", result, key); + } + ErrorInfo errorInfo = Preconditions.checkNotNull(result.getError(key), "%s %s", key, result); + Throwables.propagateIfPossible(errorInfo.getException(), EnvironmentalExecException.class); + if (errorInfo.getException() != null) { + throw new IllegalStateException(errorInfo.getException()); + } + throw new IllegalStateException(errorInfo.toString()); } } |