Exemplo n.º 1
0
  @SuppressWarnings("StringBufferReplaceableByString")
  String createDiagnosticsMessage(
      String trailingMessage, GradleExecutionResult gradleExecutionResult) {
    String lineBreak = SystemProperties.getInstance().getLineSeparator();
    StringBuilder message = new StringBuilder();
    message.append(trailingMessage);
    message.append(" in ");
    message.append(getProjectDir().getAbsolutePath());
    message.append(" with arguments ");
    message.append(getArguments());

    String output = gradleExecutionResult.getOutput();
    if (output != null && !output.isEmpty()) {
      message.append(lineBreak);
      message.append(lineBreak);
      message.append("Output:");
      message.append(lineBreak);
      message.append(output);
    }

    return message.toString();
  }
Exemplo n.º 2
0
  private String createDiagnosticsMessage(
      String trailingMessage, GradleExecutionResult gradleExecutionResult) {
    String lineBreak = SystemProperties.getInstance().getLineSeparator();
    StringBuilder message = new StringBuilder();
    message.append(trailingMessage);
    message.append(" in ");
    message.append(getProjectDir().getAbsolutePath());
    message.append(" with arguments ");
    message.append(getArguments());
    message.append(lineBreak).append(lineBreak);
    message.append("Output:");
    message.append(lineBreak);
    message.append(gradleExecutionResult.getStandardOutput());
    message.append(lineBreak);
    message.append(DIAGNOSTICS_MESSAGE_SEPARATOR);
    message.append(lineBreak);
    message.append("Error:");
    message.append(lineBreak);
    message.append(gradleExecutionResult.getStandardError());
    message.append(lineBreak);
    message.append(DIAGNOSTICS_MESSAGE_SEPARATOR);

    if (gradleExecutionResult.getThrowable() != null) {
      message.append(lineBreak);
      message.append("Reason:");
      message.append(lineBreak);
      message.append(determineExceptionMessage(gradleExecutionResult.getThrowable()));
      message.append(lineBreak);
      message.append(DIAGNOSTICS_MESSAGE_SEPARATOR);
    }

    return message.toString();
  }