-
Notifications
You must be signed in to change notification settings - Fork 55
Description
Describe the bug
With Android Gradle Plugin 9.0.0, Kover does not generate variant-specific report tasks (e.g., koverXmlReportGoogleplayPremiumDebug). Additionally, the total koverXmlReport task has no dependencies on test tasks, meaning running it independently produces an empty coverage report.
Expected behavior
According to the Kover documentation:
For each Gradle Build Variant, Kover creates its own report variant that have the same names.
And:
Running one of these tasks automatically triggers the launch of all test tasks for
debugbuild variant
Expected:
- Variant-specific tasks like
koverXmlReportVariantDebugshould exist koverXmlReportGoogleplayPremiumDebugshould depend ontestVariantDebugUnitTestkoverXmlReport(total) should depend on all test tasks
Actual behavior
With AGP 9.0.0:
- Variant-specific report tasks do NOT exist
koverXmlReporthas NO test task dependencies- Running
koverXmlReportindependently produces an empty report (0% coverage)
Verification:
# Check dependencies of koverXmlReport
./gradlew :Scribd:koverXmlReport --dry-run
# Output shows only:
:Scribd:koverGenerateArtifact SKIPPED
:Scribd:koverXmlReport SKIPPED
# No test tasks are included as dependenciesEmpty report generated:
<?xml version="1.0" ?>
<report name="Kover Gradle Plugin XML report for :android">
<counter type="INSTRUCTION" missed="0" covered="0"/>
<counter type="BRANCH" missed="0" covered="0"/>
<counter type="LINE" missed="0" covered="0"/>
<counter type="METHOD" missed="0" covered="0"/>
<counter type="CLASS" missed="0" covered="0"/>
</report>Comparison with AGP 8.x (main branch):
On AGP 8.x, the variant-specific task correctly depends on test tasks:
./gradlew :Scribd:koverXmlReportVariantDebug --dry-run
# Output includes:
:Scribd:testVariantDebugUnitTest SKIPPEDWorkaround
Explicitly run the test task before generating the report:
./gradlew :Scribd:testVariantDebugUnitTest :Scribd:koverXmlReportThis works because Kover's agent still instruments code and collects coverage during test execution; the report task then uses this collected data.
Environment
- Kover Gradle Plugin version: 0.9.4
- Gradle version: 9.3.0
- Android Gradle Plugin version: 9.0.0
- Kotlin version: 2.3.0
- Kotlin project type: Android Application with multiple product flavors and build types
- Coverage Toolset: Kover (default)
Additional context
This may be related to #784 (AGP 9.0.0 changes on Variant API), but that issue describes a different symptom (custom variant creation with add() not working). This issue is specifically about:
- Variant-specific report tasks not being generated at all
- The total report task missing test task dependencies