I have multi-module gradle build. I want to generate aggregated view of Code Coverage
across modules.
subprojects {
apply plugin: 'java'
dependencies { compile 'org.jacoco:org.jacoco.ant:0.7.5.201505241946' }
jacocoTestReport {
additionalSourceDirs = files(sourceSets.main.allSource.srcDirs)
sourceDirectories = files(sourceSets.main.allSource.srcDirs)
//classDirectories = files(sourceSets.main.output)
afterEvaluate {
classDirectories = files(classDirectories.files.collect {
fileTree(dir: it, exclude: 'net/xxxxx/test/core')
}) //this task is excluding the core package classes
}
reports {
html.enabled = true
xml.enabled = false
csv.enabled = false
html.destination "${buildDir}/jacocoHtml"
}
}
}
task jacocoRootReport(type: org.gradle.testing.jacoco.tasks.JacocoReport) {
dependsOn = subprojects.test
additionalSourceDirs = files(subprojects.sourceSets.main.allSource.srcDirs)
sourceDirectories = files(subprojects.sourceSets.main.allSource.srcDirs)
classDirectories = files(subprojects.sourceSets.main.output)
executionData = files(subprojects.jacocoTestReport.executionData)
reports {
html.enabled = true
xml.enabled = false
csv.enabled = false
html.destination "${buildDir}/jacocoHtml"
}
} //however Root Report is not excluding the same.
Please let me know how do I exclude classes from Root/Aggregated report.