Search in sources :

Example 1 with HtmlReportBuilder

use of org.gradle.reporting.HtmlReportBuilder in project gradle by gradle.

the class DefaultTestReport method generateFiles.

private void generateFiles(AllTestResults model, final TestResultsProvider resultsProvider, File reportDir) {
    try {
        HtmlReportRenderer htmlRenderer = new HtmlReportRenderer();
        htmlRenderer.render(model, new ReportRenderer<AllTestResults, HtmlReportBuilder>() {

            @Override
            public void render(final AllTestResults model, final HtmlReportBuilder output) throws IOException {
                buildOperationProcessor.run(new Action<BuildOperationQueue<HtmlReportFileGenerator<? extends CompositeTestResults>>>() {

                    @Override
                    public void execute(BuildOperationQueue<HtmlReportFileGenerator<? extends CompositeTestResults>> queue) {
                        queue.add(generator("index.html", model, new OverviewPageRenderer(), output));
                        for (PackageTestResults packageResults : model.getPackages()) {
                            queue.add(generator(packageResults.getBaseUrl(), packageResults, new PackagePageRenderer(), output));
                            for (ClassTestResults classResults : packageResults.getClasses()) {
                                queue.add(generator(classResults.getBaseUrl(), classResults, new ClassPageRenderer(resultsProvider), output));
                            }
                        }
                    }
                });
            }
        }, reportDir);
    } catch (Exception e) {
        throw new GradleException(String.format("Could not generate test report to '%s'.", reportDir), e);
    }
}
Also used : Action(org.gradle.api.Action) BuildOperationQueue(org.gradle.internal.operations.BuildOperationQueue) IOException(java.io.IOException) IOException(java.io.IOException) GradleException(org.gradle.api.GradleException) HtmlReportBuilder(org.gradle.reporting.HtmlReportBuilder) GradleException(org.gradle.api.GradleException) HtmlReportRenderer(org.gradle.reporting.HtmlReportRenderer)

Example 2 with HtmlReportBuilder

use of org.gradle.reporting.HtmlReportBuilder in project gradle by gradle.

the class HtmlDependencyReporter method render.

@Override
public void render(final Set<Project> projects, File outputDirectory) {
    this.outputDirectory = outputDirectory;
    HtmlReportRenderer renderer = new HtmlReportRenderer();
    renderer.render(projects, new ReportRenderer<Set<Project>, HtmlReportBuilder>() {

        @Override
        public void render(Set<Project> model, HtmlReportBuilder builder) {
            Transformer<String, Project> htmlPageScheme = projectNamingScheme("html");
            Transformer<String, Project> jsScheme = projectNamingScheme("js");
            ProjectPageRenderer projectPageRenderer = new ProjectPageRenderer(jsScheme);
            builder.renderRawHtmlPage("index.html", projects, new ProjectsPageRenderer(htmlPageScheme));
            for (Project project : projects) {
                String jsFileName = jsScheme.transform(project);
                generateJsFile(project, jsFileName);
                String htmlFileName = htmlPageScheme.transform(project);
                builder.renderRawHtmlPage(htmlFileName, project, projectPageRenderer);
            }
        }
    }, outputDirectory);
}
Also used : Project(org.gradle.api.Project) Set(java.util.Set) HtmlReportBuilder(org.gradle.reporting.HtmlReportBuilder) Transformer(org.gradle.api.Transformer) HtmlReportRenderer(org.gradle.reporting.HtmlReportRenderer)

Aggregations

HtmlReportBuilder (org.gradle.reporting.HtmlReportBuilder)2 HtmlReportRenderer (org.gradle.reporting.HtmlReportRenderer)2 IOException (java.io.IOException)1 Set (java.util.Set)1 Action (org.gradle.api.Action)1 GradleException (org.gradle.api.GradleException)1 Project (org.gradle.api.Project)1 Transformer (org.gradle.api.Transformer)1 BuildOperationQueue (org.gradle.internal.operations.BuildOperationQueue)1