diff --git a/build.gradle b/build.gradle index dc82168e6e..4586e6b0fd 100644 --- a/build.gradle +++ b/build.gradle @@ -72,7 +72,12 @@ allprojects { version = rootProject.version - jacoco { toolVersion = '0.8.2' } + jacoco { + toolVersion = '0.8.2' + if (project.tasks.findByName('referenceTests')) { + applyTo referenceTests + } + } sourceCompatibility = '1.8' targetCompatibility = '1.8' @@ -389,16 +394,13 @@ task jacocoRootReport(type: org.gradle.testing.jacoco.tasks.JacocoReport) { additionalSourceDirs.from files(subprojects.sourceSets.main.allSource.srcDirs) sourceDirectories.from files(subprojects.sourceSets.main.allSource.srcDirs) classDirectories.from files(subprojects.sourceSets.main.output) - executionData.from files(subprojects.jacocoTestReport.executionData) //how to exclude some package/classes com.test.** + executionData.from fileTree(dir: '.', includes: ['**/jacoco/*.exec']) reports { xml.enabled true csv.enabled true html.destination file("build/reports/jacocoHtml") } onlyIf = { true } - doFirst { - executionData = files(executionData.findAll { it.exists() }) - } } configurations { annotationProcessor } diff --git a/docs/development/code-coverage.md b/docs/development/code-coverage.md index b94dab1652..2f29b496df 100644 --- a/docs/development/code-coverage.md +++ b/docs/development/code-coverage.md @@ -4,7 +4,7 @@ We use the jacoco test coverage plugin, which will generate coverage data whenev To run the report: ``` -./gradlew test jacocoTestReport +./gradlew test jacocoTestReport jacocoRootReport ``` The report will be available at `build/reports/jacoco/test/html/index.html` \ No newline at end of file