public static JpsRemoteProto.Message.Response createBuildEvent(
     final JpsRemoteProto.Message.Response.BuildEvent.Type type,
     @Nullable String description,
     final JpsRemoteProto.Message.Response.BuildEvent.Status status,
     Collection<Pair<String, String>> generatedPaths) {
   final JpsRemoteProto.Message.Response.BuildEvent.Builder builder =
       JpsRemoteProto.Message.Response.BuildEvent.newBuilder().setEventType(type);
   if (description != null) {
     builder.setDescription(description);
   }
   if (status != null) {
     builder.setCompletionStatus(status);
   }
   if (generatedPaths != null) {
     for (Pair<String, String> pair : generatedPaths) {
       final JpsRemoteProto.Message.Response.BuildEvent.GeneratedFile.Builder fileBuilder =
           JpsRemoteProto.Message.Response.BuildEvent.GeneratedFile.newBuilder();
       final JpsRemoteProto.Message.Response.BuildEvent.GeneratedFile generatedFile =
           fileBuilder.setOutputRoot(pair.first).setRelativePath(pair.second).build();
       builder.addGeneratedFiles(generatedFile);
     }
   }
   return JpsRemoteProto.Message.Response.newBuilder()
       .setResponseType(JpsRemoteProto.Message.Response.Type.BUILD_EVENT)
       .setBuildEvent(builder.build())
       .build();
 }
  public static JpsRemoteProto.Message.Response createCompileMessageResponse(
      final BuildMessage.Kind kind,
      String text,
      String path,
      long beginOffset,
      long endOffset,
      long offset,
      long line,
      long column,
      float done) {

    final JpsRemoteProto.Message.Response.CompileMessage.Builder builder =
        JpsRemoteProto.Message.Response.CompileMessage.newBuilder();
    switch (kind) {
      case ERROR:
        builder.setKind(JpsRemoteProto.Message.Response.CompileMessage.Kind.ERROR);
        break;
      case WARNING:
        builder.setKind(JpsRemoteProto.Message.Response.CompileMessage.Kind.WARNING);
        break;
      case INFO:
        builder.setKind(JpsRemoteProto.Message.Response.CompileMessage.Kind.INFO);
        break;
      default:
        builder.setKind(JpsRemoteProto.Message.Response.CompileMessage.Kind.PROGRESS);
    }
    if (text != null) {
      builder.setText(text);
    }
    if (path != null) {
      builder.setSourceFilePath(path);
    }
    if (beginOffset >= 0L) {
      builder.setProblemBeginOffset(beginOffset);
    }
    if (endOffset >= 0L) {
      builder.setProblemEndOffset(endOffset);
    }
    if (offset >= 0L) {
      builder.setProblemLocationOffset(offset);
    }
    if (line > 0L) {
      builder.setLine(line);
    }
    if (column > 0L) {
      builder.setColumn(column);
    }
    if (done >= 0.0f) {
      builder.setDone(done);
    }
    return JpsRemoteProto.Message.Response.newBuilder()
        .setResponseType(JpsRemoteProto.Message.Response.Type.COMPILE_MESSAGE)
        .setCompileMessage(builder.build())
        .build();
  }
 public static JpsRemoteProto.Message.Response createBuildEvent(
     final JpsRemoteProto.Message.Response.BuildEvent.Type type, @Nullable String description) {
   final JpsRemoteProto.Message.Response.BuildEvent.Builder builder =
       JpsRemoteProto.Message.Response.BuildEvent.newBuilder().setEventType(type);
   if (description != null) {
     builder.setDescription(description);
   }
   return JpsRemoteProto.Message.Response.newBuilder()
       .setResponseType(JpsRemoteProto.Message.Response.Type.BUILD_EVENT)
       .setBuildEvent(builder.build())
       .build();
 }