Repository navigation
refactor: convert grails-common, grails-beans-dsl and grails-async-core to Groovy - #16577
borinquenkid wants to merge 32 commits into
Conversation
…l to Groovy Converts the remaining Java sources of build-logic/docs-core, grails-gradle/common and grails-gradle/model to Groovy. Part of the per-project split requested by the maintainers on #16351; end state taken from the 9.0.x-java-to-groovy branch (origin/9.0.x..e55fd9e). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## refactor/java-to-groovy-build-tooling #16577 +/- ##
===============================================================================
- Coverage 64.0971% 64.0887% -0.0084%
- Complexity 28681 29082 +401
===============================================================================
Files 2260 2259 -1
Lines 112147 112015 -132
Branches 20366 20362 -4
===============================================================================
- Hits 71883 71789 -94
+ Misses 31140 31031 -109
- Partials 9124 9195 +71
🚀 New features to boost your workflow:
|
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…nd fix ClassPathResource.equals - add specs for GrailsNameUtils, DefaultCommandLine and the file-resolving resources (file, jar and http), and extend the parser, loader, resource-utils and IO-utils specs - ClassPathResource.equals read the other resource's classLoader through its getter, which falls back to the class's loader, while reading its own field; two resources created from the same class were therefore never equal. Compare fields on both sides, as the Java original did. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…to-groovy-core-leaves
|
Hello! Please be careful with sending out multiple PRs at once and avoid doing it when possible. This repository uses a shared set of GitHub Action runners. Currently, jobs across the entire Apache organization are being queued / timing out because these PRs are taking up most of the runners. |
…-to-groovy-core-leaves
…erve rename history git's default 50% rename-similarity threshold is what GitHub's PR view and 'git log --follow'/'blame' use to link a converted file back to its original .java predecessor. DefaultCommandLine's full idiomatic conversion landed at 41% similarity (confirmed: GitHub shows delete+add, not a rename, losing file history per matrei's review comment on #16576). This keeps the method-body semicolons (76% similarity, confirmed rename- detected, confirmed git log --follow/blame trace through to the real pre-conversion commits and author) while still applying every other idiom fix: dropped the public modifier, the 7 unnecessary java.util.* imports, and the 4 non-interpolated double-quoted string literals CodeNarc also flags. @SuppressWarnings('UnnecessarySemicolon') marks this as a known, temporary, scoped exception pending the stacked groovyism-cleanup PR, which removes both the semicolons and this suppression. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…va-to-groovy-core-leaves
…ning GlobalGrailsClassInjectorTransformationSpec's "a generated class missing from a hand-authored imports file is reported" fails on every GitHub-hosted runner (Ubuntu 21/25, macOS, Windows, Coverage) with an empty warning list, and passes locally in isolation, paired with every other base.dir-touching spec, and in the full suite at both local and CI fork counts. Static analysis rules out base.dir leakage (grails-core ships its own hand-authored imports file, so a leaked value would still warn), groovy.* property mutation, Spock parallelism and Groovy version drift (6.0.0 pinned on both sides). This inlines the compilation so the power assertion prints which branch of AutoConfigurationImportsWriter.register ran on the runner: whether the sibling was generated, whether the generated imports file was written (hand-authored file not found) or not (hand-authored branch taken), the collector's warning level and counts, and the directories involved. REVERT THIS COMMIT once the CI log has been read. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…by the rename-fix 580bd5e rebuilt DefaultCommandLine from the .java original, which carries no annotations, and so lost the @CompileStatic stage 1 had put on the class and the @PackageScope on systemProperties, undeclaredOptions, declaredOptions and remainingArgs. Without them the four fields became public Groovy properties with generated accessors and the class fell back to dynamic dispatch. Both are restored; similarity stays at R069. grails-gradle-model: compile, codenarc and 432 tests pass. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…va-to-groovy-core-leaves
…orts warning" This reverts commit 72948a2.
Conflicts: GrailsResourceUtils.groovy takes upstream's getPathFromRoot change (18d8daf); the four grails-gradle/model specs upstream added in 186b59c with the same names as this branch's are kept verbatim, with the nine feature methods only this branch's versions asserted appended. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…10.0.x 10.0.x was branched from 9.1.x without the version bump, so gradle.properties still said projectVersion=9.1.0-SNAPSHOT and githubBranch=9.1.x. The 'Validate githubBranch' job therefore fails on every pull request whose base is 10.0.x. Same four files as the 9.1.x bump in 829de60. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> (cherry picked from commit fb8ecf0)
…va-to-groovy-core-leaves
…move before merge) Keeps CI on the stacked Java-to-Groovy PRs cheap while the chain is reviewed and rebased. The PR closest to the release branch keeps the full build; this block is dropped from a PR when its base is merged. Merging with this commit is a blocker. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
SUPERSEDED: the Temporary CI flag on this stacked branch (BLOCKER before merge). This Java-to-Groovy chain is a stack of PRs, and every push to any of them starts the full CI matrix, which is more runner time than the ASF allows us. Every PR in the stack except the one closest to its release branch (#16576) therefore carries one temporary commit, With it, CI on this PR compiles but does not run tests or code style. The full build runs on #16576 (closest to 10.0.x), and each PR gets it when the PR below it has merged. Condition for merging this PR: that |
…(revert before merge) The skipTests/skipCodeStyle flag only removed test execution; the functional jobs still compiled the whole repository (~57 minutes each) on every push. Turn the pull_request triggers into a branch filter that never matches so pushes, rebases and force-pushes to the stacked PRs start no jobs. Reverts the gradle.properties flag. The PR closest to the release branch keeps its triggers. Merging with this commit is a blocker. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Update: this branch now carries a different temporary CI commit (BLOCKER before merge). The earlier In its place, every PR in this stack except #16576 (the one closest to 10.0.x) carries one temporary commit, Condition for merging this PR: that commit must be reverted on this branch first ( |
…oovy-build-tooling
…va-to-groovy-core-leaves
…oovy-build-tooling
…/java-to-groovy-core-leaves
…oovy-build-tooling
…va-to-groovy-core-leaves
…oovy-build-tooling
…va-to-groovy-core-leaves # Conflicts: # .github/workflows/benchmark.yml # .github/workflows/build-health.yml # .github/workflows/codeanalysis.yml # .github/workflows/codeql.yml # .github/workflows/codestyle.yml # .github/workflows/coverage.yml # .github/workflows/end-to-end.yml # .github/workflows/gradle.yml # .github/workflows/groovy-snapshot-canary.yml # .github/workflows/rat.yml # .github/workflows/sitemesh2.yml # .github/workflows/validate-actions.yml # .github/workflows/vulnerability-scan.yml
…va-to-groovy-core-leaves The build-tooling files of this branch come from the one-commit conversion of #16576, which is replaced by a conversion that moves the files first and converts them in a second commit. The new content of the three projects replaces the old one; nothing else changes. Claude-Session: https://claude.ai/code/session_01MDHn7fC3hsGJ27vFHD2o1p
🔎 No tests executed 🔎🏷️ Commit: 72d70ad Learn more about TestLens at testlens.app/docs. |
What
Converts the remaining Java sources of
grails-common,grails-beans-dsl,grails-async-coreto Groovy: 10.javafiles removed, 12.groovyfiles added (12 files changed, 1915 insertions(+), 1780 deletions(-)).Why
The maintainers asked on #16351 for the Java-to-Groovy migration to land one Gradle project at a time as a stack of PRs, bottom-up in dependency order. #16572 did
grails-data-hibernate7; this PR is 2 of 30 in the next stack (base:10.0.x; the branch carries the build-tooling conversion of #16576, which is closed and comes back as a rebuilt pull request, so the commits of that conversion show in this diff until it lands). The end state of every file is taken from the9.0.x-java-to-groovybranch, which already carries the regression fixes found by CI.Commits:
Changed outside the converted sources
Java-facing API sweep
Every deleted
.javawas compared with its Groovy twin viajavap -v -protected(class declaration, public/protected fields, constructors, methods incl. modifiers/throws/generics, interface default methods, nested class modifiers, and the annotations callers see). Result:See also the notes below.
Verification
classesandtestClasses(plusast/cli/testFixturessource sets where present) of the converted project(s) and of their direct dependents compile: ['grails-async', 'grails-async-gpars', 'grails-async-rxjava', 'grails-async-rxjava2', 'grails-async-rxjava3', 'grails-core', 'grails-data-mongodb-core', 'grails-databinding-core', 'grails-datamapping-async', 'grails-datastore-async', 'grails-datastore-core', 'grails-domain-class', 'grails-redis', 'grails-rest-transforms', 'grails-views-core', 'grails-views-gson', 'grails-web-databinding']codeStyle,ratand a whole-repobuild -PskipTestsare run once on the tip of the stack.Notes
MIN_VALUE/MAX_VALUE/next()/previous(), property accessors appear for formerly package-private members, nested static classes with implicit constructors become public (they wereprotected), and generic type parameters that Groovy erases in constructors/methods (descriptors identical).static finalwithoutpubliccreates a property;==callsequals(); Closure/SAM coercions;@CompileStaticwith nested classes. All CI regression fixes found on the umbrella branch are included in the end state.🤖 Generated with Claude Code