Document TestKit coverage for external consumers, raise coverage - #175
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f525558b29
ℹ️ 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".
Mirror the buildSrc helper in the public KDoc recipe: wipe the exec directory at most once per build via an AtomicBoolean one-shot guard, and mark the Test tasks non-cacheable. Without the guard, a module with more than one TestKit Test task would have each task's doFirst delete the shared exec file, so only the last task's worker coverage survived. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
config
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #175 +/- ##
=============================================
+ Coverage 73.91% 90.22% +16.31%
- Complexity 453 552 +99
=============================================
Files 122 122
Lines 2231 2230 -1
Branches 311 311
=============================================
+ Hits 1649 2012 +363
+ Misses 455 96 -359
+ Partials 127 122 -5 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR aims to make Gradle TestKit worker coverage (via JaCoCo) understandable and reproducible for external consumers of plugin-testlib, while also bumping the repo snapshot version and regenerating dependency reports after a dependency refresh coming from the shared config/buildSrc setup.
Changes:
- Expanded KDoc in
plugin-testlibto document how TestKit coverage is enabled via two system properties and provided a copy-pastable Gradle Kotlin DSL wiring snippet. - Bumped published snapshot version to
2.0.0-SNAPSHOT.395and regenerateddocs/dependencies/pom.xmlaccordingly. - Refreshed a broad set of dependency/version constants and related build wiring under
buildSrc(config-distributed).
Reviewed changes
Copilot reviewed 56 out of 57 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| version.gradle.kts | Bumps versionToPublish to 2.0.0-SNAPSHOT.395. |
| plugin-testlib/src/main/kotlin/io/spine/tools/gradle/testing/TestKitCoverage.kt | Adds consumer-oriented documentation and a Gradle Kotlin DSL snippet for enabling TestKit worker coverage. |
| docs/dependencies/pom.xml | Updates snapshot version and dependency versions in the generated dependency report. |
| buildSrc/src/main/kotlin/io/spine/gradle/testing/TestKitCoverage.kt | Updates TestKit coverage wiring behavior/docs in buildSrc (config-distributed). |
| buildSrc/src/main/kotlin/io/spine/gradle/java/Linters.kt | Adjusts ErrorProne configuration API usage; updates copyright year. |
| buildSrc/src/main/kotlin/io/spine/dependency/test/Truth.kt | Updates Truth version constant. |
| buildSrc/src/main/kotlin/io/spine/dependency/test/KotlinCompileTesting.kt | Updates Kotlin compile testing fork version constant. |
| buildSrc/src/main/kotlin/io/spine/dependency/test/JUnit.kt | Updates JUnit BOM/Jupiter version constants and legacy JUnit 4 version. |
| buildSrc/src/main/kotlin/io/spine/dependency/test/Jacoco.kt | Updates JaCoCo version constant. |
| buildSrc/src/main/kotlin/io/spine/dependency/local/Validation.kt | Updates Validation snapshot version constant. |
| buildSrc/src/main/kotlin/io/spine/dependency/local/ToolBase.kt | Updates ToolBase snapshot versions used by builds/tests. |
| buildSrc/src/main/kotlin/io/spine/dependency/local/CoreJvmCompiler.kt | Updates Core JVM compiler snapshot versions. |
| buildSrc/src/main/kotlin/io/spine/dependency/local/Compiler.kt | Updates Compiler fallback snapshot versions. |
| buildSrc/src/main/kotlin/io/spine/dependency/lib/Slf4J.kt | Updates SLF4J version constant and adds a Maven Central reference comment. |
| buildSrc/src/main/kotlin/io/spine/dependency/lib/Roaster.kt | Updates Roaster version constant. |
| buildSrc/src/main/kotlin/io/spine/dependency/lib/Protobuf.kt | Updates Protobuf and protobuf-gradle-plugin version constants. |
| buildSrc/src/main/kotlin/io/spine/dependency/lib/Plexus.kt | Updates plexus-utils version constant. |
| buildSrc/src/main/kotlin/io/spine/dependency/lib/PalantirJavaFormat.kt | Updates Palantir Java Format version constant. |
| buildSrc/src/main/kotlin/io/spine/dependency/lib/Okio.kt | Updates Okio version constant. |
| buildSrc/src/main/kotlin/io/spine/dependency/lib/Netty.kt | Updates Netty version constant. |
| buildSrc/src/main/kotlin/io/spine/dependency/lib/Log4j2.kt | Updates Log4j2 version constant. |
| buildSrc/src/main/kotlin/io/spine/dependency/lib/KotlinSemver.kt | Updates kotlin-semver library version constant. |
| buildSrc/src/main/kotlin/io/spine/dependency/lib/KotlinPoet.kt | Updates KotlinPoet version constant. |
| buildSrc/src/main/kotlin/io/spine/dependency/lib/Kotlin.kt | Updates embedded/runtime Kotlin version constants and JetBrains annotations version constant. |
| buildSrc/src/main/kotlin/io/spine/dependency/lib/JetBrainsAnnotations.kt | Updates JetBrains annotations version constant. |
| buildSrc/src/main/kotlin/io/spine/dependency/lib/JavaDiffUtils.kt | Updates java-diff-utils version constant. |
| buildSrc/src/main/kotlin/io/spine/dependency/lib/Jackson.kt | Updates Jackson BOM version and annotations version constants. |
| buildSrc/src/main/kotlin/io/spine/dependency/lib/J2ObjC.kt | Updates J2ObjC annotations version constant. |
| buildSrc/src/main/kotlin/io/spine/dependency/lib/HttpClient.kt | Updates google-http-client version constant. |
| buildSrc/src/main/kotlin/io/spine/dependency/lib/Guava.kt | Updates Guava version constant. |
| buildSrc/src/main/kotlin/io/spine/dependency/lib/Gson.kt | Updates Gson version constant. |
| buildSrc/src/main/kotlin/io/spine/dependency/lib/GrpcKotlin.kt | Updates gRPC Kotlin stub version constant. |
| buildSrc/src/main/kotlin/io/spine/dependency/lib/Grpc.kt | Updates gRPC BOM version constant. |
| buildSrc/src/main/kotlin/io/spine/dependency/lib/Flogger.kt | Updates Flogger version constant. |
| buildSrc/src/main/kotlin/io/spine/dependency/lib/Firebase.kt | Updates Firebase Admin SDK version constant. |
| buildSrc/src/main/kotlin/io/spine/dependency/lib/CommonsLogging.kt | Updates Commons Logging version constant. |
| buildSrc/src/main/kotlin/io/spine/dependency/lib/CommonsCodec.kt | Updates Commons Codec version constant. |
| buildSrc/src/main/kotlin/io/spine/dependency/lib/CommonsCli.kt | Updates Commons CLI version constant. |
| buildSrc/src/main/kotlin/io/spine/dependency/lib/Clikt.kt | Updates Clikt version constant. |
| buildSrc/src/main/kotlin/io/spine/dependency/lib/Caffeine.kt | Updates Caffeine version constant. |
| buildSrc/src/main/kotlin/io/spine/dependency/lib/Auto.kt | Updates AutoValue version constant. |
| buildSrc/src/main/kotlin/io/spine/dependency/lib/Asm.kt | Updates ASM version constant. |
| buildSrc/src/main/kotlin/io/spine/dependency/lib/Aedile.kt | Updates Aedile version constant. |
| buildSrc/src/main/kotlin/io/spine/dependency/kotlinx/Serialization.kt | Updates copyright year header only. |
| buildSrc/src/main/kotlin/io/spine/dependency/kotlinx/DateTime.kt | Updates kotlinx-datetime version constant. |
| buildSrc/src/main/kotlin/io/spine/dependency/kotlinx/Coroutines.kt | Updates copyright year header only. |
| buildSrc/src/main/kotlin/io/spine/dependency/kotlinx/AtomicFu.kt | Updates copyright year header only. |
| buildSrc/src/main/kotlin/io/spine/dependency/build/Pmd.kt | Updates PMD version constant. |
| buildSrc/src/main/kotlin/io/spine/dependency/build/PluginPublishPlugin.kt | Updates Gradle Plugin Publish Plugin version constant. |
| buildSrc/src/main/kotlin/io/spine/dependency/build/Ksp.kt | Updates KSP plugin version constant. |
| buildSrc/src/main/kotlin/io/spine/dependency/build/GradleDoctor.kt | Updates Gradle Doctor plugin version constant. |
| buildSrc/src/main/kotlin/io/spine/dependency/build/ErrorProne.kt | Updates gradle-errorprone plugin version constant. |
| buildSrc/src/main/kotlin/io/spine/dependency/build/CheckerFramework.kt | Updates Checker Framework version constant. |
| buildSrc/src/main/kotlin/io/spine/dependency/build/AnimalSniffer.kt | Updates Animal Sniffer annotations version constant. |
| buildSrc/build.gradle.kts | Aligns embedded Kotlin/Guava/ErrorProne/Protobuf plugin versions used by buildSrc. |
Dokka in this repo documents only Public/Protected visibilities (buildSrc/.../DokkaExts.kt), so the consumer-facing instructions placed on the internal `enableTestKitCoverage` extension never reached the published HTML/Javadoc. Move the "Enabling TestKit coverage" section and the copy-paste Gradle recipe onto the public GradleProject class KDoc (which also covers runGradleBuild), and leave a maintainer-facing pointer on the internal function. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add and extend unit tests across jvm-tools, plugin-base, psi-java, psi, plugin-testlib, and protobuf-setup-plugins, raising total line coverage from ~80% to 95.5%. Notable: `ResourceDirectorySpec` had a backtick top-level class name with spaces that Gradle's test detector silently skipped, so the suite never ran; renamed it to a valid identifier with `@DisplayName`. Tests only; no production code changes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Address PR #175 review: `SourceSet.findProtoDirectorySet()` used `extensions.getByName(...)`, which throws when the `proto` extension is absent, so it could never return `null` as its KDoc documents and the `?: return false` fallback in `containsProtoFiles()` was unreachable. Switch to `findByName(...) as? SourceDirectorySet`. Also fix the misleading `SourceSetExtsSpec` test name (it applied the plugin and asserted non-null) and add cases for the plugin-not-applied path now that it is reachable. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
@codex review |
The TestKit worker can keep a `.gradle/.../kotlin-dsl-plugin-entries.lock`
file locked after the build on Windows, so JUnit's `@TempDir` strict
deletion threw a `DeletionException` and failed the otherwise-passing test
("Build on Windows" check). Replace `@TempDir` with a manual temp directory
and a best-effort `deleteRecursively()` teardown that silently skips files
it cannot delete.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Address PR #175 review: the "all known protoc plugins" assertion used `shouldContainExactly`, coupling the test to the enum declaration order. Switch to `shouldContainExactlyInAnyOrder` — it still verifies all names are present with their exact lower-camel-case spelling and that there are no extras, without breaking on a future reordering. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
@codex review |
Replace the manual temp-dir + best-effort teardown with JUnit's `@TempDir` injected as a parameter on each test function, giving every test its own fresh project directory. Revisits the Windows `@TempDir` cleanup failure with a simpler form; CI on Windows will confirm whether it suffices. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 28bd39c3ee
ℹ️ 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".
The `@TempDir`-parameter form still failed the "Build on Windows" check with the same `DeletionException` on a locked `kotlin-dsl-plugin-entries.lock` (JUnit uses strict deletion for both the field and parameter forms). Revert to a manual temp directory with a best-effort `deleteRecursively()` teardown, which ignores files the Windows TestKit worker keeps locked. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
config
armiol
left a comment
There was a problem hiding this comment.
@alexander-yevsyukov LGTM with a comment for the future PRs.
| fun `load from a JAR for a class packaged in it`() { | ||
| // Guava is a binary dependency on the test classpath, so its classes | ||
| // are loaded via a `JarURLConnection`. | ||
| val cls = com.google.common.base.Preconditions::class.java |
There was a problem hiding this comment.
Given we would like to eventually strip Guava, I would task the agent to find something else for this test.
What changed
plugin-testlib— TestKit coverage docs. Added a consumer-facing "Enabling TestKit coverage from your build" section to theenableTestKitCoverageKDoc inplugin-testlib/.../TestKitCoverage.kt. It documents the two system properties the harness consumes (io.spine.tools.gradle.testkit.coverage.agent/…execDir) and provides a self-contained, provider-neutral Gradle Kotlin DSL recipe so users without Spine'sconfig/buildSrccan wire up TestKit coverage themselves. The two property-constant KDocs were generalized to read correctly for non-Spine consumers. The JaCoCo agent in the snippet is pinned to0.8.15, matching the bumpedJacoco.version.jvm-tools,plugin-base,psi-java,psi,plugin-testlib, andprotobuf-setup-plugins, raising total line coverage from ~80% to 95.48% (Kover aggregate, generated code excluded). Tests-only — no production code changes. This also exercises the TestKit worker-coverage path documented above for the Gradle-plugin modules. Notably,ResourceDirectorySpechad a backtick top-level class name containing spaces that Gradle's test detector silently skipped (so the suite never ran); it was renamed to a valid identifier with@DisplayName. Remaining uncovered lines are non-actionable (inline functions, unreachablecatch/guard branches, message lambdas).Update config. A broad dependency refresh underbuildSrc/src/main/kotlin/io/spine/dependency/**(including JaCoCo →0.8.15),buildSrc/build.gradle.kts, abuildSrcTestKitCoverage.kttweak.Why
plugin-testlibis a library for testing Gradle plugins. Its consumers may not have Spine'sconfig/buildSrc, whereio.spine.gradle.testing.enableTestKitCoveragelives. The previous KDoc only pointed at that internal extension, leaving external users with no setup instructions.The new tests put the TestKit worker-coverage harness to work: with out-of-process plugin execution now credited, the Gradle-plugin modules could be brought up alongside the rest of the codebase to a 95%+ total.
Other notable changes
🤖 Generated with Claude Code
🙌 Edited by @alexander-yevsyukov