void (final Throwable error, boolean hadBuildErrors, boolean doneSomething) { CmdlineRemoteProto.Message lastMessage = null; try { if (error instanceof CannotLoadJpsModelException) { String text = JpsBuildBundle.message("build.message.failed.to.load.project.configuration.0", StringUtil.decapitalize(error.getMessage())); String path = ((CannotLoadJpsModelException)error).getFile().getAbsolutePath(); lastMessage = CmdlineProtoUtil.toMessage(mySessionId, CmdlineProtoUtil.createCompileMessage(BuildMessage.Kind.ERROR, text, path, -1, -1, -1, -1, -1, -1.0f, Collections.emptyList())); } else if (error != null) { Throwable cause = error.getCause(); if (cause == null) { cause = error; } @Nls StringBuilder messageText = new StringBuilder(); messageText.append(JpsBuildBundle.message("build.message.internal.error.0.1", cause.getClass().getName(),cause.getMessage())); String trace = ExceptionUtil.getThrowableText(cause); if (!trace.isEmpty()) { messageText.append("\n").append(trace); } if (error instanceof RebuildRequestedException || cause instanceof IOException) { messageText.append("\n").append(JpsBuildBundle.message("build.message.perform.full.project.rebuild")); } lastMessage = CmdlineProtoUtil.toMessage(mySessionId, CmdlineProtoUtil.createFailure(messageText.toString(), cause)); } else { CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Status status = CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Status.SUCCESS; if (myCanceled) { status = CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Status.CANCELED; } else if (hadBuildErrors) { status = CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Status.ERRORS; } else if (!doneSomething){ status = CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Status.UP_TO_DATE; } if (ProjectStamps.PORTABLE_CACHES) { JpsOutputLoaderManager.saveLatestBuiltCommitId(status, myChannel, mySessionId); } lastMessage = CmdlineProtoUtil.toMessage(mySessionId, CmdlineProtoUtil.createBuildCompletedEvent("build completed", status)); } } catch (Throwable e) { lastMessage = CmdlineProtoUtil.toMessage(mySessionId, CmdlineProtoUtil.createFailure(e.getMessage(), e)); } finally { try { myChannel.writeAndFlush(lastMessage).await(); } catch (InterruptedException e) { LOG.info(e); } } }