mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-02-05 08:06:56 +07:00
JpsProjectTaskRunner: reliably fire notifications when both runner finishes and all tracked async subtasks are completed (fixes IDEA-291331)
GitOrigin-RevId: dac22c52807d55c998a5bc0196250f633a902776
This commit is contained in:
committed by
intellij-monorepo-bot
parent
28750296ba
commit
ceb89c12c1
@@ -100,7 +100,7 @@ public final class CompileDriver {
|
||||
startup(scope, false, false, withModalProgress, callback, null);
|
||||
}
|
||||
else {
|
||||
SwingUtilities.invokeLater(() -> callback.finished(true, 0, 0, DummyCompileContext.create(myProject)));
|
||||
callback.finished(true, 0, 0, DummyCompileContext.create(myProject));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -445,7 +445,7 @@ public final class CompileDriver {
|
||||
final ProgressIndicator indicator = compileContext.getProgressIndicator();
|
||||
if (indicator.isCanceled() || myProject.isDisposed()) {
|
||||
if (callback != null) {
|
||||
SwingUtilities.invokeLater(() -> callback.finished(true, 0, 0, compileContext));
|
||||
callback.finished(true, 0, 0, compileContext);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -351,20 +351,26 @@ public final class JpsProjectTaskRunner extends ProjectTaskRunner {
|
||||
|
||||
@Override
|
||||
synchronized public void close() {
|
||||
myCollectingStopped = true;
|
||||
if (!myCollectingStopped) {
|
||||
myCollectingStopped = true;
|
||||
notifyFinished();
|
||||
}
|
||||
}
|
||||
|
||||
synchronized private void notifyFinished() {
|
||||
if (myTaskNotification != null) {
|
||||
myTaskNotification.finished(new ProjectTaskResult(myAborted, myErrors, myWarnings));
|
||||
private void notifyFinished() {
|
||||
if (myCollectingStopped && myNotifications.isEmpty()) {
|
||||
if (myTaskNotification != null) {
|
||||
myTaskNotification.finished(new ProjectTaskResult(myAborted, myErrors, myWarnings));
|
||||
}
|
||||
myOnFinished.run();
|
||||
}
|
||||
myOnFinished.run();
|
||||
}
|
||||
|
||||
synchronized private void appendJpsBuildResult(boolean aborted, int errors, int warnings,
|
||||
@NotNull CompileContext compileContext,
|
||||
@NotNull MyCompileStatusNotification notification) {
|
||||
if (!myNotifications.remove(notification)) {
|
||||
final boolean notificationRemoved = myNotifications.remove(notification);
|
||||
if (!notificationRemoved) {
|
||||
LOG.error("Multiple invocation of the same callback");
|
||||
}
|
||||
myErrors += errors;
|
||||
@@ -373,7 +379,7 @@ public final class JpsProjectTaskRunner extends ProjectTaskRunner {
|
||||
MyJpsBuildData jpsBuildData = (MyJpsBuildData)JPS_BUILD_DATA_KEY.get(myContext);
|
||||
jpsBuildData.add(compileContext);
|
||||
|
||||
if (myCollectingStopped && myNotifications.isEmpty()) {
|
||||
if (notificationRemoved) {
|
||||
notifyFinished();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user