Search in sources :

Example 1 with JacocoTaskExtension

use of org.gradle.testing.jacoco.plugins.JacocoTaskExtension in project gradle by gradle.

the class JacocoReportBase method executionData.

/**
     * Adds execution data generated by a task to the list of those used during coverage analysis. Only tasks with a {@link JacocoTaskExtension} will be included; all others will be ignored.
     *
     * @param tasks one or more tasks to add
     */
public void executionData(Task... tasks) {
    for (Task task : tasks) {
        final JacocoTaskExtension extension = task.getExtensions().findByType(JacocoTaskExtension.class);
        if (extension != null) {
            executionData(new Callable<File>() {

                @Override
                public File call() {
                    return extension.getDestinationFile();
                }
            });
            mustRunAfter(task);
        }
    }
}
Also used : Task(org.gradle.api.Task) JacocoTaskExtension(org.gradle.testing.jacoco.plugins.JacocoTaskExtension) File(java.io.File)

Example 2 with JacocoTaskExtension

use of org.gradle.testing.jacoco.plugins.JacocoTaskExtension in project gradle by gradle.

the class JacocoMerge method executionData.

/**
     * Adds execution data generated by a task to the list of those to merge. Only tasks with a {@link JacocoTaskExtension} will be included; all others will be ignored.
     *
     * @param tasks one or more tasks to merge
     */
public void executionData(Task... tasks) {
    for (Task task : tasks) {
        JacocoTaskExtension extension = task.getExtensions().findByType(JacocoTaskExtension.class);
        if (extension != null) {
            ConfigurableFileCollection files = getProject().files(extension.getDestinationFile());
            files.builtBy(task);
            executionData(files);
        }
    }
}
Also used : Task(org.gradle.api.Task) CacheableTask(org.gradle.api.tasks.CacheableTask) ConfigurableFileCollection(org.gradle.api.file.ConfigurableFileCollection) JacocoTaskExtension(org.gradle.testing.jacoco.plugins.JacocoTaskExtension)

Aggregations

Task (org.gradle.api.Task)2 JacocoTaskExtension (org.gradle.testing.jacoco.plugins.JacocoTaskExtension)2 File (java.io.File)1 ConfigurableFileCollection (org.gradle.api.file.ConfigurableFileCollection)1 CacheableTask (org.gradle.api.tasks.CacheableTask)1