From 186cfebcbae6646cef9f636316fc2808d7b63e3a Mon Sep 17 00:00:00 2001 From: Eric Anderson Date: Tue, 31 Mar 2020 18:04:10 -0700 Subject: [PATCH] all: Move jacocoTestReport exclusions to individual projects The sourceSets.main.output.collect should probably be improved at some point to improve loading performance, but this is technically better than what we had before so let's call it a win and move on. --- all/build.gradle | 14 +++++--------- okhttp/build.gradle | 9 +++++++++ testing/build.gradle | 9 +++++++++ 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/all/build.gradle b/all/build.gradle index 060a8d0ae2..fad1a175f0 100644 --- a/all/build.gradle +++ b/all/build.gradle @@ -60,15 +60,11 @@ jacocoTestReport { html.enabled = true } - additionalSourceDirs.from(files(subprojects.sourceSets.main.allSource.srcDirs)) - sourceDirectories.from(files(subprojects.sourceSets.main.allSource.srcDirs)) - classDirectories.from(files(subprojects.sourceSets.main.output).collect { - fileTree(dir: it, - exclude: [ - '**/io/grpc/internal/testing/**', - '**/io/grpc/okhttp/internal/**', - ]) - }) + subprojects.each { subproject -> + additionalSourceDirs.from(subproject.jacocoTestReport.additionalSourceDirs) + sourceDirectories.from(subproject.jacocoTestReport.sourceDirectories) + classDirectories.from(subproject.jacocoTestReport.classDirectories) + } } coveralls { diff --git a/okhttp/build.gradle b/okhttp/build.gradle index 1f0e4eaf70..b594600c2d 100644 --- a/okhttp/build.gradle +++ b/okhttp/build.gradle @@ -36,3 +36,12 @@ checkstyleMain.exclude '**/io/grpc/okhttp/internal/**' javadoc.exclude 'io/grpc/okhttp/internal/**' javadoc.options.links 'http://square.github.io/okhttp/2.x/okhttp/' + +jacocoTestReport { + classDirectories.from = sourceSets.main.output.collect { + fileTree(dir: it, + exclude: [ + '**/io/grpc/okhttp/internal/**', + ]) + } +} diff --git a/testing/build.gradle b/testing/build.gradle index 7365d7d53f..54c9dff6d0 100644 --- a/testing/build.gradle +++ b/testing/build.gradle @@ -33,3 +33,12 @@ dependencies { } javadoc { exclude 'io/grpc/internal/**' } + +jacocoTestReport { + classDirectories.from = sourceSets.main.output.collect { + fileTree(dir: it, + exclude: [ + '**/io/grpc/internal/testing/**', + ]) + } +}