Search in sources :

Example 1 with ReportingExtension

use of org.gradle.api.reporting.ReportingExtension in project gradle by gradle.

the class CompareGradleBuildsPlugin method apply.

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);
}
Also used : ReportingExtension(org.gradle.api.reporting.ReportingExtension) IConventionAware(org.gradle.api.internal.IConventionAware) Callable(java.util.concurrent.Callable)

Example 2 with ReportingExtension

use of org.gradle.api.reporting.ReportingExtension in project gradle by gradle.

the class JacocoPlugin method apply.

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);
    extension.setToolVersion(DEFAULT_JACOCO_VERSION);
    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);
    addDefaultReportAndCoverageVerificationTasks(extension);
}
Also used : ReportingExtension(org.gradle.api.reporting.ReportingExtension) JacocoAgentJar(org.gradle.internal.jacoco.JacocoAgentJar) File(java.io.File)

Example 3 with ReportingExtension

use of org.gradle.api.reporting.ReportingExtension in project gradle by gradle.

the class JsHintPlugin method apply.

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");
                }
            });
        }
    });
}
Also used : ReportingExtension(org.gradle.api.reporting.ReportingExtension) Configuration(org.gradle.api.artifacts.Configuration) RhinoExtension(org.gradle.plugins.javascript.rhino.RhinoExtension) JavaScriptExtension(org.gradle.plugins.javascript.base.JavaScriptExtension) ConventionMapping(org.gradle.api.internal.ConventionMapping) Callable(java.util.concurrent.Callable) IConventionAware(org.gradle.api.internal.IConventionAware)

Aggregations

ReportingExtension (org.gradle.api.reporting.ReportingExtension)3 Callable (java.util.concurrent.Callable)2 IConventionAware (org.gradle.api.internal.IConventionAware)2 File (java.io.File)1 Configuration (org.gradle.api.artifacts.Configuration)1 ConventionMapping (org.gradle.api.internal.ConventionMapping)1 JacocoAgentJar (org.gradle.internal.jacoco.JacocoAgentJar)1 JavaScriptExtension (org.gradle.plugins.javascript.base.JavaScriptExtension)1 RhinoExtension (org.gradle.plugins.javascript.rhino.RhinoExtension)1