From 4c434b70892c1a66634841f7d5800ec99d6ba54f Mon Sep 17 00:00:00 2001 From: Robert Muir Date: Wed, 5 Oct 2022 21:46:20 -0400 Subject: [PATCH] make 'gradle coverage' print test coverage summaries. (#11837) Currently, this task is too silent and just writes HTML reports. It is a nice improvement to print the summary to the console. Before: ``` > Task :lucene:analysis:icu:jacocoTestReport Code coverage report at: /home/rmuir/workspace/lucene/lucene/analysis/icu/build/reports/jacoco/test/html. ``` After: ``` > Task :lucene:analysis:icu:jacocoTestReport Code coverage report at: /home/rmuir/workspace/lucene/lucene/analysis/icu/build/reports/jacoco/test/html. > Task :lucene:analysis:icu:jacocoLogTestCoverage Test Coverage: - Class Coverage: 100% - Method Coverage: 87.9% - Branch Coverage: 82.7% - Line Coverage: 92.8% - Instruction Coverage: 92.7% - Complexity Coverage: 78.8% ``` --- build.gradle | 3 ++- gradle/testing/coverage.gradle | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 59027748a97..3d8636cea9d 100644 --- a/build.gradle +++ b/build.gradle @@ -26,6 +26,7 @@ plugins { id "de.undercouch.download" version "5.2.0" apply false id "net.ltgt.errorprone" version "2.0.2" apply false id 'com.diffplug.spotless' version "6.5.2" apply false + id 'org.barfuin.gradle.jacocolog' version "2.0.0" apply false } apply from: file('gradle/globals.gradle') @@ -179,4 +180,4 @@ apply from: file('gradle/hacks/hashmapAssertions.gradle') apply from: file('gradle/hacks/turbocharge-jvm-opts.gradle') apply from: file('gradle/hacks/dummy-outputs.gradle') -apply from: file('gradle/pylucene/pylucene.gradle') \ No newline at end of file +apply from: file('gradle/pylucene/pylucene.gradle') diff --git a/gradle/testing/coverage.gradle b/gradle/testing/coverage.gradle index 38b23c156f5..66850a2a6ef 100644 --- a/gradle/testing/coverage.gradle +++ b/gradle/testing/coverage.gradle @@ -26,7 +26,7 @@ if (withCoverage) { allprojects { plugins.withType(JavaPlugin) { // Apply jacoco once we know the project has a Java plugin too. - project.plugins.apply("jacoco") + project.plugins.apply("org.barfuin.gradle.jacocolog") // Synthetic task to enable test coverage (and reports). task coverage() {