Commit afa4d80
committed
Move legacy command compatibility tests into an end-to-end build
Addresses the outstanding review feedback on the Grails 7 command
compatibility layer.
Build placement. The Grails 7 fixture needs Java 17 - the minimum for a
Grails 7 app, so the binary matches what a real Grails 7 plugin is built
with - but expressing that as a Gradle toolchain put an unprovisionable
JDK requirement into the core build's task graph. Nothing in the repo
provisions a 17 (no foojay resolver, no toolchainManagement, no
org.gradle.java.installations.*), and because the fixture jar was an
implementation dependency, `./gradlew build -PskipTests` reached it - so
the build failed on the JDK the project documents in .sdkmanrc and in the
reproducible-build container. CI only passed because the runner images
happen to ship a 17 that Gradle auto-detects.
The three projects now live in a new top-level end-to-end build, so the
root build no longer reaches them. The fixture declares its JDK and
Gradle version in its own .sdkmanrc, matching what Grails 7 pins (17 and
8.14.5) rather than what this repository builds with, and is excluded
from the gradle-bootstrap wrapper propagation for that reason; the
end-to-end build itself is added to that propagation and tracks the root.
A dedicated workflow provisions both JDKs, reading the versions out of
those files.
Resolution goes through published artifacts rather than project
substitution, which is what makes these tests end-to-end: they consume
grails-core the way an application does, through real poms and module
metadata. The repository is the same build/local-maven that grails-forge
points its generated applications at, populated by
publishAllPublicationsToTestCaseMavenRepoRepository in both the root and
grails-gradle builds. settings.gradle scopes it with exclusiveContent so
a remote snapshot cannot quietly satisfy an org.apache.grails request and
leave the suite testing something other than the working tree.
That also disposes of the CLI companion problem rather than working
around it. grails-core-cli is a secondary capability of :grails-core, not
a project, so composite substitution cannot express it and hits a
capability self-conflict - but it is a first-class published module whose
metadata CliPublishingSupport already rewrites for external consumers, so
resolving from the repository gets it for free.
Trait-derived command names. Every legacy command in the tree overrode
getName()/getDescription(), so the trait's default derivation - what
create-command generated on Grails 7, and therefore what most published
Grails 7 commands rely on for their registration key - had no coverage.
Adds a third precompiled command declaring neither getter.
Factory resource failures are no longer silent. loadFactoryDeclarations
dropped a malformed resource with no log line at any level, and it backs
modern grails-cli.factories discovery, so one bad file lost every one of
a plugin's Grails 8 commands and providers. It now warns with the
resource URL and cause, keeping the per-resource isolation.
skipBootstrap resolution is covered. The lookup moves into a static
helper so the adapter-target case - where reading the flag off the
adapter instead of its target would let BootStrap run during dbm-update -
is guarded by a test.
Commands are now deduplicated across the registry and context
classloaders the way providers already were. A command declared in a
resource visible through both was constructed twice and the second
instance discarded, which the surrounding comment says the code exists to
avoid; an existing assertion encoded that double construction and now
asserts a single one.
Legacy commands take part in ordering. Modern commands are sorted before
first-wins registration, but legacy ones were registered in factory scan
order and the adapter carried none of the target's ordering, so two
Grails 7 plugins declaring the same command name resolved by jar order.
The adapter now projects the target's Ordered/@order onto itself and the
provider sorts before registering, restoring Grails 7 semantics.
ThreadDeath handling is removed from the four fatal-error guards.
Thread.stop() was removed in JDK 20, so on the 21 baseline the only
instances that branch ever saw were the ones the tests constructed, and
the type is deprecated for removal. VirtualMachineError handling and the
wrapped-cause walk are unchanged, and the specs now prove rethrow across
two VirtualMachineError subtypes instead. The duplicated rethrowIfFatal
is deliberately left in place: grails-shell-cli cannot see grails-core at
compile time, so consolidating would mean new public API on a
general-purpose utility for a CLI-internal concern.
Test quality. A spec named for a plugin-origin resolution failure
described a code path that does not exist and whose failure branch was
unreachable; it is renamed to what it verifies, with the dead branch
removed. AbstractProfile's unknown-command path, changed by this work but
uncovered, gets a spec driving the public Profile.handleCommand.
Also collapses two byte-identical instantiate helpers, drops a duplicated
fixture version pin in the integration spec, and corrects comments
describing the fixture as an included composite build.1 parent 75ed393 commit afa4d80
48 files changed
Lines changed: 1756 additions & 130 deletions
File tree
- .github/workflows
- end-to-end
- gradle/wrapper
- legacy-commands-plugin
- src/main
- groovy/legacy/commands/plugin
- resources/META-INF
- scripts
- legacy-commands
- grails-app
- conf
- controllers/legacycommands
- init/legacycommands
- services/legacycommands
- src/integration-test/groovy/legacycommands
- legacy-g7-command-plugin
- gradle/wrapper
- src/main
- groovy/legacy/g7/commands
- resources/META-INF
- gradle-bootstrap
- grails-console/src
- main/groovy/grails/ui/command
- test/groovy/grails/ui/command
- grails-core-cli-legacy/src
- main/groovy/org/apache/grails/core/cli/compat
- test/groovy/org/apache/grails/core/cli
- grails-core/src
- cli/groovy/org/apache/grails/core/cli
- main/groovy/org/grails/core/io/support
- test/groovy/org/apache/grails/core/cli
- grails-shell-cli/src
- main/groovy/org/grails/cli/profile/commands/factory
- test/groovy/org/grails/cli/profile
- commands/factory
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
Binary file not shown.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
0 commit comments