diff options
author | 2016-01-29 08:09:11 +0000 | |
---|---|---|
committer | 2016-01-29 14:42:06 +0000 | |
commit | 229c17f76afb53de7081e360a82add53a7bfa03a (patch) | |
tree | 99a153f1f322bcc946b8050bbbdf6816e502bc48 /src | |
parent | 1c6a0c9afde784886f9c011483afc1523e66fcf9 (diff) |
Small refactoring of SkyframeBuildView to reduce the diff for the next change.
--
MOS_MIGRATED_REVID=113338481
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/skyframe/SkyframeBuildView.java | 66 |
1 files changed, 34 insertions, 32 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeBuildView.java b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeBuildView.java index 2802fadc40..c2d17150cd 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeBuildView.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeBuildView.java @@ -335,38 +335,40 @@ public final class SkyframeBuildView { // --keep_going : We notify the error and return a ConfiguredTargetValue for (Map.Entry<SkyKey, ErrorInfo> errorEntry : result.errorMap().entrySet()) { - if (values.contains(errorEntry.getKey().argument())) { - SkyKey errorKey = errorEntry.getKey(); - ConfiguredTargetKey label = (ConfiguredTargetKey) errorKey.argument(); - ErrorInfo errorInfo = errorEntry.getValue(); - assertSaneAnalysisError(errorInfo, errorKey); - - skyframeExecutor.getCyclesReporter().reportCycles(errorInfo.getCycleInfo(), errorKey, - eventHandler); - Exception cause = errorInfo.getException(); - // We try to get the root cause key first from ErrorInfo rootCauses. If we don't have one - // we try to use the cycle culprit if the error is a cycle. Otherwise we use the top-level - // error key. - Label analysisRootCause; - if (cause instanceof ConfiguredValueCreationException) { - analysisRootCause = ((ConfiguredValueCreationException) cause).getAnalysisRootCause(); - } else if (!Iterables.isEmpty(errorEntry.getValue().getRootCauses())) { - SkyKey culprit = Preconditions.checkNotNull(Iterables.getFirst( - errorEntry.getValue().getRootCauses(), null)); - analysisRootCause = ((ConfiguredTargetKey) culprit.argument()).getLabel(); - } else { - analysisRootCause = maybeGetConfiguredTargetCycleCulprit(errorInfo.getCycleInfo()); - } - if (cause instanceof ActionConflictException) { - ((ActionConflictException) cause).reportTo(eventHandler); - } - eventHandler.handle( - Event.warn("errors encountered while analyzing target '" - + label.getLabel() + "': it will not be built")); - eventBus.post(new AnalysisFailureEvent( - LabelAndConfiguration.of(label.getLabel(), label.getConfiguration()), - analysisRootCause)); + // Only handle errors of configured targets, not errors of top-level aspects. + if (!values.contains(errorEntry.getKey().argument())) { + continue; + } + SkyKey errorKey = errorEntry.getKey(); + ConfiguredTargetKey label = (ConfiguredTargetKey) errorKey.argument(); + ErrorInfo errorInfo = errorEntry.getValue(); + assertSaneAnalysisError(errorInfo, errorKey); + + skyframeExecutor.getCyclesReporter().reportCycles(errorInfo.getCycleInfo(), errorKey, + eventHandler); + Exception cause = errorInfo.getException(); + // We try to get the root cause key first from ErrorInfo rootCauses. If we don't have one + // we try to use the cycle culprit if the error is a cycle. Otherwise we use the top-level + // error key. + Label analysisRootCause; + if (cause instanceof ConfiguredValueCreationException) { + analysisRootCause = ((ConfiguredValueCreationException) cause).getAnalysisRootCause(); + } else if (!Iterables.isEmpty(errorEntry.getValue().getRootCauses())) { + SkyKey culprit = Preconditions.checkNotNull(Iterables.getFirst( + errorEntry.getValue().getRootCauses(), null)); + analysisRootCause = ((ConfiguredTargetKey) culprit.argument()).getLabel(); + } else { + analysisRootCause = maybeGetConfiguredTargetCycleCulprit(errorInfo.getCycleInfo()); + } + if (cause instanceof ActionConflictException) { + ((ActionConflictException) cause).reportTo(eventHandler); } + eventHandler.handle( + Event.warn("errors encountered while analyzing target '" + + label.getLabel() + "': it will not be built")); + eventBus.post(new AnalysisFailureEvent( + LabelAndConfiguration.of(label.getLabel(), label.getConfiguration()), + analysisRootCause)); } Collection<Exception> reportedExceptions = Sets.newHashSet(); @@ -411,7 +413,7 @@ public final class SkyframeBuildView { } @Nullable - Label maybeGetConfiguredTargetCycleCulprit(Iterable<CycleInfo> cycleInfos) { + private Label maybeGetConfiguredTargetCycleCulprit(Iterable<CycleInfo> cycleInfos) { for (CycleInfo cycleInfo : cycleInfos) { SkyKey culprit = Iterables.getFirst(cycleInfo.getCycle(), null); if (culprit == null) { |