Skip to content

fix(ci): exclude Grails-Micronaut island from Groovy joint validation build#15615

Open
jamesfredley wants to merge 3 commits into8.0.xfrom
fix/15613-isolate-micronaut-from-joint-build
Open

fix(ci): exclude Grails-Micronaut island from Groovy joint validation build#15615
jamesfredley wants to merge 3 commits into8.0.xfrom
fix/15613-isolate-micronaut-from-joint-build

Conversation

@jamesfredley
Copy link
Copy Markdown
Contributor

Summary

  • Adds a -PskipMicronautTests project property in settings.gradle that gates the Grails-Micronaut "island" (grails-micronaut, grails-micronaut-bom, and the 5 Micronaut-tied test-examples) out of the build graph entirely.
  • Wires -PskipMicronautTests into .github/workflows/groovy-joint-workflow.yml so the joint Groovy 4 snapshot build never evaluates the Groovy-5-pinned subgraph.
  • Documents the new property in gradle.properties for discoverability.

Why

The Swap Groovy Version step in the joint workflow rewrites every 'groovy.version' line in dependencies.gradle - including the override inside the else if (project.name == 'grails-micronaut-bom') block - to the locally built apache/groovy 4.x snapshot. That BOM still pins Spock to 2.4-groovy-5.0 (intentionally, to match the Micronaut platform's Groovy 5 baseline), so when a test-example that opts into enforcedPlatform(:grails-micronaut-bom) tries to compile a Spock spec, Spock's compile-time Groovy major-version check refuses Groovy 4 and the build fails:

> Task :grails-test-examples-issue-11767:compileIntegrationTestGroovy FAILED
> Task :grails-test-examples-micronaut:compileIntegrationTestGroovy FAILED

The architectural intent of grails-micronaut-bom (introduced in 2226af9) is exactly to give Micronaut its own dependency graph. This change finishes that isolation for the joint build instead of spreading Spock's iKnowWhatImDoing.disableGroovyVersionCheck escape hatch into CompilePlugin / gradle/test-config.gradle / every test-example.

Modules gated by the flag

Module Reason
grails-micronaut Plugin that re-exports the Micronaut platform
grails-micronaut-bom The Groovy 5 / Spock 2.4-groovy-5.0 island
grails-test-examples-issue-11767 enforcedPlatform(:grails-micronaut-bom)
grails-test-examples-plugins-issue-11767 enforcedPlatform(:grails-micronaut-bom)
grails-test-examples-micronaut enforcedPlatform(:grails-micronaut-bom)
grails-test-examples-micronaut-groovy-only enforcedPlatform(:grails-micronaut-bom)
grails-test-examples-plugins-micronaut-singleton enforcedPlatform(:grails-micronaut-bom)

Verification

Both flag states verified locally with JDK 21:

# Without flag - includes the Micronaut subgraph (baseline behaviour)
./gradlew projects | grep micronaut
+--- Project ':grails-micronaut'
+--- Project ':grails-micronaut-bom'
+--- Project ':grails-test-examples-issue-11767'
+--- Project ':grails-test-examples-plugins-issue-11767'
project ':grails-test-examples-micronaut' ...
project ':grails-test-examples-micronaut-groovy-only' ...
...

# With flag - subgraph disappears entirely (joint build behaviour)
./gradlew projects -PskipMicronautTests | grep -i micronaut
(no output)
BUILD SUCCESSFUL in 8s

./gradlew codeStyle -> BUILD SUCCESSFUL.

Notes

  • The flag is opt-in. Local builds and the standard gradle.yml CI run are unaffected; only groovy-joint-workflow.yml opts in.
  • No changes to dependencies.gradle, CompilePlugin.groovy, gradle/test-config.gradle, or any individual Micronaut module's build.gradle. The gating logic lives in exactly one place (settings.gradle).
  • This is a CI-only fix; it does not change the dependency graph or behaviour of any released artifact.

Fixes #15613

… build

The Joint Validation Build's "Swap Groovy Version" step rewrites every
'groovy.version' line in dependencies.gradle to point at the locally built
apache/groovy 4.x snapshot - including the override inside the
grails-micronaut-bom block. That BOM still pins Spock to 2.4-groovy-5.0
(intentionally, to match the Micronaut platform's Groovy 5 baseline),
which fails Spock's compile-time Groovy major-version check and breaks
every Spock spec in the test-examples that consume :grails-micronaut-bom.

Rather than spread Spock's iKnowWhatImDoing.disableGroovyVersionCheck
escape hatch across the framework build, keep Micronaut on its own
dependency island: gate :grails-micronaut, :grails-micronaut-bom, and
the five Micronaut-tied test-examples in settings.gradle behind a
new -PskipMicronautTests project property, and pass that property in
groovy-joint-workflow.yml so the Groovy 4 snapshot matrix never tries
to evaluate the Groovy-5-pinned subgraph. The flag is a no-op locally
and in the regular gradle.yml CI run; only the joint validation build
opts in.

Fixes #15613

Assisted-by: claude-code:claude-opus-4-7
Copilot AI review requested due to automatic review settings May 1, 2026 01:14
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an opt-in Gradle property to remove the Grails-Micronaut “island” projects from the multi-project build graph, and uses it in the Groovy joint CI workflow to avoid Groovy 4 snapshot builds evaluating Groovy-5/Spock-2.4-groovy-5.0 modules.

Changes:

  • Introduces -PskipMicronautTests gating in settings.gradle to conditionally include/exclude Micronaut-related projects.
  • Updates groovy-joint-workflow.yml to pass -PskipMicronautTests during the joint Groovy snapshot build.
  • Documents the new property in gradle.properties for discoverability.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
settings.gradle Adds conditional include(...) + projectDir wiring for Micronaut subgraph behind -PskipMicronautTests.
gradle.properties Documents the skipMicronautTests property (commented-out example).
.github/workflows/groovy-joint-workflow.yml Passes -PskipMicronautTests to prevent the joint Groovy build from evaluating Micronaut projects.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread settings.gradle Outdated
Comment thread settings.gradle Outdated
…and is skipped

The previous commit excluded :grails-micronaut-bom from the build graph when
-PskipMicronautTests is set, but grails-doc/build.gradle still referenced
project(':grails-micronaut-bom') directly inside the generateBomDocumentation
configure block. The joint validation build's `./gradlew build` realises
:grails-doc:publishGuide -> :grails-doc:generateBomDocumentation during task
graph computation, which then failed with:

    Project with path ':grails-micronaut-bom' could not be found in project ':grails-doc'.

Resolve the Micronaut BOM via findProject() (matches the null-tolerant lookup
pattern in GrailsDependencyValidatorPlugin.detectBomPath/collectBomVersions)
and gate every Micronaut-specific dependency, input, output, and doLast block
on a non-null result. When the island is in the graph the task behaves
identically to before; when it is skipped, generateBomDocumentation produces
only the default and Hibernate 5 BOM pages.

Also clarify the documentation around the toggle:

  * settings.gradle - call out that the property is presence-based (matches
    skipFunctionalTests / skipCodeStyle / skipDependencyValidation) and remind
    consumers that any project(':grails-micronaut-bom') reference must be
    findProject-guarded.
  * gradle.properties - drop the misleading `#skipMicronautTests=true` example
    (presence is what matters; the value is irrelevant) and note the kinship
    with the existing skip* flags.

Verified locally:

    ./gradlew :grails-doc:build -PskipMicronautTests --dry-run   -> BUILD SUCCESSFUL
    ./gradlew :grails-doc:generateBomDocumentation --dry-run     -> SKIPPED (depends on :grails-micronaut-bom:extractConstraints)
    ./gradlew codeStyle                                           -> BUILD SUCCESSFUL

Addresses Copilot review comments on grails-core#15615.

Assisted-by: claude-code:claude-opus-4-7
Comment thread settings.gradle Outdated
// Consumers that reference :grails-micronaut-bom (e.g. grails-doc:generateBomDocumentation)
// must guard those references with findProject(':grails-micronaut-bom') != null.
// See https://github.com/apache/grails-core/issues/15613.
def skipMicronautTests = providers.gradleProperty('skipMicronautTests').isPresent()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have test slicing, and this isn't skipping tests. It's skipping projects. We should rename this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed in cf47e9f:

  • skipMicronautTests -> skipMicronautProjects across settings.gradle, gradle.properties, .github/workflows/groovy-joint-workflow.yml, and the grails-doc comment.
  • Name now reflects what the flag actually does (skip whole projects, not tests) and removes the overlap with test-related flag naming.

While in there, I also guarded the two unconditional Micronaut BOM cross-references in grails-doc/build.gradle (lines 193, 206) - per Oracle architectural review, when the Micronaut BOM page is intentionally omitted under the skip flag, the default and Hibernate 5 BOM pages should not link to it. Verified locally with both flag states (./gradlew :grails-doc:generateBomDocumentation):

Flag state Pages generated Cross-links
no flag Default, Hibernate 5, Micronaut all 3 link to each other
-PskipMicronautProjects Default, Hibernate 5 only link to each other (no dead Micronaut link)

Copy link
Copy Markdown
Contributor

@jdaugherty jdaugherty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My only concern is the poor name of the value - it's confusing with testSlicing that mattias added. We should call this skipMicronautProjects since it's actually excluding the projects from building or being included.

The toggle skips entire projects from the build graph, not just tests,
which was confusing with the existing test-related flags. Renamed across
settings.gradle, gradle.properties, the joint Groovy CI workflow, and the
grails-doc reference comment.

Also guard the two unconditional cross-references to the Micronaut BOM
page in grails-doc/build.gradle so the generated default and Hibernate 5
BOM pages no longer link to a Micronaut BOM page that intentionally was
not produced. The flag's runtime is the joint Groovy 4 CI job, which
does not publish docs, but the generated pages are now internally
consistent under skip mode (verified locally for both flag states).

Refs grails-core#15613.

Assisted-by: claude-code:claude-opus-4-7
@jamesfredley
Copy link
Copy Markdown
Contributor Author

Pushed cf47e9f addressing review feedback:

1. Renamed the toggle (per @jdaugherty)

skipMicronautTests -> skipMicronautProjects. The flag excludes whole projects from the build graph, not tests, and the new name eliminates the naming overlap with test-related flags. Renamed in:

  • settings.gradle (variable + property name + comments)
  • gradle.properties (documentation comment)
  • .github/workflows/groovy-joint-workflow.yml (CLI flag + comment)
  • grails-doc/build.gradle (comment ref)

2. Tightened grails-doc cross-references

Architectural review surfaced that the default and Hibernate 5 BOM pages still emitted unconditional link:Grails%20BOM%20Micronaut.html[...] cross-links even when the Micronaut BOM page itself was intentionally not generated. Guarded both links with the same grailsMicronautBom != null check that gates the rest of the Micronaut BOM logic, so generated pages stay internally consistent under skip mode.

Verification (JDK 21 locally)

Command Result
./gradlew projects -PskipMicronautProjects zero Micronaut projects in graph
./gradlew projects full Micronaut subgraph (no regression)
./gradlew :grails-doc:generateBomDocumentation -PskipMicronautProjects BUILD SUCCESSFUL, 2 pages, no dead links
./gradlew :grails-doc:generateBomDocumentation BUILD SUCCESSFUL, 3 pages, all cross-links intact

Net diff vs the previous push: +13/-10 across the same 4 files.

@testlens-app
Copy link
Copy Markdown

testlens-app Bot commented May 1, 2026

✅ All tests passed ✅

🏷️ Commit: cf47e9f
▶️ Tests: 28702 executed
⚪️ Checks: 35/35 completed


Learn more about TestLens at testlens.app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants