Skip to content

build: migrate unit test coverage from JaCoCo to Kover - #121

Merged
dkhawk merged 3 commits into
mainfrom
build/migrate-jacoco-to-kover
Sep 10, 2026
Merged

build: migrate unit test coverage from JaCoCo to Kover#121
dkhawk merged 3 commits into
mainfrom
build/migrate-jacoco-to-kover

Conversation

@kikoso

@kikoso kikoso commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

Migrates unit test coverage from JaCoCo to kotlinx-kover 0.9.9, matching googlemaps/android-maps-utils#1776 and googlemaps/android-maps-compose#994.

Why: the jacocoTestReport task in PublishingConventionPlugin read classes from tmp/kotlin-classes/debug, a path that no longer exists with AGP 9's built-in Kotlin compiler. The coverage report has therefore been empty. Kover integrates through AGP's variant APIs, so no internal paths are involved and real numbers are restored (the library currently reports 3.4% line coverage instead of an empty report).

Changes

  • PublishingConventionPlugin applies org.jetbrains.kotlinx.kover (with androidGeneratedClasses() excluded) instead of the hand-rolled jacocoTestReport task.
  • places-compose: removes enableUnitTestCoverage. Kover attaches its own agent to unit test runs, so AGP's JaCoCo agent would double-instrument. enableAndroidTestCoverage stays for on-device coverage.
  • test.yml: runs koverXmlReportDebug and points madrapps/jacoco-report (which supports Kover XML natively) at the new report path. The coverage gates (26% overall / 60% changed files) are unchanged.

Verification

Full CI command ./gradlew build koverXmlReportDebug --stacktrace passes locally. The generated places-compose/build/reports/kover/reportDebug.xml reports 16/472 lines covered (3.4%), where the previous JaCoCo setup produced an empty report.

Replaces the manual JaCoCo wiring in PublishingConventionPlugin with
kotlinx-kover 0.9.9. The old jacocoTestReport task read classes from
tmp/kotlin-classes/debug, a path that no longer exists with AGP 9's
built-in Kotlin compiler, so the coverage report has been empty.
Kover integrates through AGP's variant APIs and restores real numbers
(the library currently reports 3.4% line coverage instead of an empty
report).

Also removes enableUnitTestCoverage from the library module: Kover
attaches its own agent to unit test runs, so AGP's JaCoCo agent would
double-instrument. enableAndroidTestCoverage stays for on-device
coverage.

CI now runs koverXmlReportDebug; madrapps/jacoco-report supports
Kover XML natively, so only the report path changed and the coverage
gates are untouched.
@kikoso
kikoso requested a review from a team as a code owner September 10, 2026 13:18
@googlemaps-bot

Copy link
Copy Markdown
Contributor

Code Coverage

Overall Project 2.45%

There is no coverage information present for the Files changed

Fixes the zizmor mandatory-check failures on test.yml:

- unpinned-uses: all five actions are now pinned to commit SHAs
  (checkout v6.1.0, setup-java v5.7.0, setup-gradle v6.3.0,
  jacoco-report v1.8.0, upload-artifact v7.0.1). This also bumps
  madrapps/jacoco-report from v1.7.2 to v1.8.0, the same pin the
  other googlemaps Android repos use.
- template-injection: the coverage outputs are passed to the echo
  step through env vars instead of expanding directly in the run
  script.
Resolves the remaining zizmor excessive-permissions finding. The
workflow defaults to contents: read; the test job additionally gets
pull-requests: write so the coverage comment can be posted.
@dkhawk
dkhawk merged commit de3cc1a into main Sep 10, 2026
11 checks passed
@dkhawk
dkhawk deleted the build/migrate-jacoco-to-kover branch September 10, 2026 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants