GITHUB#12655: upgrade jacoco aggregation plugin (failed with gradle 8.x), change html output property.

This commit is contained in:
Dawid Weiss 2023-10-12 20:42:17 +02:00
parent 4ac2f435aa
commit 4533dcea4e
2 changed files with 17 additions and 2 deletions

View File

@ -26,7 +26,7 @@ plugins {
id "de.undercouch.download" version "5.2.0" apply false id "de.undercouch.download" version "5.2.0" apply false
id "net.ltgt.errorprone" version "3.1.0" apply false id "net.ltgt.errorprone" version "3.1.0" apply false
id 'com.diffplug.spotless' version "6.5.2" apply false id 'com.diffplug.spotless' version "6.5.2" apply false
id 'org.barfuin.gradle.jacocolog' version "2.0.0" apply false id 'org.barfuin.gradle.jacocolog' version "3.1.0" apply false
} }
apply from: file('gradle/globals.gradle') apply from: file('gradle/globals.gradle')

View File

@ -23,6 +23,21 @@ def withCoverage = gradle.startParameter.taskNames.contains("coverage") ||
Boolean.parseBoolean(propertyOrDefault("tests.coverage", "false")) Boolean.parseBoolean(propertyOrDefault("tests.coverage", "false"))
if (withCoverage) { if (withCoverage) {
configure(rootProject) {
plugins.apply("org.barfuin.gradle.jacocolog")
// Synthetic task to enable test coverage (and aggregated reports).
task coverage() {
dependsOn jacocoAggregatedReport
}
configure(jacocoAggregatedReport) {
doLast {
logger.lifecycle("Code coverage report at: ${reports.html.entryPoint}\n")
}
}
}
allprojects { allprojects {
plugins.withType(JavaPlugin) { plugins.withType(JavaPlugin) {
// Apply jacoco once we know the project has a Java plugin too. // Apply jacoco once we know the project has a Java plugin too.
@ -47,7 +62,7 @@ if (withCoverage) {
configure(jacocoTestReport) { configure(jacocoTestReport) {
doLast { doLast {
logger.lifecycle("Code coverage report at: ${reports.html.destination}.\n") logger.lifecycle("Code coverage report at: ${reports.html.entryPoint}.\n")
} }
} }
} }