Skip to content

0.9.10: 0% coverage with Gradle configuration cache - testTaskOutcomes (#830) evaluated at configuration time #831

Closed

Description

@MF-HTK

Since 0.9.10 (PR #830, fix for #827), AbstractVariantArtifacts builds testTaskOutcomes with project.provider { tests.associate { ... to test.outcome() } }, and outcome() reads Task.state. With org.gradle.configuration-cache=true, Gradle evaluates this provider when it stores the cache entry, before any task runs. Every test task is therefore recorded as NOT_EXECUTED, KoverArtifactGenerationTask filters out all binary reports, and the reports and verification show 0% coverage (kover/<variant>.artifact lists no .ic file although bin-reports/test.ic exists). It happens on the first run and on every run that reuses the cache entry.

Repro: a single kotlin("jvm") module with one class and one test, org.gradle.configuration-cache=true in gradle.properties, ./gradlew clean koverXmlReport. Result: covered=0. The same run with --no-configuration-cache, or with 0.9.9, shows the correct coverage.

Observed in a multi-module project (LINE missed/covered):

Module 0.9.9 0.9.10 with CC 0.9.10 without CC
JVM module 10/57 67/0 10/57
Android library (debug) 50/765 810/0 –

Env: Gradle 9.8, Kotlin 2.4.20 (also AGP 9.4.1 Android library modules), Windows 11.

Suggested fix: derive the outcome at execution time instead of from Task.state, for example with a marker file the test task writes in doFirst/doLast, or via Gradle's build event listeners (BuildEventsListenerRegistry / OperationCompletionListener).

Workaround: mark the koverGenerateArtifact* tasks with notCompatibleWithConfigurationCache(...).

Activity

  1. self-assigned this
    on Sep 28, 2026
  2. added
    Bug
    on Sep 28, 2026
  3. added theissue type on Sep 28, 2026
  4. added
    S: in progress
    on Sep 28, 2026
  5. shanshin commented on Sep 28, 2026

    @shanshin
    Collaborator

    Thanks for the report!

  6. PierreVieira commented on Sep 29, 2026

    @PierreVieira

    We're hitting this too. Our project is a Kotlin Multiplatform app (Quartel-Enterprise/bible-planner-mobile-client), and bumping 0.9.9 -> 0.9.10 alone reproduces it.

    • Gradle 9.7.1, Kotlin 2.4.20, org.gradle.configuration-cache=true
    • Merged report across ~60 modules via dependencies { kover(project(...)) } on the root, with a custom variant limited to the jvm target
    • ./gradlew jvmTest :koverVerifyCi -> all tests pass, but Rule 'Line coverage of the merged report' violated: lines covered percentage is 0.000000
    • Same command with --no-configuration-cache on 0.9.10 -> BUILD SUCCESSFUL, ~94.5% line coverage (same as 0.9.9)

    That matches the configuration-time evaluation of the test task outcomes described here. Thanks for working on the fix; we're staying on 0.9.9 until it ships and can help test a fix if useful.

  7. kvuvalentin commented on Sep 29, 2026

    @kvuvalentin

    Same here with Android: AGP 9.4.1 (android.builtInKotlin=true, android.newDsl=true) app + library modules and two KMP modules (JVM target), Gradle 9.7.1, Kotlin 2.4.20, Kotest on the JUnit Platform, custom unit report variant merged in the root. Every .artifact lacks the .ic paths with the configuration cache on; pinned to 0.9.9 for now.

  8. shanshin commented on Sep 29, 2026

    @shanshin
    Collaborator

    The main problem is that Listeners is poorly compatible with the configuration cache.
    And doFirst/doLast are badly compatible with the build cache.

    So, fix #830 will be reverted for now.

  9. shanshin commented on Sep 29, 2026

    @shanshin
    Collaborator

    Fix for #827 was reverted in 0.9.11

  10. added a commit that references this issue on Sep 30, 2026
    d5a0db7
  11. added 4 commits that reference this issue on Oct 6, 2026
    78546bd
    b75df7b
    2abb134
    75f7bc9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

BugS: in progress

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions