andrewinci/Insulator

View on GitHub
buildSrc/src/main/groovy/insulator.coverage.gradle

Summary

Maintainability
Test Coverage
plugins {
    id 'jacoco'
    id 'insulator.common'
}

task codeCoverageReport(type: JacocoReport) {
    group = "verification"
    subprojects { subproject ->
        subproject.plugins.withType(JacocoPlugin).configureEach {
            subproject.tasks.matching({ t -> t.extensions.findByType(JacocoTaskExtension) }).configureEach { Task testTask ->
                    sourceSets subproject.sourceSets.main
                    executionData(testTask)
            }
            subproject.tasks.matching({ t -> t.extensions.findByType(JacocoTaskExtension) }).forEach {
                    rootProject.tasks.codeCoverageReport.dependsOn(it)
            }
        }
    }
    reports {
        xml.enabled true
        html.enabled true
    }
}