-
-
Notifications
You must be signed in to change notification settings - Fork 974
feat: Replace Spring Dependency Management plugin with Gradle platform + lightweight BOM property overrides #15467
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
48 commits
Select commit
Hold shift + click to select a range
ca495ab
feat: replace Spring Dependency Management plugin with Gradle platfor…
jamesfredley 531041b
Address review: add XInclude hardening and extract interpolation dept…
jamesfredley 5e89656
fix: apply grails-bom platform to all declarable configurations
jamesfredley 1a2cea3
Merge branch '8.0.x' into feat/gradle-managed-version-overrides
jamesfredley 30a46f6
Merge branch '8.0.x' into feat/gradle-managed-version-overrides
jamesfredley 96fea95
Merge branch '8.0.x' into feat/gradle-managed-version-overrides
jamesfredley 5607ddb
Merge branch '8.0.x' into feat/gradle-managed-version-overrides
jamesfredley 575b77f
Merge branch '8.0.x' into feat/gradle-managed-version-overrides
jamesfredley a4511eb
Merge branch '8.0.x' into feat/gradle-managed-version-overrides
jamesfredley 28a6817
Merge branch '8.0.x' into feat/gradle-managed-version-overrides
jamesfredley 77932f2
fix: allow Micronaut BOM validator to coexist with plugin-injected pl…
jamesfredley 54fbe93
fix: exclude annotation-processor configurations from grails-bom plat…
jamesfredley 4d1bcdb
Merge branch '8.0.x' into feat/gradle-managed-version-overrides
jamesfredley 90c1238
Merge branch '8.0.x' into feat/gradle-managed-version-overrides
jamesfredley a2363ae
Merge branch '8.0.x' into feat/gradle-managed-version-overrides
jamesfredley f0c1934
Merge branch '8.0.x' into feat/gradle-managed-version-overrides
jamesfredley 2ca302b
Extract BOM property overrides into a standalone Gradle plugin (PR #1…
jamesfredley bbf5e53
Fix GrailsDependencyValidatorPlugin to prefer enforcedPlatform BOM
jamesfredley 9204972
Merge branch '8.0.x' into feat/gradle-managed-version-overrides
jamesfredley 0178a10
Merge branch '8.0.x' into feat/gradle-managed-version-overrides
jamesfredley ba8459f
Merge branch '8.0.x' into feat/gradle-managed-version-overrides
jamesfredley e1f8fc8
Merge branch '8.0.x' into feat/gradle-managed-version-overrides
jamesfredley 5a7e6be
Merge branch '8.0.x' into feat/gradle-managed-version-overrides
jamesfredley 5254097
Address PR #15467 cosmetic review comments from matrei and jdaugherty
jamesfredley 7948432
Apply matrei's wording suggestion for grails-bom intro
jamesfredley e98b6a8
Merge remote-tracking branch 'origin/8.0.x' into feat/gradle-managed-…
jamesfredley d67ef28
Address review feedback: consolidate bom-property-overrides + def sty…
jamesfredley 931a54b
docs: document Spring DM removal in Grails 8 upgrade guide
jamesfredley 48de2b8
Address final 3 review threads + drop last Spring DM coupling
jamesfredley 8829323
chore: remove accidentally-committed local cruft from previous commit
jamesfredley 7194c66
Merge branch 'fix/8.0.x-merge-sb4-fallout' into feat/gradle-managed-v…
jamesfredley b59ce4f
Merge branch '8.0.x' into feat/gradle-managed-version-overrides
jamesfredley abd68cd
Merge branch '8.0.x' into feat/gradle-managed-version-overrides
jamesfredley be2c6af
Merge branch '8.0.x' into feat/gradle-managed-version-overrides
jamesfredley 545b847
fix: correct BOM property-override edge cases found in review
jamesfredley f1c76ac
docs: align BOM property-override docs with strict-constraint behavior
jamesfredley c2ac4a6
style: apply Groovy idioms from PR review feedback
jamesfredley 28302d4
Merge branch '8.0.x' into feat/gradle-managed-version-overrides
jamesfredley 20f3304
fix: parse BOM POMs with maven-model instead of custom XML parsing
jamesfredley f94480a
Merge branch '8.0.x' into feat/gradle-managed-version-overrides
jamesfredley bc933fa
Use maven-model to parse BOM POMs for property overrides
jamesfredley 6ef4ec2
Apply exactly one Grails BOM via a configurable grails.bom property
jamesfredley 59dcb7e
Add example apps covering the legacy Spring Dependency Management plugin
jamesfredley 8cba523
Restrict single-BOM detection to platform declarations
jamesfredley f63f028
Remove explanatory comment from the maven-model.version entry
jamesfredley 9bd7f11
Merge branch '8.0.x' into feat/gradle-managed-version-overrides
jamesfredley 76f44f5
Merge remote-tracking branch 'origin/8.0.x' into feat/gradle-managed-…
jamesfredley 179ae7d
fix: ignore documentation configuration when detecting the project BOM
jamesfredley File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 98 additions & 0 deletions
98
...ins/src/test/groovy/org/apache/grails/buildsrc/GrailsDependencyValidatorPluginSpec.groovy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * https://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
| package org.apache.grails.buildsrc | ||
|
|
||
| import org.gradle.api.GradleException | ||
| import org.gradle.api.Project | ||
| import org.gradle.testfixtures.ProjectBuilder | ||
| import spock.lang.Specification | ||
|
|
||
| class GrailsDependencyValidatorPluginSpec extends Specification { | ||
|
|
||
| private static Project rootWithBoms() { | ||
| Project root = ProjectBuilder.builder().withName('root').build() | ||
| ProjectBuilder.builder().withName('grails-bom').withParent(root).build() | ||
| ProjectBuilder.builder().withName('grails-micronaut-bom').withParent(root).build() | ||
| ProjectBuilder.builder().withName('grails-hibernate7-bom').withParent(root).build() | ||
| root | ||
| } | ||
|
|
||
| private static void addBomPlatform(Project project, String configuration, String bomPath) { | ||
| project.configurations.maybeCreate(configuration) | ||
| project.dependencies.add(configuration, | ||
| project.dependencies.platform(project.dependencies.project(path: bomPath))) | ||
| } | ||
|
|
||
| void "detectBomPath ignores the documentation configuration when a variant BOM is used elsewhere"() { | ||
| given: "a project that selects grails-micronaut-bom but inherits grails-bom on the shared documentation config" | ||
| Project root = rootWithBoms() | ||
| Project project = ProjectBuilder.builder().withName('grails-micronaut').withParent(root).build() | ||
| addBomPlatform(project, 'api', ':grails-micronaut-bom') | ||
| addBomPlatform(project, 'documentation', ':grails-bom') | ||
|
|
||
| expect: "the variant BOM wins and no conflict is reported" | ||
| GrailsDependencyValidatorPlugin.detectBomPath(project) == ':grails-micronaut-bom' | ||
| } | ||
|
|
||
| void "detectBomPath returns the single declared BOM"() { | ||
| given: "a default-variant project with grails-bom on both a real config and the documentation config" | ||
| Project root = rootWithBoms() | ||
| Project project = ProjectBuilder.builder().withName('grails-core').withParent(root).build() | ||
| addBomPlatform(project, 'implementation', ':grails-bom') | ||
| addBomPlatform(project, 'documentation', ':grails-bom') | ||
|
|
||
| expect: | ||
| GrailsDependencyValidatorPlugin.detectBomPath(project) == ':grails-bom' | ||
| } | ||
|
|
||
| void "detectBomPath returns null when no Grails BOM is declared"() { | ||
| given: | ||
| Project root = rootWithBoms() | ||
| Project project = ProjectBuilder.builder().withName('plain').withParent(root).build() | ||
| project.configurations.maybeCreate('implementation') | ||
|
|
||
| expect: | ||
| GrailsDependencyValidatorPlugin.detectBomPath(project) == null | ||
| } | ||
|
|
||
| void "detectBomPath returns null when only the documentation tooling configuration declares a BOM"() { | ||
| given: "a project whose sole BOM is the doc-tooling grails-bom on the documentation config" | ||
| Project root = rootWithBoms() | ||
| Project project = ProjectBuilder.builder().withName('docs-only').withParent(root).build() | ||
| addBomPlatform(project, 'documentation', ':grails-bom') | ||
|
|
||
| expect: "the doc-tooling BOM is ignored, so no project BOM is detected" | ||
| GrailsDependencyValidatorPlugin.detectBomPath(project) == null | ||
| } | ||
|
|
||
| void "detectBomPath fails when two distinct Grails BOMs are declared on real configurations"() { | ||
| given: "a genuine misconfiguration layering two variant BOMs on real dependency configurations" | ||
| Project root = rootWithBoms() | ||
| Project project = ProjectBuilder.builder().withName('misconfigured').withParent(root).build() | ||
| addBomPlatform(project, 'api', ':grails-micronaut-bom') | ||
| addBomPlatform(project, 'implementation', ':grails-hibernate7-bom') | ||
|
|
||
| when: | ||
| GrailsDependencyValidatorPlugin.detectBomPath(project) | ||
|
|
||
| then: | ||
| GradleException e = thrown(GradleException) | ||
| e.message.contains('declares more than one Grails BOM') | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I understand we're proposing to switch, don't we still need to offer this support to existing Grails apps? That means we should have a test app that uses it so we know we don't break anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we still have to apply the gradle plugin? Did you add a test app that uses the gradle plugin so we know historically if it will continue to work if manually applied? @jamesfredley
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added in 59dcb7e -
grails-test-examples/spring-dependency-management, a Grails app that appliesio.spring.dependency-managementby hand and importsgrails-bom. Its integration test boots the app and serves a request.