Search in sources :

Example 1 with ConsoleRenderer

use of org.gradle.internal.logging.ConsoleRenderer in project gradle by gradle.

the class RunTestExecutable method handleTestFailures.

private void handleTestFailures(Exception e) {
    String message = "There were failing tests";
    String resultsUrl = new ConsoleRenderer().asClickableFileUrl(getOutputDir());
    message = message.concat(". See the results at: " + resultsUrl);
    if (isIgnoreFailures()) {
        getLogger().warn(message);
    } else {
        throw new GradleException(message, e);
    }
}
Also used : GradleException(org.gradle.api.GradleException) ConsoleRenderer(org.gradle.internal.logging.ConsoleRenderer)

Example 2 with ConsoleRenderer

use of org.gradle.internal.logging.ConsoleRenderer in project gradle by gradle.

the class Test method handleTestFailures.

private void handleTestFailures() {
    String message = "There were failing tests";
    DirectoryReport htmlReport = reports.getHtml();
    if (htmlReport.isEnabled()) {
        String reportUrl = new ConsoleRenderer().asClickableFileUrl(htmlReport.getEntryPoint());
        message = message.concat(". See the report at: " + reportUrl);
    } else {
        DirectoryReport junitXmlReport = reports.getJunitXml();
        if (junitXmlReport.isEnabled()) {
            String resultsUrl = new ConsoleRenderer().asClickableFileUrl(junitXmlReport.getEntryPoint());
            message = message.concat(". See the results at: " + resultsUrl);
        }
    }
    if (getIgnoreFailures()) {
        getLogger().warn(message);
    } else {
        throw new GradleException(message);
    }
}
Also used : GradleException(org.gradle.api.GradleException) ConsoleRenderer(org.gradle.internal.logging.ConsoleRenderer) DirectoryReport(org.gradle.api.reporting.DirectoryReport)

Example 3 with ConsoleRenderer

use of org.gradle.internal.logging.ConsoleRenderer in project gradle by gradle.

the class HtmlDependencyReportTask method generate.

@TaskAction
public void generate() {
    if (!reports.getHtml().isEnabled()) {
        setDidWork(false);
        return;
    }
    HtmlDependencyReporter reporter = new HtmlDependencyReporter(getVersionSelectorScheme(), getVersionComparator());
    reporter.render(getProjects(), reports.getHtml().getDestination());
    getProject().getLogger().lifecycle("See the report at: {}", new ConsoleRenderer().asClickableFileUrl(reports.getHtml().getEntryPoint()));
}
Also used : HtmlDependencyReporter(org.gradle.api.reporting.dependencies.internal.HtmlDependencyReporter) ConsoleRenderer(org.gradle.internal.logging.ConsoleRenderer) TaskAction(org.gradle.api.tasks.TaskAction)

Example 4 with ConsoleRenderer

use of org.gradle.internal.logging.ConsoleRenderer in project gradle by gradle.

the class CompareGradleBuilds method communicateResult.

private void communicateResult(BuildComparisonResult result) {
    File reportFile = new File(getReportDir(), GradleBuildComparison.HTML_REPORT_FILE_NAME);
    String reportUrl = new ConsoleRenderer().asClickableFileUrl(reportFile);
    if (result.isBuildsAreIdentical()) {
        getLogger().info("The build outcomes were found to be identical. See the report at: {}", reportUrl);
    } else {
        String message = String.format("The build outcomes were not found to be identical. See the report at: %s", reportUrl);
        if (getIgnoreFailures()) {
            getLogger().warn(message);
        } else {
            throw new GradleException(message);
        }
    }
}
Also used : GradleException(org.gradle.api.GradleException) ConsoleRenderer(org.gradle.internal.logging.ConsoleRenderer) File(java.io.File)

Example 5 with ConsoleRenderer

use of org.gradle.internal.logging.ConsoleRenderer in project gradle by gradle.

the class FindBugs method evaluateResult.

@VisibleForTesting
void evaluateResult(FindBugsResult result) {
    if (result.getException() != null) {
        throw new GradleException("FindBugs encountered an error. Run with --debug to get more information.", result.getException());
    }
    if (result.getErrorCount() > 0) {
        throw new GradleException("FindBugs encountered an error. Run with --debug to get more information.");
    }
    if (result.getBugCount() > 0) {
        String message = "FindBugs rule violations were found.";
        SingleFileReport report = reports.getFirstEnabled();
        if (report != null) {
            String reportUrl = new ConsoleRenderer().asClickableFileUrl(report.getDestination());
            message += " See the report at: " + reportUrl;
        }
        if (getIgnoreFailures()) {
            getLogger().warn(message);
        } else {
            throw new GradleException(message);
        }
    }
}
Also used : GradleException(org.gradle.api.GradleException) ConsoleRenderer(org.gradle.internal.logging.ConsoleRenderer) SingleFileReport(org.gradle.api.reporting.SingleFileReport) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Aggregations

ConsoleRenderer (org.gradle.internal.logging.ConsoleRenderer)7 GradleException (org.gradle.api.GradleException)4 TaskAction (org.gradle.api.tasks.TaskAction)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 File (java.io.File)1 Project (org.gradle.api.Project)1 DirectoryReport (org.gradle.api.reporting.DirectoryReport)1 SingleFileReport (org.gradle.api.reporting.SingleFileReport)1 HtmlDependencyReporter (org.gradle.api.reporting.dependencies.internal.HtmlDependencyReporter)1 ProjectReportGenerator (org.gradle.api.tasks.diagnostics.internal.ProjectReportGenerator)1 ReportGenerator (org.gradle.api.tasks.diagnostics.internal.ReportGenerator)1 StyledTextOutput (org.gradle.internal.logging.text.StyledTextOutput)1