private void configureExtensionRule() { final ConventionMapping extensionMapping = conventionMappingOf(extension); extensionMapping.map("sourceSets", Callables.returning(new ArrayList())); extensionMapping.map("reportsDir", new Callable<File>() { @Override public File call() { return project.getExtensions().getByType(ReportingExtension.class).file(getReportName()); } }); withBasePlugin(new Action<Plugin>() { @Override public void execute(Plugin plugin) { extensionMapping.map("sourceSets", new Callable<SourceSetContainer>() { @Override public SourceSetContainer call() { return getJavaPluginConvention().getSourceSets(); } }); } }); }
private static void configureScaladoc(final Project project, final ScalaRuntime scalaRuntime) { project.getTasks().withType(ScalaDoc.class, new Action<ScalaDoc>() { @Override public void execute(final ScalaDoc scalaDoc) { scalaDoc.getConventionMapping().map("destinationDir", new Callable<File>() { @Override public File call() throws Exception { File docsDir = project.getConvention().getPlugin(JavaPluginConvention.class).getDocsDir(); return project.file(docsDir.getPath() + "/scaladoc"); } }); scalaDoc.getConventionMapping().map("title", new Callable<String>() { @Override public String call() throws Exception { return project.getExtensions().getByType(ReportingExtension.class).getApiDocTitle(); } }); scalaDoc.getConventionMapping().map("scalaClasspath", new Callable<FileCollection>() { @Override public FileCollection call() throws Exception { return scalaRuntime.inferScalaClasspath(scalaDoc.getClasspath()); } }); } }); }
public void apply(Project project) { project.getPluginManager().apply(ReportingBasePlugin.class); final ReportingExtension reportingExtension = project.getExtensions().findByType(ReportingExtension.class); project.getTasks().withType(CompareGradleBuilds.class, new Action<CompareGradleBuilds>() { @Override public void execute(final CompareGradleBuilds task) { ((IConventionAware) task).getConventionMapping().map("reportDir", new Callable<File>() { @Override public File call() throws Exception { return reportingExtension.file(task.getName()); } }); } }); project.getTasks().create("compareGradleBuilds", CompareGradleBuilds.class); }
public void apply(ProjectInternal project) { project.getPluginManager().apply(ReportingBasePlugin.class); this.project = project; addJacocoConfigurations(); JacocoAgentJar agent = instantiator.newInstance(JacocoAgentJar.class, project); JacocoPluginExtension extension = project.getExtensions().create(PLUGIN_EXTENSION_NAME, JacocoPluginExtension.class, project, agent); final ReportingExtension reportingExtension = (ReportingExtension) project.getExtensions().getByName(ReportingExtension.NAME); ((IConventionAware) extension).getConventionMapping().map("reportsDir", new Callable<File>() { @Override public File call() { return reportingExtension.file("jacoco"); } }); configureAgentDependencies(agent, extension); configureTaskClasspathDefaults(extension); applyToDefaultTasks(extension); configureDefaultOutputPathForJacocoMerge(); configureJacocoReportsDefaults(extension); addDefaultReportTasks(extension); }
private void configureJavaDoc(final Project project, final JavaPluginConvention convention) { project.getTasks().withType(Javadoc.class, new Action<Javadoc>() { public void execute(Javadoc javadoc) { javadoc.getConventionMapping().map("destinationDir", new Callable<Object>() { public Object call() throws Exception { return new File(convention.getDocsDir(), "javadoc"); } }); javadoc.getConventionMapping().map("title", new Callable<Object>() { public Object call() throws Exception { return project.getExtensions().getByType(ReportingExtension.class).getApiDocTitle(); } }); } }); }
private void configureGroovydoc() { project.getTasks().withType(Groovydoc.class, new Action<Groovydoc>() { public void execute(final Groovydoc groovydoc) { groovydoc.getConventionMapping().map("groovyClasspath", new Callable<Object>() { public Object call() throws Exception { return groovyRuntime.inferGroovyClasspath(groovydoc.getClasspath()); } }); groovydoc.getConventionMapping().map("destinationDir", new Callable<Object>() { public Object call() throws Exception { return new File(java(project.getConvention()).getDocsDir(), "groovydoc"); } }); groovydoc.getConventionMapping().map("docTitle", new Callable<Object>() { public Object call() throws Exception { return project.getExtensions().getByType(ReportingExtension.class).getApiDocTitle(); } }); groovydoc.getConventionMapping().map("windowTitle", new Callable<Object>() { public Object call() throws Exception { return project.getExtensions().getByType(ReportingExtension.class).getApiDocTitle(); } }); } }); }
private void configureDefaultReportTask( final Test test, JGivenReportTask reportTask, final ReportingExtension reportingExtension ) { ConventionMapping mapping = ( (IConventionAware) reportTask ).getConventionMapping(); mapping.map( "results", new Callable<File>() { @Override public File call() { return test.getExtensions().getByType( JGivenTaskExtension.class ).getResultsDir(); } } ); mapping.getConventionValue( reportTask.getReports(), "reports", false ).all( new Action<Report>() { @Override public void execute( final Report report ) { ConventionMapping reportMapping = ( (IConventionAware) report ).getConventionMapping(); reportMapping.map( "destination", new Callable<File>() { @Override public File call() { return reportingExtension.file( "jgiven" + "/" + test.getName() + "/" + report.getName() ); } } ); } } ); }
public void apply(final Project project) { project.getPluginManager().apply(ReportingBasePlugin.class); final GenerateBuildDashboard buildDashboardTask = project.getTasks().create(BUILD_DASHBOARD_TASK_NAME, GenerateBuildDashboard.class); buildDashboardTask.setDescription("Generates a dashboard of all the reports produced by this build."); buildDashboardTask.setGroup("reporting"); DirectoryReport htmlReport = buildDashboardTask.getReports().getHtml(); ConventionMapping htmlReportConventionMapping = new DslObject(htmlReport).getConventionMapping(); htmlReportConventionMapping.map("destination", new Callable<Object>() { public Object call() throws Exception { return project.getExtensions().getByType(ReportingExtension.class).file("buildDashboard"); } }); Action<Task> captureReportingTasks = new Action<Task>() { public void execute(Task task) { if (!(task instanceof Reporting)) { return; } Reporting reporting = (Reporting) task; buildDashboardTask.aggregate(reporting); if (!task.equals(buildDashboardTask)) { task.finalizedBy(buildDashboardTask); } } }; for (Project aProject : project.getAllprojects()) { aProject.getTasks().all(captureReportingTasks); } }
private void configureGroovydoc() { project.getTasks().withType(Groovydoc.class, new Action<Groovydoc>() { public void execute(final Groovydoc groovydoc) { groovydoc.getConventionMapping().map("groovyClasspath", new Callable<Object>() { public Object call() throws Exception { FileCollection groovyClasspath = groovyRuntime.inferGroovyClasspath(groovydoc.getClasspath()); // Jansi is required to log errors when generating Groovydoc ConfigurableFileCollection jansi = project.files(moduleRegistry.getExternalModule("jansi").getImplementationClasspath().getAsFiles()); return groovyClasspath.plus(jansi); } }); groovydoc.getConventionMapping().map("destinationDir", new Callable<Object>() { public Object call() throws Exception { return new File(java(project.getConvention()).getDocsDir(), "groovydoc"); } }); groovydoc.getConventionMapping().map("docTitle", new Callable<Object>() { public Object call() throws Exception { return project.getExtensions().getByType(ReportingExtension.class).getApiDocTitle(); } }); groovydoc.getConventionMapping().map("windowTitle", new Callable<Object>() { public Object call() throws Exception { return project.getExtensions().getByType(ReportingExtension.class).getApiDocTitle(); } }); } }); }
private void configureExtensionRule() { final ConventionMapping extensionMapping = conventionMappingOf(extension); String sourceSets = getExtensionElementsName(); Callable<Collection<?>> ssCallable = getExtensionElementsCallable(); extensionMapping.map(sourceSets, Callables.returning(new ArrayList())); extensionMapping.map("reportsDir", () -> project.getExtensions().getByType(ReportingExtension.class).file(getReportName())); withBasePlugin(plugin -> extensionMapping.map(sourceSets, ssCallable)); }
public void apply(final ProjectInternal project) { project.getPlugins().apply(ReportingBasePlugin.class); final GenerateBuildDashboard buildDashboardTask = project.getTasks().create(BUILD_DASHBOARD_TASK_NAME, GenerateBuildDashboard.class); buildDashboardTask.setDescription("Generates a dashboard of all the reports produced by this build."); buildDashboardTask.setGroup("reporting"); DirectoryReport htmlReport = buildDashboardTask.getReports().getHtml(); ConventionMapping htmlReportConventionMapping = new DslObject(htmlReport).getConventionMapping(); htmlReportConventionMapping.map("destination", new Callable<Object>() { public Object call() throws Exception { return project.getExtensions().getByType(ReportingExtension.class).file("buildDashboard"); } }); Action<Task> captureReportingTasks = new Action<Task>() { public void execute(Task task) { if (!(task instanceof Reporting)) { return; } Reporting reporting = (Reporting) task; buildDashboardTask.aggregate(reporting); if (!task.equals(buildDashboardTask)) { task.finalizedBy(buildDashboardTask); } } }; for (Project aProject : project.getAllprojects()) { aProject.getTasks().all(captureReportingTasks); } }
public void apply(final ProjectInternal project) { project.getPlugins().apply(ReportingBasePlugin.class); final GenerateBuildDashboard buildDashboardTask = project.getTasks().create(BUILD_DASHBOARD_TASK_NAME, GenerateBuildDashboard.class); DirectoryReport htmlReport = buildDashboardTask.getReports().getHtml(); ConventionMapping htmlReportConventionMapping = new DslObject(htmlReport).getConventionMapping(); htmlReportConventionMapping.map("destination", new Callable<Object>() { public Object call() throws Exception { return project.getExtensions().getByType(ReportingExtension.class).file("buildDashboard"); } }); Action<Task> captureReportingTasks = new Action<Task>() { public void execute(Task task) { if (!(task instanceof Reporting)) { return; } Reporting reporting = (Reporting) task; buildDashboardTask.aggregate(reporting); if (!task.equals(buildDashboardTask)) { task.finalizedBy(buildDashboardTask); } } }; for (Project aProject : project.getAllprojects()) { aProject.getTasks().all(captureReportingTasks); } }
public void apply(ProjectInternal project) { Convention convention = project.getConvention(); ReportingExtension extension = project.getExtensions().create(ReportingExtension.NAME, ReportingExtension.class, project); // This convention is deprecated convention.getPlugins().put("reportingBase", new ReportingBasePluginConvention(project, extension)); }
private void addDefaultReports( final Project project ) { final ReportingExtension reportingExtension = project.getExtensions().findByType( ReportingExtension.class ); project.getTasks().withType( Test.class, new Action<Test>() { @Override public void execute( final Test test ) { final JGivenReportTask reportTask = project.getTasks() .create( "jgiven" + WordUtil.capitalize( test.getName() ) + "Report", JGivenReportTask.class ); configureDefaultReportTask( test, reportTask, reportingExtension ); } } ); }
public void apply(ProjectInternal project) { project.getExtensions().create(ReportingExtension.NAME, ReportingExtension.class, project); }
public void apply(Project project) { project.getPluginManager().apply(RhinoPlugin.class); project.getPluginManager().apply(ReportingBasePlugin.class); JavaScriptExtension jsExtension = project.getExtensions().getByType(JavaScriptExtension.class); final JsHintExtension jsHintExtension = ((ExtensionAware) jsExtension).getExtensions().create(JsHintExtension.NAME, JsHintExtension.class); final Configuration configuration = addConfiguration(project.getConfigurations(), project.getDependencies(), jsHintExtension); ConventionMapping conventionMapping = ((IConventionAware) jsHintExtension).getConventionMapping(); conventionMapping.map("js", new Callable<Configuration>() { public Configuration call() { return configuration; } }); conventionMapping.map("version", new Callable<String>() { public String call() { return JsHintExtension.DEFAULT_DEPENDENCY_VERSION; } }); final RhinoExtension rhinoExtension = ((ExtensionAware) jsExtension).getExtensions().getByType(RhinoExtension.class); final ReportingExtension reportingExtension = project.getExtensions().getByType(ReportingExtension.class); project.getTasks().withType(JsHint.class, new Action<JsHint>() { public void execute(final JsHint task) { task.getConventionMapping().map("rhinoClasspath", new Callable<FileCollection>() { public FileCollection call() { return rhinoExtension.getClasspath(); } }); task.getConventionMapping().map("jsHint", new Callable<FileCollection>() { public FileCollection call() { return jsHintExtension.getJs(); } }); task.getConventionMapping().map("jsonReport", new Callable<File>() { public File call() { return reportingExtension.file(task.getName() + "/report.json"); } }); } }); }
/** * Returns the directory to generate the project reports into. */ public File getProjectReportDir() { return project.getExtensions().getByType(ReportingExtension.class).file(projectReportDirName); }
private File getReportsDir() { return project.getExtensions().getByType(ReportingExtension.class).getBaseDir(); }
public ReportingBasePluginConvention(ProjectInternal project, ReportingExtension extension) { this.project = project; this.extension = extension; }