This is an automated email from the ASF dual-hosted git repository.

tvalentyn pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/master by this push:
     new 8d34bd8  [BEAM-12651] Exclude packages from jacoco report (#15792)
8d34bd8 is described below

commit 8d34bd8558c756f38c82fd95a513cdd9859cba1b
Author: Benjamin Gonzalez <[email protected]>
AuthorDate: Wed Nov 10 19:06:05 2021 -0600

    [BEAM-12651] Exclude packages from jacoco report (#15792)
---
 .test-infra/jenkins/job_PreCommit_Java.groovy      |  2 ++
 .../org/apache/beam/gradle/BeamModulePlugin.groovy | 27 ++++++++++++++++++++++
 2 files changed, 29 insertions(+)

diff --git a/.test-infra/jenkins/job_PreCommit_Java.groovy 
b/.test-infra/jenkins/job_PreCommit_Java.groovy
index a2382b2..444d240 100644
--- a/.test-infra/jenkins/job_PreCommit_Java.groovy
+++ b/.test-infra/jenkins/job_PreCommit_Java.groovy
@@ -57,6 +57,8 @@ builder.build {
     }
     jacocoCodeCoverage {
       execPattern('**/build/jacoco/*.exec')
+      
exclusionPattern('**/org/apache/beam/gradle/**,**/org/apache/beam/model/**,' +
+          
'**/org/apache/beam/runners/dataflow/worker/windmill/**,**/AutoValue_*')
     }
   }
 }
diff --git 
a/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy 
b/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy
index ea24693..f258c16 100644
--- a/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy
+++ b/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy
@@ -914,6 +914,33 @@ class BeamModulePlugin implements Plugin<Project> {
         }
       }
 
+      def jacocoExcludes = [
+        '**/org/apache/beam/gradle/**',
+        '**/org/apache/beam/model/**',
+        '**/org/apache/beam/runners/dataflow/worker/windmill/**',
+        '**/AutoValue_*'
+      ]
+
+      project.test {
+        jacoco {
+          excludes = jacocoExcludes
+        }
+      }
+
+      project.jacocoTestReport {
+        doFirst {
+          getClassDirectories().setFrom(project.files(
+              project.fileTree(
+              dir: "${project.rootDir}",
+              exclude: jacocoExcludes
+              )
+              )
+              )
+        }
+      }
+
+
+
       if (configuration.shadowClosure) {
         // Ensure that tests are packaged and part of the artifact set.
         project.task('packageTests', type: Jar) {

Reply via email to