Credit sibling-module test coverage in Kover reports#687
Conversation
There was a problem hiding this comment.
Pull request overview
This PR appears to sync buildSrc coverage-related utilities/tests (and a local dependency version) from an upstream “ToolBase” source, adding support code for cross-module Kover coverage attribution and tests for deriving class FQNs from source file paths.
Changes:
- Added
Project.creditTestCoverageFrom(contributor)to feed a sibling module’s JaCoCo/Kover binary data into the current module’s Kovertotalreport. - Added
FileExtensionsTestcovering expected class-name derivation rules for.java,.kt, and.proto.ktsources. - Bumped the local
Basedependency snapshot version from2.0.0-SNAPSHOT.400to2.0.0-SNAPSHOT.404.
Reviewed changes
Copilot reviewed 1 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| buildSrc/src/test/kotlin/io/spine/gradle/report/coverage/FileExtensionsTest.kt | New tests for File.classNamesIn(...) behavior across Java/Kotlin/proto-Kotlin filenames. |
| buildSrc/src/main/kotlin/io/spine/gradle/report/coverage/SiblingCoverage.kt | New helper to include sibling module execution data in Kover reports and wire report tasks after contributor tests. |
| buildSrc/src/main/kotlin/io/spine/dependency/local/Base.kt | Updates the pinned snapshot version for Spine Base dependencies. |
spine-base
Rename the private `File.fqnsRelativeTo` helper to `classNamesIn` and make it `internal` so `FileExtensionsTest` (applied from ToolBase) can exercise it. The test referenced `classNamesIn`, which did not exist in this repo, so the branch did not compile. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
spine-baseThere was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6d03294c30
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
`creditTestCoverageFrom` hard-coded the `test` task name and a single `kover/bin-reports/test.exec` file. A `kmp-module` contributor runs its JVM tests through `jvmTest`, so the wiring either failed task resolution or missed the contributor's actual binary report. Discover the contributor's JVM test tasks by type (`Test`), derive one exec file per task name, and depend on the whole collection. Non-JVM Kotlin test tasks are not of type `Test` and are correctly ignored. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Overview
Applies changes brought over from the ToolBase repository. Three independent edits:
1. Credit sibling-module test coverage —
SiblingCoverage.kt(new)Adds
Project.creditTestCoverageFrom(contributor). Some modules' productionclasses are exercised only by a sibling module's tests (e.g. the language-neutral
psiclasses are tested through thepsi-javafixtures). Kover's per-modulereport — the one Codecov consumes — sees only the module's own
testexecutiondata, so that cross-module coverage is otherwise lost from the per-module report.
The function feeds the contributor's JaCoCo execution data into this project's
totalreport as an additional binary report (only this project's classes arecredited from it) and wires the report/verify tasks to run after the
contributor's
testtask. A cross-project task dependency is used ratherthan a project dependency, so no dependency cycle is introduced even when the
contributor already depends on this project.
2. Tests for
File.classNamesIn—FileExtensionsTest.kt(new)Covers the source-file → fully-qualified-class-name mapping: Java sources, Kotlin
sources (declared class + synthetic
…Ktfile class), theKt-suffixed namesemitted by
protoc-gen-kotlin, the two-part.proto.ktsuffix, and theunsupported-input fallbacks (non-source files and files outside the source root).
To make the helper testable, the existing
File.fqnsRelativeToinKoverConfig.ktwas renamed toclassNamesInand widened fromprivatetointernal— matching the name the applied test expects.3. Dependency bump —
Base.ktspine-base:2.0.0-SNAPSHOT.400→2.0.0-SNAPSHOT.404.