Skip to content

Commit

Permalink
[Skymeld] Send aborted events for skipped targets.
Browse files Browse the repository at this point in the history
This was missing in Skymeld.

PiperOrigin-RevId: 532029993
Change-Id: I893bbbe9c420991b4997c7a448f90fed7b579e69
  • Loading branch information
joeleba authored and copybara-github committed May 15, 2023
1 parent 26790f3 commit 1fa7794
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ static AnalysisAndExecutionResult execute(
AnalysisPhaseRunner.reportTargets(env, buildResultListener.getAnalyzedTargets());
}

AnalysisPhaseRunner.postAbortedEventsForSkippedTargets(
env, buildResultListener.getSkippedTargets());
} else {
env.getReporter().handle(Event.progress("Loading complete."));
env.getReporter().post(new NoAnalyzeEvent());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,19 +153,7 @@ public static AnalysisResult execute(
reportTargets(env, analysisResult.getTargetsToBuild());
}

for (ConfiguredTarget target : analysisResult.getTargetsToSkip()) {
BuildConfigurationValue config =
env.getSkyframeExecutor()
.getConfiguration(env.getReporter(), target.getConfigurationKey());
Label label = target.getLabel();
env.getEventBus()
.post(
new AbortedEvent(
BuildEventIdUtil.targetCompleted(label, config.getEventId()),
AbortReason.SKIPPED,
String.format("Target %s build was skipped.", label),
label));
}
postAbortedEventsForSkippedTargets(env, analysisResult.getTargetsToSkip());
} else {
env.getReporter().handle(Event.progress("Loading complete."));
env.getReporter().post(new NoAnalyzeEvent());
Expand All @@ -181,6 +169,23 @@ public static AnalysisResult execute(
return analysisResult;
}

static void postAbortedEventsForSkippedTargets(
CommandEnvironment env, ImmutableSet<ConfiguredTarget> targetsToSkip) {
for (ConfiguredTarget target : targetsToSkip) {
BuildConfigurationValue config =
env.getSkyframeExecutor()
.getConfiguration(env.getReporter(), target.getConfigurationKey());
Label label = target.getLabel();
env.getEventBus()
.post(
new AbortedEvent(
BuildEventIdUtil.targetCompleted(label, config.getEventId()),
AbortReason.SKIPPED,
String.format("Target %s build was skipped.", label),
label));
}
}

private static TargetPatternPhaseValue evaluateTargetPatterns(
CommandEnvironment env, final BuildRequest request, final TargetValidator validator)
throws LoadingFailedException, TargetParsingException, InterruptedException {
Expand Down

0 comments on commit 1fa7794

Please sign in to comment.