From 8b199c134da306f10d7aa09b88af222a246daee9 Mon Sep 17 00:00:00 2001 From: Alfayed Baksh Date: Tue, 1 Oct 2024 21:00:08 -0400 Subject: [PATCH] Update Jacoco.kt --- .../com/google/samples/apps/nowinandroid/Jacoco.kt | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/Jacoco.kt b/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/Jacoco.kt index 972d539c67..05ce75611d 100644 --- a/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/Jacoco.kt +++ b/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/Jacoco.kt @@ -88,13 +88,11 @@ internal fun Project.configureJacoco( html.required = true } - // TODO: This is missing files in src/debug/, src/prod, src/demo, src/demoDebug... - sourceDirectories.setFrom( - files( - "$projectDir/src/main/java", - "$projectDir/src/main/kotlin", - ), - ) + // Collect all java and kotlin source directories from the variant's source sets + val sourceDirs = variant.sources + .map { it.java.srcDirs + it.kotlin.srcDirs } + .flatten() + sourceDirectories.setFrom(sourceDirs) executionData.setFrom( project.fileTree("$buildDir/outputs/unit_test_code_coverage/${variant.name}UnitTest")