@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();
  }
 private BuildResult createBuildResult(GradleExecutionResult execResult) {
   return new DefaultBuildResult(execResult.getOutput(), execResult.getTasks());
 }