diff --git a/build.gradle b/build.gradle index af02111a950ad..bff3248c16c17 100644 --- a/build.gradle +++ b/build.gradle @@ -97,10 +97,6 @@ subprojects { } } - jacoco { - toolVersion = '0.8.0' - } - test { testLogging { events 'started', 'passed', 'skipped', 'failed' @@ -130,6 +126,17 @@ subprojects { } } + jacoco { + toolVersion = '0.8.0' + } + + gradle.taskGraph.whenReady { graph -> + def enabled = graph.allTasks.any { it instanceof JacocoReport } + tasks.withType(Test) { + jacoco.enabled = enabled + } + } + task funTestCoverage(type: JacocoReport, dependsOn: funTest) { description = 'Generates the code coverage report for the functional tests.' group = 'Reporting'