From d7e8c4840961d488ba2af4828b47543d2760e2cc Mon Sep 17 00:00:00 2001 From: ulofiai Date: Wed, 19 Aug 2026 22:50:00 +0800 Subject: [PATCH] Aggregate all per-module JaCoCo execution data into jacocoTestReport The shared jacocoTestReport configuration hard-coded its execution data to build/jacoco/test.exec, so coverage recorded by other Test tasks in the same module (e.g. needsRunnerTests and validatesRunner in runners/direct-java, which run the sdks/java/core runner-based suites) was silently dropped, under-reporting coverage. Use a fileTree over build/jacoco/*.exec so execution data from every Test task that ran in the module is included in the report. Fixes #18194 Signed-off-by: ulofiai --- .../org/apache/beam/gradle/BeamModulePlugin.groovy | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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 225201a5c0d8..a592fa0656e1 100644 --- a/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy +++ b/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy @@ -1387,8 +1387,14 @@ class BeamModulePlugin implements Plugin { getSourceDirectories().setFrom( project.files(project.sourceSets.main.allSource.srcDirs) ) - getExecutionData().setFrom(project.file( - project.getLayout().getBuildDirectory().file("jacoco/test.exec") + // Collect execution data from every Test task that ran in this module + // (e.g. test, needsRunnerTests, validatesRunner) instead of only + // build/jacoco/test.exec, so coverage from runner-based test tasks is + // no longer dropped from the report. + // See https://github.com/apache/beam/issues/18194. + getExecutionData().setFrom(project.fileTree( + dir: project.getLayout().getBuildDirectory().dir("jacoco"), + include: ['*.exec'] )) reports { html.required = true