This is an automated email from the ASF dual-hosted git repository.
epugh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr-mcp.git
The following commit(s) were added to refs/heads/main by this push:
new f5aa8e77 build: run buildSrc's tests as part of the build (#269)
f5aa8e77 is described below
commit f5aa8e772fb093237405efcd8ccf53b20fbf8820
Author: Aditya Parikh <[email protected]>
AuthorDate: Mon Oct 26 15:04:23 2026 -0400
build: run buildSrc's tests as part of the build (#269)
Since Gradle 8 the root build asks buildSrc only for the jar on the build
script classpath, so :buildSrc:test never ran and the LICENSE/NOTICE and
RAT exclude tests went unexercised by ./gradlew build, contrary to
AGENTS.md.
Finalize buildSrc's jar with its tests. dependsOn would be a cycle, since
compiling the Kotlin tests needs the jar, and the root build cannot
reference buildSrc's tasks at all.
Signed-off-by: Aditya Parikh <[email protected]>
Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
---
AGENTS.md | 3 ++-
buildSrc/build.gradle.kts | 9 +++++++++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/AGENTS.md b/AGENTS.md
index 64a38f86..4b3b3271 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -397,7 +397,8 @@ See
[infra.apache.org/licensing-howto](https://infra.apache.org/licensing-howto.
`build.gradle.kts` only applies the plugin. The tasks are unit-tested in
`buildSrc/src/test/kotlin/.../LicenseNoticeTasksTest.kt` (appendix listing,
SBOM
name/URL handling, the completeness gate, and NOTICE de-duplication);
`buildSrc`'s
- `test` runs as part of `./gradlew build`.
+ `test` runs as part of `./gradlew build`, because
`buildSrc/build.gradle.kts` finalizes its
+ `jar` with `test` (Gradle 8+ otherwise builds only the jar the root build
needs).
## Testing Structure
diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts
index b97432a7..db7ed79e 100644
--- a/buildSrc/build.gradle.kts
+++ b/buildSrc/build.gradle.kts
@@ -49,3 +49,12 @@ dependencies {
tasks.withType<Test>().configureEach {
useJUnitPlatform()
}
+
+// Since Gradle 8 the root build asks buildSrc only for the jar it puts on the
build script
+// classpath, so buildSrc's tests no longer run. Finalizing the jar with them
brings them
+// back: any root invocation, `./gradlew build` included, fails when the
license, NOTICE or
+// RAT tasks regress, and the tests are up to date unless buildSrc changed. It
can't be
+// `dependsOn`: compiling the Kotlin tests needs the jar, which would be a
cycle.
+tasks.jar {
+ finalizedBy(tasks.test)
+}