org.gradle.api.reporting.Report Java Examples
The following examples show how to use
org.gradle.api.reporting.Report.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BuildDashboardGenerator.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
@Override public void render(Collection<Report> reports, final File outputFile) { this.reports = new TreeSet<Report>(new Comparator<Report>() { public int compare(Report o1, Report o2) { return o1.getDisplayName().compareTo(o2.getDisplayName()); } }); this.reports.addAll(reports); this.outputFile = outputFile; HtmlReportRenderer renderer = new HtmlReportRenderer(); renderer.renderRawSinglePage(reports, new ReportRenderer<Collection<Report>, HtmlPageBuilder<Writer>>() { @Override public void render(Collection<Report> model, HtmlPageBuilder<Writer> builder) throws IOException { generate(builder); } }, outputFile); }
Example #2
Source File: BuildDashboardGenerator.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
@Override public void render(Collection<Report> reports, final File outputFile) { this.reports = new TreeSet<Report>(new Comparator<Report>() { public int compare(Report o1, Report o2) { return o1.getDisplayName().compareTo(o2.getDisplayName()); } }); this.reports.addAll(reports); this.outputFile = outputFile; HtmlReportRenderer renderer = new HtmlReportRenderer(); renderer.renderRawSinglePage(reports, new ReportRenderer<Collection<Report>, HtmlPageBuilder<Writer>>() { @Override public void render(Collection<Report> model, HtmlPageBuilder<Writer> builder) throws IOException { generate(builder); } }, outputFile); }
Example #3
Source File: AggregateJacocoReportPlugin.java From gradle-plugins with MIT License | 5 votes |
@Override public void apply(Project project) { project.getPlugins().apply(JacocoPlugin.class); project.getTasks().register("aggregateJacocoReport", JacocoReport.class, reportTask -> { reportTask.setGroup(LifecycleBasePlugin.VERIFICATION_GROUP); reportTask.setDescription(String.format("Generates aggregated code coverage report for the %s project.", project.getPath())); project.allprojects(subproject -> { subproject.getPlugins().withType(JavaPlugin.class, javaPlugin -> { SourceSetContainer sourceSets = subproject.getConvention().getPlugin(JavaPluginConvention.class).getSourceSets(); SourceSet main = sourceSets.getByName(SourceSet.MAIN_SOURCE_SET_NAME); reportTask.sourceSets(main); }); subproject.getTasks() .withType(Test.class) .forEach(reportTask::executionData); }); JacocoPluginExtension reportingExtension = project.getExtensions().getByType(JacocoPluginExtension.class); reportTask.getReports().getHtml().setEnabled(true); reportTask.getReports().all(report -> { if (report.getOutputType().equals(Report.OutputType.DIRECTORY)) { report.setDestination(project.provider(() -> new File(reportingExtension.getReportsDir(), reportTask.getName() + "/" + report.getName()))); } else { report.setDestination(project.provider(() -> new File(reportingExtension.getReportsDir(), reportTask.getName() + "/" + reportTask.getName() + "." + report.getName()))); } }); }); }
Example #4
Source File: JGivenPlugin.java From JGiven with Apache License 2.0 | 5 votes |
private void configureDefaultReportTask( final Test test, JGivenReportTask reportTask, final ReportingExtension reportingExtension ){ ConventionMapping mapping = ( (IConventionAware) reportTask ).getConventionMapping(); mapping.map( "results", (Callable<File>) () -> test.getExtensions().getByType( JGivenTaskExtension.class ).getResultsDir() ); mapping.getConventionValue( reportTask.getReports(), "reports", false ) .all( (Action<Report>) report -> { ConventionMapping reportMapping = ( (IConventionAware) report ).getConventionMapping(); reportMapping.map( "destination", (Callable<File>) () -> reportingExtension.file( "jgiven" + "/" + test.getName() + "/" + report.getName() ) ); } ); }
Example #5
Source File: BuildDashboardGenerator.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
private File getHtmlLinkedFileFromReport(Report report) { if(report instanceof DirectoryReport){ return ((DirectoryReport) report).getEntryPoint(); } else{ return report.getDestination(); } }
Example #6
Source File: BuildDashboardGenerator.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
private void generate(Writer writer) { new Html(writer) {{ html(); head(); meta().httpEquiv("Content-Type").content("text/html; charset=utf-8"); link().rel("stylesheet").type("text/css").href("base-style.css").end(); link().rel("stylesheet").type("text/css").href("style.css").end(); title().text("Build dashboard").end(); end(); body(); div().id("content"); if (reports.size() > 0) { h1().text("Build reports").end(); ul(); for (Report report : reports) { li(); if (report.getDestination().exists()) { a().href(GFileUtils.relativePath(outputFile.getParentFile(), getHtmlLinkedFileFromReport(report))).text(report.getDisplayName()); } else { span().classAttr("unavailable").text(report.getDisplayName()); } end(2); } end(); } else { h1().text("There are no build reports available.").end(); } end(); div().id("footer").text(String.format("Generated by %s", GradleVersion.current())); endAll(); }}; }
Example #7
Source File: BuildDashboardGenerator.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public BuildDashboardGenerator(Set<Report> reports, File outputFile) { this.reports = new TreeSet<Report>(new Comparator<Report>() { public int compare(Report o1, Report o2) { return o1.getDisplayName().compareTo(o2.getDisplayName()); } }); this.reports.addAll(reports); this.outputFile = outputFile; }
Example #8
Source File: DefaultReportContainer.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public DefaultReportContainer(Class<? extends T> type, Instantiator instantiator) { super(type, instantiator, Report.NAMER); enabled = matching(new Spec<T>() { public boolean isSatisfiedBy(T element) { return element.isEnabled(); } }); beforeChange(new Runnable() { public void run() { throw new ImmutableViolationException(); } }); }
Example #9
Source File: TaskReportContainer.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
@Input public SortedSet<String> getEnabledReportNames() { return CollectionUtils.collect(getEnabled(), new TreeSet<String>(), new Transformer<String, Report>() { public String transform(Report report) { return report.getName(); } }); }
Example #10
Source File: BuildDashboardGenerator.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
private File getHtmlLinkedFileFromReport(Report report) { if (report instanceof DirectoryReport) { return ((DirectoryReport) report).getEntryPoint(); } else { return report.getDestination(); } }
Example #11
Source File: DefaultReportContainer.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public DefaultReportContainer(Class<? extends T> type, Instantiator instantiator) { super(type, instantiator, Report.NAMER); enabled = matching(new Spec<T>() { public boolean isSatisfiedBy(T element) { return element.isEnabled(); } }); beforeChange(new Runnable() { public void run() { throw new ImmutableViolationException(); } }); }
Example #12
Source File: TaskReportContainer.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
@Input public SortedSet<String> getEnabledReportNames() { return CollectionUtils.collect(getEnabled(), new TreeSet<String>(), new Transformer<String, Report>() { public String transform(Report report) { return report.getName(); } }); }
Example #13
Source File: ReportUploader.java From nomulus with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") private static Reporting<? extends ReportContainer<? extends Report>> asReporting(Task task) { if (task instanceof Reporting) { return (Reporting<? extends ReportContainer<? extends Report>>) task; } return null; }
Example #14
Source File: AggregateJacocoReportPlugin.java From gradle-plugins with MIT License | 5 votes |
@Override public void apply(Project project) { project.getPlugins().apply(JacocoPlugin.class); project.getTasks().register("aggregateJacocoReport", JacocoReport.class, reportTask -> { reportTask.setGroup(LifecycleBasePlugin.VERIFICATION_GROUP); reportTask.setDescription(String.format("Generates aggregated code coverage report for the %s project.", project.getPath())); project.allprojects(subproject -> { subproject.getPlugins().withType(JavaPlugin.class, javaPlugin -> { SourceSetContainer sourceSets = subproject.getConvention().getPlugin(JavaPluginConvention.class).getSourceSets(); SourceSet main = sourceSets.getByName(SourceSet.MAIN_SOURCE_SET_NAME); reportTask.sourceSets(main); }); subproject.getTasks() .withType(Test.class) .forEach(reportTask::executionData); }); JacocoPluginExtension reportingExtension = project.getExtensions().getByType(JacocoPluginExtension.class); reportTask.getReports().getHtml().setEnabled(true); reportTask.getReports().all(report -> { if (report.getOutputType().equals(Report.OutputType.DIRECTORY)) { report.setDestination(project.provider(() -> new File(reportingExtension.getReportsDir(), reportTask.getName() + "/" + report.getName()))); } else { report.setDestination(project.provider(() -> new File(reportingExtension.getReportsDir(), reportTask.getName() + "/" + reportTask.getName() + "." + report.getName()))); } }); }); }
Example #15
Source File: BuildDashboardGenerator.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
private void generate(Writer writer) { new Html(writer) {{ html(); head(); meta().httpEquiv("Content-Type").content("text/html; charset=utf-8"); link().rel("stylesheet").type("text/css").href("base-style.css").end(); link().rel("stylesheet").type("text/css").href("style.css").end(); title().text("Build dashboard").end(); end(); body(); div().id("content"); if (reports.size() > 0) { h1().text("Build reports").end(); ul(); for (Report report : reports) { li(); if (report.getDestination().exists()) { a().href(GFileUtils.relativePath(outputFile.getParentFile(), getHtmlLinkedFileFromReport(report))).text(report.getDisplayName()); } else { span().classAttr("unavailable").text(report.getDisplayName()); } end(2); } end(); } else { h1().text("There are no build reports available.").end(); } end(); div().id("footer").text(String.format("Generated by %s", GradleVersion.current())); endAll(); }}; }
Example #16
Source File: BuildDashboardGenerator.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public BuildDashboardGenerator(Set<Report> reports, File outputFile) { this.reports = new TreeSet<Report>(new Comparator<Report>() { public int compare(Report o1, Report o2) { return o1.getDisplayName().compareTo(o2.getDisplayName()); } }); this.reports.addAll(reports); this.outputFile = outputFile; }
Example #17
Source File: TaskReportContainer.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
@Input public SortedSet<String> getEnabledReportNames() { return CollectionUtils.collect(getEnabled(), new TreeSet<String>(), new Transformer<String, Report>() { public String transform(Report report) { return report.getName(); } }); }
Example #18
Source File: DefaultReportContainer.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public DefaultReportContainer(Class<? extends T> type, Instantiator instantiator) { super(type, instantiator, Report.NAMER); enabled = matching(new Spec<T>() { public boolean isSatisfiedBy(T element) { return element.isEnabled(); } }); beforeChange(new Runnable() { public void run() { throw new ImmutableViolationException(); } }); }
Example #19
Source File: DefaultReportContainer.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public DefaultReportContainer(Class<? extends T> type, Instantiator instantiator) { super(type, instantiator, Report.NAMER); enabled = matching(new Spec<T>() { public boolean isSatisfiedBy(T element) { return element.isEnabled(); } }); beforeChange(new Runnable() { public void run() { throw new ImmutableViolationException(); } }); }
Example #20
Source File: TaskReportContainer.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
@Input public SortedSet<String> getEnabledReportNames() { return CollectionUtils.collect(getEnabled(), new TreeSet<String>(), new Transformer<String, Report>() { public String transform(Report report) { return report.getName(); } }); }
Example #21
Source File: BuildDashboardGenerator.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
private File getHtmlLinkedFileFromReport(Report report) { if (report instanceof DirectoryReport) { return ((DirectoryReport) report).getEntryPoint(); } else { return report.getDestination(); } }
Example #22
Source File: BuildDashboardGenerator.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
private File getHtmlLinkedFileFromReport(Report report) { if(report instanceof DirectoryReport){ return ((DirectoryReport) report).getEntryPoint(); } else{ return report.getDestination(); } }
Example #23
Source File: TaskReportContainer.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public File transform(Report original) { return original.getDestination(); }
Example #24
Source File: TaskReportContainer.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public boolean isSatisfiedBy(Report report) { return report.getOutputType() == Report.OutputType.DIRECTORY; }
Example #25
Source File: JGivenPlugin.java From JGiven with Apache License 2.0 | 4 votes |
private void configureJGivenReportDefaults( Project project ){ project.getTasks().withType( JGivenReportTask.class, reportTask -> reportTask.getReports().all( (Action<Report>) report -> { ConventionMapping mapping = ( (IConventionAware) report ).getConventionMapping(); mapping.map( "enabled", (Callable<Boolean>) () -> report.getName().equals( JGivenHtmlReportImpl.NAME ) ); } ) ); }
Example #26
Source File: DefaultDependencyReportContainer.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public DefaultDependencyReportContainer(Task task) { super(Report.class, task); add(TaskGeneratedSingleDirectoryReport.class, "html", task, "index.html"); }
Example #27
Source File: BuildDashboardGenerator.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
private void generate(final HtmlPageBuilder<Writer> builder) { final String baseCssLink = builder.requireResource(getClass().getResource("/org/gradle/reporting/base-style.css")); final String cssLink = builder.requireResource(getClass().getResource("style.css")); new Html(builder.getOutput()) {{ html(); head(); meta().httpEquiv("Content-Type").content("text/html; charset=utf-8"); meta().httpEquiv("x-ua-compatible").content("IE=edge"); link().rel("stylesheet").type("text/css").href(baseCssLink).end(); link().rel("stylesheet").type("text/css").href(cssLink).end(); title().text("Build dashboard").end(); end(); body(); div().id("content"); if (reports.size() > 0) { h1().text("Build reports").end(); ul(); for (Report report : reports) { li(); if (report.getDestination().exists()) { a().href(GFileUtils.relativePath(outputFile.getParentFile(), getHtmlLinkedFileFromReport(report))).text(report.getDisplayName()); } else { span().classAttr("unavailable").text(report.getDisplayName()); } end(2); } end(); } else { h1().text("There are no build reports available.").end(); } div().id("footer"); p(); text("Generated by "); a().href("http://www.gradle.org").text(GradleVersion.current().toString()).end(); text(String.format(" at %s", builder.formatDate(new Date()))); end(); end(); end(); endAll(); }}; }
Example #28
Source File: DefaultDependencyReportContainer.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public DefaultDependencyReportContainer(Task task) { super(Report.class, task); add(TaskGeneratedSingleDirectoryReport.class, "html", task, "index.html"); }
Example #29
Source File: TaskReportContainer.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public boolean isSatisfiedBy(Report report) { return report.getOutputType() == Report.OutputType.DIRECTORY; }
Example #30
Source File: TaskReportContainer.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public File transform(Report original) { return original.getDestination(); }