void (@NotNull Project project, @NotNull ProjectTaskContext context, @Nullable ProjectTaskNotification callback, @NotNull Collection<? extends ProjectTask> tasks) { Tracer.Span jpsRunnerStart = Tracer.start("jps runner"); context.putUserData(JPS_BUILD_DATA_KEY, new MyJpsBuildData()); SimpleMessageBusConnection fileGeneratedTopicConnection; if (context.isCollectionOfGeneratedFilesEnabled()) { fileGeneratedTopicConnection = project.getMessageBus().simpleConnect(); fileGeneratedTopicConnection.subscribe(CompilerTopics.COMPILATION_STATUS, new CompilationStatusListener() { @Override public void fileGenerated(@NotNull String outputRoot, @NotNull String relativePath) { context.fileGenerated(outputRoot, relativePath); } }); } else { fileGeneratedTopicConnection = null; } Map<Class<? extends ProjectTask>, List<ProjectTask>> taskMap = groupBy(tasks); ModalityUiUtil.invokeLaterIfNeeded(ModalityState.defaultModalityState(), project.getDisposed(), () -> { try (MyNotificationCollector notificationCollector = new MyNotificationCollector(context, callback, () -> { if (fileGeneratedTopicConnection != null) { fileGeneratedTopicConnection.disconnect(); } })) { runModulesResourcesBuildTasks(project, context, notificationCollector, taskMap); runModulesBuildTasks(project, context, notificationCollector, taskMap); runFilesBuildTasks(project, notificationCollector, taskMap); runEmptyBuildTask(project, context, notificationCollector, taskMap); runArtifactsBuildTasks(project, context, notificationCollector, taskMap); } }); jpsRunnerStart.complete(); }