Esempio n. 1
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();
  }
Esempio n. 2
0
  private BuildResult run(Action<GradleExecutionResult> resultVerification) {
    if (projectDirectory == null) {
      throw new InvalidRunnerConfigurationException(
          "Please specify a project directory before executing the build");
    }

    GradleExecutionResult execResult =
        gradleExecutor.run(
            gradleHome, gradleUserHomeDir, projectDirectory, arguments, jvmArguments);

    resultVerification.execute(execResult);

    return new DefaultBuildResult(
        execResult.getStandardOutput(), execResult.getStandardError(), execResult.getTasks());
  }
Esempio n. 3
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();
  }
Esempio n. 4
0
 private BuildResult createBuildResult(GradleExecutionResult execResult) {
   return new DefaultBuildResult(execResult.getOutput(), execResult.getTasks());
 }