We had a JacocoReport task which is gathering coverage reports from multiple subprojects into one place. Its configuration looks like this:
def codeCoverageReport = tasks.register('codeCoverageReport', JacocoReport) {
subprojects.each {
sourceSets it.sourceSets.main
}
reports {
xml.enabled true
html.enabled true
}
// Gather execution data from all subprojects (no need to call jacocoMerge)
getExecutionData().setFrom(fileTree(project.rootDir.absolutePath).include("/**/build/jacoco/*.exec"))
}
If we do this:
- Run
./gradlew codeCoverageReport - Delete the report
- Run
./gradlew codeCoverageReportagain
We find that the task doesn’t notice that it’s out of date.
Investigating the task classes:
- On
JacocoReport,getReports()is annotated@Nested, returningJacocoReportsContainer - On
JacocoReportsContainer,getHtml()is annotated@Internal, returningDirectoryReport - On
DirectoryReport,getOutputLocation()is annotated@OutputDirectory
So it seems that getHtml() was mis-annotated as @Internal when it should have been @Nested - a straight-forward bug?