You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@grails.apache.org by "jamesfredley (via GitHub)" <gi...@apache.org> on 2026/07/05 00:21:22 UTC
[PR] Extract shared BOM build conventions [grails-core]
jamesfredley opened a new pull request, #15827:
URL: https://github.com/apache/grails-core/pull/15827
## Summary
- add a shared build-logic BOM conventions plugin for publication, POM customization, constraint extraction, and release snapshot validation
- apply the plugin across the Grails BOM build scripts
- collapse duplicated Groovy module override maps and remove unreachable BOM override branches
## Verification
- `JAVA_HOME=/tmp/opencode/jdk21 ./gradlew :build-logic-root:build-logic:compileGroovy :build-logic-root:build-logic:test`
- generated all seven BOM POMs on this branch and current `origin/8.0.x`, including Micronaut BOMs with `-PincludeMicronautProjects`, then byte-compared them successfully
- ran `extractConstraints` for all seven BOMs with `-PincludeMicronautProjects` and byte-compared generated constraints successfully
## Notes
- LSP diagnostics are unavailable locally for `.groovy` / `.gradle` because no Groovy/Gradle LSP is configured
- the full aggregate gate currently has unrelated baseline failures on `origin/8.0.x` (GraphQL static compile errors and MongoDB timeout flakes), reproduced in a clean baseline worktree
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Extract shared BOM build conventions [grails-core]
Posted by "jdaugherty (via GitHub)" <gi...@apache.org>.
jdaugherty commented on PR #15827:
URL: https://github.com/apache/grails-core/pull/15827#issuecomment-4997907714
@jamesfredley let me know when these changes are done and I can make a second pass at reviewing
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Extract shared BOM build conventions [grails-core]
Posted by "testlens-app[bot] (via GitHub)" <gi...@apache.org>.
testlens-app[bot] commented on PR #15827:
URL: https://github.com/apache/grails-core/pull/15827#issuecomment-4929805054
## β
All tests passed β
π·οΈ Commit: 23714e76ea920fcbec17283bee44f9d23d50e11f
βΆοΈ Tests: 6611 executed
βͺοΈ Checks: 59/59 completed
---
_Learn more about TestLens at [testlens.app](https://testlens.app)._
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Extract shared BOM build conventions [grails-core]
Posted by "borinquenkid (via GitHub)" <gi...@apache.org>.
borinquenkid commented on PR #15827:
URL: https://github.com/apache/grails-core/pull/15827#issuecomment-5208541359
@jamesfredley just a friendly nudge
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Extract shared BOM build conventions [grails-core]
Posted by "jdaugherty (via GitHub)" <gi...@apache.org>.
jdaugherty commented on code in PR #15827:
URL: https://github.com/apache/grails-core/pull/15827#discussion_r3555974767
##########
build-logic/plugins/src/main/groovy/org/apache/grails/buildsrc/BomConventionsPlugin.groovy:
##########
@@ -0,0 +1,261 @@
+/*
+ * 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 groovy.transform.CompileDynamic
+import groovy.transform.CompileStatic
+
+import org.gradle.api.GradleException
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+import org.gradle.api.Task
+import org.gradle.api.artifacts.Configuration
+import org.gradle.api.artifacts.Dependency
+import org.gradle.api.plugins.JavaPlatformExtension
+import org.gradle.api.tasks.TaskProvider
+
+import org.apache.grails.gradle.tasks.bom.ExtractDependenciesTask
+import org.apache.grails.gradle.tasks.bom.ExtractedDependencyConstraint
+import org.apache.grails.gradle.tasks.bom.PropertyNameCalculator
+
+@CompileStatic
+class BomConventionsPlugin implements Plugin<Project> {
+
+ private static final String BASE_CONSTRAINTS_FILE = 'grails-bom-constraints.adoc'
+
+ private static final Set<String> MICRONAUT_BOM_PROJECTS = [
+ 'grails-hibernate5-micronaut-bom',
+ 'grails-hibernate7-micronaut-bom',
+ 'grails-micronaut-bom',
+ ] as Set<String>
+
+ private static final Map<String, String> GRADLE_BUILD_PROJECTS = [
+ 'grails-gradle-plugins': 'org.apache.grails',
+ 'grails-gradle-model' : 'org.apache.grails.gradle',
+ 'grails-gradle-common' : 'org.apache.grails.gradle',
+ 'grails-gradle-tasks' : 'org.apache.grails',
+ ]
+
+ @Override
+ void apply(Project project) {
+ applyDependencyDefinitions(project)
+ configureCoordinates(project)
+ configureExtraProperties(project)
+ configurePomCustomization(project)
+
+ project.pluginManager.apply('java-platform')
+ project.extensions.configure(JavaPlatformExtension) { JavaPlatformExtension extension ->
+ extension.allowDependencies()
+ }
+ project.pluginManager.apply('org.apache.grails.buildsrc.publish')
+ project.pluginManager.apply('org.apache.grails.buildsrc.sbom')
+
+ configureBomDependencies(project)
+ configureExtractConstraints(project)
+ configureSnapshotValidation(project)
+ }
+
+ private static void applyDependencyDefinitions(Project project) {
+ project.apply([from: project.rootProject.layout.projectDirectory.file('dependencies.gradle')])
+ }
+
+ private static void configureCoordinates(Project project) {
+ project.version = project.findProperty('projectVersion')
Review Comment:
The extracted scripts used `version = projectVersion`, which fails with `MissingPropertyException` when `projectVersion` is not defined. `findProperty` returns null here, leaving `project.version` as `unspecified`; `projectCoordinateProperties()` and the POM customization then register coordinates like `org.apache.grails:grails-gradle-plugins:unspecified`, and version property replacement silently stops matching with no error. Suggest failing fast, e.g. `project.property('projectVersion')` or an explicit check.
##########
build-logic/plugins/src/main/groovy/org/apache/grails/buildsrc/BomConventionsPlugin.groovy:
##########
@@ -0,0 +1,261 @@
+/*
+ * 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 groovy.transform.CompileDynamic
+import groovy.transform.CompileStatic
+
+import org.gradle.api.GradleException
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+import org.gradle.api.Task
+import org.gradle.api.artifacts.Configuration
+import org.gradle.api.artifacts.Dependency
+import org.gradle.api.plugins.JavaPlatformExtension
+import org.gradle.api.tasks.TaskProvider
+
+import org.apache.grails.gradle.tasks.bom.ExtractDependenciesTask
+import org.apache.grails.gradle.tasks.bom.ExtractedDependencyConstraint
+import org.apache.grails.gradle.tasks.bom.PropertyNameCalculator
+
+@CompileStatic
+class BomConventionsPlugin implements Plugin<Project> {
+
+ private static final String BASE_CONSTRAINTS_FILE = 'grails-bom-constraints.adoc'
+
+ private static final Set<String> MICRONAUT_BOM_PROJECTS = [
+ 'grails-hibernate5-micronaut-bom',
+ 'grails-hibernate7-micronaut-bom',
+ 'grails-micronaut-bom',
+ ] as Set<String>
+
+ private static final Map<String, String> GRADLE_BUILD_PROJECTS = [
+ 'grails-gradle-plugins': 'org.apache.grails',
+ 'grails-gradle-model' : 'org.apache.grails.gradle',
+ 'grails-gradle-common' : 'org.apache.grails.gradle',
+ 'grails-gradle-tasks' : 'org.apache.grails',
+ ]
+
+ @Override
+ void apply(Project project) {
+ applyDependencyDefinitions(project)
+ configureCoordinates(project)
+ configureExtraProperties(project)
+ configurePomCustomization(project)
+
+ project.pluginManager.apply('java-platform')
+ project.extensions.configure(JavaPlatformExtension) { JavaPlatformExtension extension ->
+ extension.allowDependencies()
+ }
+ project.pluginManager.apply('org.apache.grails.buildsrc.publish')
+ project.pluginManager.apply('org.apache.grails.buildsrc.sbom')
+
+ configureBomDependencies(project)
+ configureExtractConstraints(project)
+ configureSnapshotValidation(project)
+ }
+
+ private static void applyDependencyDefinitions(Project project) {
+ project.apply([from: project.rootProject.layout.projectDirectory.file('dependencies.gradle')])
+ }
+
+ private static void configureCoordinates(Project project) {
+ project.version = project.findProperty('projectVersion')
+ project.group = 'org.apache.grails'
+ }
+
+ private static void configureExtraProperties(Project project) {
+ project.extensions.extraProperties.set('isReleaseBuild', System.getenv('GRAILS_PUBLISH_RELEASE') == 'true')
+ project.extensions.extraProperties.set(
+ 'isPublishedExternal',
+ System.getenv().containsKey('NEXUS_PUBLISH_STAGING_PROFILE_ID')
+ )
+ project.extensions.extraProperties.set('gradleBuildProjects', new LinkedHashMap<String, String>(GRADLE_BUILD_PROJECTS))
+ }
+
+ private static void configureBomDependencies(Project project) {
+ project.configurations.register('bomDependencies') { Configuration configuration ->
+ configuration.canBeResolved = true
+ configuration.transitive = true
+ configuration.extendsFrom(project.configurations.named('api').get())
+ }
+ }
+
+ private static void configureExtractConstraints(Project project) {
+ TaskProvider<ExtractDependenciesTask> extractConstraints = project.tasks.register(
+ 'extractConstraints',
+ ExtractDependenciesTask
+ ) { ExtractDependenciesTask task ->
+ task.captureProjectServices(project.dependencies, project.configurations)
+ task.setConfiguration(project.configurations.named('bomDependencies'))
+ task.destination.set(project.layout.buildDirectory.file(constraintsFileName(project)))
+ task.platformDefinitions.set(project.provider { getStringMap(project, 'combinedPlatforms') })
+ task.definitions.set(project.provider { getStringMap(project, 'combinedDependencies') })
+ task.projectName.set(project.name)
+ task.versions.set(project.provider { getStringMap(project, 'combinedVersions') })
+ task.autoRegisterTransitivePlatforms.set(MICRONAUT_BOM_PROJECTS.contains(project.name))
+
+ project.rootProject.subprojects.each { Project subproject ->
+ project.evaluationDependsOn(subproject.path)
+ }
+ task.projectArtifactIds.set(project.provider { projectArtifactIds(project) })
+ task.forcedGroupPrefixes.set(['org.apache.grails.profiles': 'grails-profile'])
+ task.projectCoordinateProperties.set(project.provider { projectCoordinateProperties(project) })
+ task.dependsOn('generateMetadataFileForMavenPublication', 'generatePomFileForMavenPublication')
+ }
+
+ project.tasks.named('check') { Task task ->
Review Comment:
This adds new lifecycle behavior that was not present in any of the extracted BOM scripts: `check` now runs `extractConstraints`, which also runs both publication generators and resolves the full BOM graph. `grails-doc:generateBomDocumentation` already invokes `extractConstraints` explicitly. It also makes a previously configuration-cache-compatible BOM check fail: `./gradlew :grails-base-bom:check --configuration-cache --rerun-tasks` reports unsupported serialization of `ConfigurationContainer`, `DependencyHandler`, and `Project`. Could we remove this `check` dependency and keep constraint extraction explicit?
##########
build-logic/plugins/src/main/groovy/org/apache/grails/buildsrc/BomConventionsPlugin.groovy:
##########
@@ -0,0 +1,261 @@
+/*
+ * 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 groovy.transform.CompileDynamic
+import groovy.transform.CompileStatic
+
+import org.gradle.api.GradleException
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+import org.gradle.api.Task
+import org.gradle.api.artifacts.Configuration
+import org.gradle.api.artifacts.Dependency
+import org.gradle.api.plugins.JavaPlatformExtension
+import org.gradle.api.tasks.TaskProvider
+
+import org.apache.grails.gradle.tasks.bom.ExtractDependenciesTask
+import org.apache.grails.gradle.tasks.bom.ExtractedDependencyConstraint
+import org.apache.grails.gradle.tasks.bom.PropertyNameCalculator
+
+@CompileStatic
+class BomConventionsPlugin implements Plugin<Project> {
+
+ private static final String BASE_CONSTRAINTS_FILE = 'grails-bom-constraints.adoc'
+
+ private static final Set<String> MICRONAUT_BOM_PROJECTS = [
+ 'grails-hibernate5-micronaut-bom',
+ 'grails-hibernate7-micronaut-bom',
+ 'grails-micronaut-bom',
+ ] as Set<String>
+
+ private static final Map<String, String> GRADLE_BUILD_PROJECTS = [
+ 'grails-gradle-plugins': 'org.apache.grails',
+ 'grails-gradle-model' : 'org.apache.grails.gradle',
+ 'grails-gradle-common' : 'org.apache.grails.gradle',
+ 'grails-gradle-tasks' : 'org.apache.grails',
+ ]
+
+ @Override
+ void apply(Project project) {
+ applyDependencyDefinitions(project)
+ configureCoordinates(project)
+ configureExtraProperties(project)
+ configurePomCustomization(project)
+
+ project.pluginManager.apply('java-platform')
+ project.extensions.configure(JavaPlatformExtension) { JavaPlatformExtension extension ->
+ extension.allowDependencies()
+ }
+ project.pluginManager.apply('org.apache.grails.buildsrc.publish')
+ project.pluginManager.apply('org.apache.grails.buildsrc.sbom')
+
+ configureBomDependencies(project)
+ configureExtractConstraints(project)
+ configureSnapshotValidation(project)
+ }
+
+ private static void applyDependencyDefinitions(Project project) {
+ project.apply([from: project.rootProject.layout.projectDirectory.file('dependencies.gradle')])
+ }
+
+ private static void configureCoordinates(Project project) {
+ project.version = project.findProperty('projectVersion')
+ project.group = 'org.apache.grails'
+ }
+
+ private static void configureExtraProperties(Project project) {
+ project.extensions.extraProperties.set('isReleaseBuild', System.getenv('GRAILS_PUBLISH_RELEASE') == 'true')
+ project.extensions.extraProperties.set(
+ 'isPublishedExternal',
+ System.getenv().containsKey('NEXUS_PUBLISH_STAGING_PROFILE_ID')
+ )
+ project.extensions.extraProperties.set('gradleBuildProjects', new LinkedHashMap<String, String>(GRADLE_BUILD_PROJECTS))
+ }
+
+ private static void configureBomDependencies(Project project) {
+ project.configurations.register('bomDependencies') { Configuration configuration ->
+ configuration.canBeResolved = true
+ configuration.transitive = true
+ configuration.extendsFrom(project.configurations.named('api').get())
+ }
+ }
+
+ private static void configureExtractConstraints(Project project) {
+ TaskProvider<ExtractDependenciesTask> extractConstraints = project.tasks.register(
+ 'extractConstraints',
+ ExtractDependenciesTask
+ ) { ExtractDependenciesTask task ->
+ task.captureProjectServices(project.dependencies, project.configurations)
+ task.setConfiguration(project.configurations.named('bomDependencies'))
+ task.destination.set(project.layout.buildDirectory.file(constraintsFileName(project)))
+ task.platformDefinitions.set(project.provider { getStringMap(project, 'combinedPlatforms') })
+ task.definitions.set(project.provider { getStringMap(project, 'combinedDependencies') })
+ task.projectName.set(project.name)
+ task.versions.set(project.provider { getStringMap(project, 'combinedVersions') })
+ task.autoRegisterTransitivePlatforms.set(MICRONAUT_BOM_PROJECTS.contains(project.name))
+
+ project.rootProject.subprojects.each { Project subproject ->
+ project.evaluationDependsOn(subproject.path)
+ }
+ task.projectArtifactIds.set(project.provider { projectArtifactIds(project) })
+ task.forcedGroupPrefixes.set(['org.apache.grails.profiles': 'grails-profile'])
+ task.projectCoordinateProperties.set(project.provider { projectCoordinateProperties(project) })
+ task.dependsOn('generateMetadataFileForMavenPublication', 'generatePomFileForMavenPublication')
+ }
+
+ project.tasks.named('check') { Task task ->
+ task.dependsOn(extractConstraints)
+ }
+ }
+
+ private static String constraintsFileName(Project project) {
+ project.name == 'grails-base-bom' ? BASE_CONSTRAINTS_FILE : "${project.name}-constraints.adoc"
+ }
+
+ private static Map<String, String> projectArtifactIds(Project project) {
+ Map<String, String> artifactIdMappings = [:]
+ project.rootProject.subprojects.each { Project subproject ->
+ artifactIdMappings[subproject.name] = (subproject.findProperty('pomArtifactId') ?: subproject.name).toString()
+ }
+
+ getGradleBuildProjects(project).each { String dependencyName, String dependencyGroup ->
+ artifactIdMappings[dependencyName] = dependencyName
+ }
+
+ artifactIdMappings
+ }
+
+ private static Map<String, String> projectCoordinateProperties(Project project) {
+ Map<String, String> projectCoordinates = [:]
+ project.rootProject.subprojects.each { Project subproject ->
+ String artifactId = (subproject.findProperty('pomArtifactId') ?: subproject.name).toString()
+ String baseVersionName = artifactId.replaceAll('[.]', '-')
+ projectCoordinates["${subproject.group}:${artifactId}:${subproject.version}".toString()] = baseVersionName
+ }
+
+ getGradleBuildProjects(project).each { String dependencyName, String dependencyGroup ->
+ projectCoordinates["${dependencyGroup}:${dependencyName}:${project.version}".toString()] = dependencyName
+ }
+
+ projectCoordinates
+ }
+
+ private static void configureSnapshotValidation(Project project) {
+ TaskProvider<Task> validateNoSnapshotDependencies = project.tasks.register('validateNoSnapshotDependencies') { Task task ->
+ task.group = 'publishing'
+ task.description = 'Validates that no snapshot dependencies are present in the project when performing a release.'
+
+ task.doLast {
+ project.configurations.each { Configuration configuration ->
+ configuration.allDependencies.each { Dependency dependency ->
+ if (dependency.version && dependency.version.contains('-SNAPSHOT')) {
+ throw new GradleException(
+ "Releases cannot have a snapshot dependency: ${dependency.group}:${dependency.name} (${dependency.version})"
+ )
+ }
+ }
+ }
+ }
+ }
+
+ if (project.extensions.extraProperties.get('isReleaseBuild') &&
+ project.extensions.extraProperties.get('isPublishedExternal')) {
+ project.tasks.matching { Task task ->
+ task.name in ['generateMetadataFileForMavenPublication', 'generatePomFileForMavenPublication']
Review Comment:
Behavior change from the extracted scripts: they used `afterEvaluate { tasks.named(...).configure { ... } }`, which throws `UnknownTaskException` if the publication tasks are missing. `tasks.matching { }.configureEach { }` silently no-ops if these tasks are never created (e.g. the publish plugin renames its publication), so on a real release the snapshot validation could silently not run. Since this guard only matters when `isReleaseBuild && isPublishedExternal`, consider asserting the tasks exist in that case rather than matching by name.
##########
build-logic/plugins/src/main/groovy/org/apache/grails/buildsrc/BomConventionsPlugin.groovy:
##########
@@ -0,0 +1,261 @@
+/*
+ * 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 groovy.transform.CompileDynamic
+import groovy.transform.CompileStatic
+
+import org.gradle.api.GradleException
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+import org.gradle.api.Task
+import org.gradle.api.artifacts.Configuration
+import org.gradle.api.artifacts.Dependency
+import org.gradle.api.plugins.JavaPlatformExtension
+import org.gradle.api.tasks.TaskProvider
+
+import org.apache.grails.gradle.tasks.bom.ExtractDependenciesTask
+import org.apache.grails.gradle.tasks.bom.ExtractedDependencyConstraint
+import org.apache.grails.gradle.tasks.bom.PropertyNameCalculator
+
+@CompileStatic
+class BomConventionsPlugin implements Plugin<Project> {
+
+ private static final String BASE_CONSTRAINTS_FILE = 'grails-bom-constraints.adoc'
+
+ private static final Set<String> MICRONAUT_BOM_PROJECTS = [
+ 'grails-hibernate5-micronaut-bom',
+ 'grails-hibernate7-micronaut-bom',
+ 'grails-micronaut-bom',
+ ] as Set<String>
+
+ private static final Map<String, String> GRADLE_BUILD_PROJECTS = [
+ 'grails-gradle-plugins': 'org.apache.grails',
+ 'grails-gradle-model' : 'org.apache.grails.gradle',
+ 'grails-gradle-common' : 'org.apache.grails.gradle',
+ 'grails-gradle-tasks' : 'org.apache.grails',
+ ]
+
+ @Override
+ void apply(Project project) {
+ applyDependencyDefinitions(project)
+ configureCoordinates(project)
+ configureExtraProperties(project)
+ configurePomCustomization(project)
+
+ project.pluginManager.apply('java-platform')
+ project.extensions.configure(JavaPlatformExtension) { JavaPlatformExtension extension ->
+ extension.allowDependencies()
+ }
+ project.pluginManager.apply('org.apache.grails.buildsrc.publish')
Review Comment:
We have not used aggregate plugins to date. These should be left on the individual projects (publish & sbom)
##########
build-logic/plugins/src/main/groovy/org/apache/grails/buildsrc/BomConventionsPlugin.groovy:
##########
@@ -0,0 +1,261 @@
+/*
+ * 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 groovy.transform.CompileDynamic
+import groovy.transform.CompileStatic
+
+import org.gradle.api.GradleException
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+import org.gradle.api.Task
+import org.gradle.api.artifacts.Configuration
+import org.gradle.api.artifacts.Dependency
+import org.gradle.api.plugins.JavaPlatformExtension
+import org.gradle.api.tasks.TaskProvider
+
+import org.apache.grails.gradle.tasks.bom.ExtractDependenciesTask
+import org.apache.grails.gradle.tasks.bom.ExtractedDependencyConstraint
+import org.apache.grails.gradle.tasks.bom.PropertyNameCalculator
+
+@CompileStatic
+class BomConventionsPlugin implements Plugin<Project> {
Review Comment:
I would rename this to GrailsBomPlugin
##########
build-logic/plugins/src/main/groovy/org/apache/grails/buildsrc/BomConventionsPlugin.groovy:
##########
@@ -0,0 +1,261 @@
+/*
+ * 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 groovy.transform.CompileDynamic
+import groovy.transform.CompileStatic
+
+import org.gradle.api.GradleException
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+import org.gradle.api.Task
+import org.gradle.api.artifacts.Configuration
+import org.gradle.api.artifacts.Dependency
+import org.gradle.api.plugins.JavaPlatformExtension
+import org.gradle.api.tasks.TaskProvider
+
+import org.apache.grails.gradle.tasks.bom.ExtractDependenciesTask
+import org.apache.grails.gradle.tasks.bom.ExtractedDependencyConstraint
+import org.apache.grails.gradle.tasks.bom.PropertyNameCalculator
+
+@CompileStatic
+class BomConventionsPlugin implements Plugin<Project> {
+
+ private static final String BASE_CONSTRAINTS_FILE = 'grails-bom-constraints.adoc'
+
+ private static final Set<String> MICRONAUT_BOM_PROJECTS = [
+ 'grails-hibernate5-micronaut-bom',
+ 'grails-hibernate7-micronaut-bom',
+ 'grails-micronaut-bom',
+ ] as Set<String>
+
+ private static final Map<String, String> GRADLE_BUILD_PROJECTS = [
+ 'grails-gradle-plugins': 'org.apache.grails',
+ 'grails-gradle-model' : 'org.apache.grails.gradle',
+ 'grails-gradle-common' : 'org.apache.grails.gradle',
+ 'grails-gradle-tasks' : 'org.apache.grails',
+ ]
+
+ @Override
+ void apply(Project project) {
+ applyDependencyDefinitions(project)
+ configureCoordinates(project)
+ configureExtraProperties(project)
+ configurePomCustomization(project)
+
+ project.pluginManager.apply('java-platform')
+ project.extensions.configure(JavaPlatformExtension) { JavaPlatformExtension extension ->
+ extension.allowDependencies()
+ }
+ project.pluginManager.apply('org.apache.grails.buildsrc.publish')
+ project.pluginManager.apply('org.apache.grails.buildsrc.sbom')
+
+ configureBomDependencies(project)
+ configureExtractConstraints(project)
+ configureSnapshotValidation(project)
+ }
+
+ private static void applyDependencyDefinitions(Project project) {
+ project.apply([from: project.rootProject.layout.projectDirectory.file('dependencies.gradle')])
+ }
+
+ private static void configureCoordinates(Project project) {
+ project.version = project.findProperty('projectVersion')
+ project.group = 'org.apache.grails'
+ }
+
+ private static void configureExtraProperties(Project project) {
+ project.extensions.extraProperties.set('isReleaseBuild', System.getenv('GRAILS_PUBLISH_RELEASE') == 'true')
+ project.extensions.extraProperties.set(
+ 'isPublishedExternal',
+ System.getenv().containsKey('NEXUS_PUBLISH_STAGING_PROFILE_ID')
+ )
+ project.extensions.extraProperties.set('gradleBuildProjects', new LinkedHashMap<String, String>(GRADLE_BUILD_PROJECTS))
+ }
+
+ private static void configureBomDependencies(Project project) {
+ project.configurations.register('bomDependencies') { Configuration configuration ->
+ configuration.canBeResolved = true
+ configuration.transitive = true
+ configuration.extendsFrom(project.configurations.named('api').get())
+ }
+ }
+
+ private static void configureExtractConstraints(Project project) {
+ TaskProvider<ExtractDependenciesTask> extractConstraints = project.tasks.register(
+ 'extractConstraints',
+ ExtractDependenciesTask
+ ) { ExtractDependenciesTask task ->
+ task.captureProjectServices(project.dependencies, project.configurations)
+ task.setConfiguration(project.configurations.named('bomDependencies'))
+ task.destination.set(project.layout.buildDirectory.file(constraintsFileName(project)))
+ task.platformDefinitions.set(project.provider { getStringMap(project, 'combinedPlatforms') })
+ task.definitions.set(project.provider { getStringMap(project, 'combinedDependencies') })
+ task.projectName.set(project.name)
+ task.versions.set(project.provider { getStringMap(project, 'combinedVersions') })
+ task.autoRegisterTransitivePlatforms.set(MICRONAUT_BOM_PROJECTS.contains(project.name))
+
+ project.rootProject.subprojects.each { Project subproject ->
+ project.evaluationDependsOn(subproject.path)
+ }
+ task.projectArtifactIds.set(project.provider { projectArtifactIds(project) })
+ task.forcedGroupPrefixes.set(['org.apache.grails.profiles': 'grails-profile'])
+ task.projectCoordinateProperties.set(project.provider { projectCoordinateProperties(project) })
+ task.dependsOn('generateMetadataFileForMavenPublication', 'generatePomFileForMavenPublication')
+ }
+
+ project.tasks.named('check') { Task task ->
+ task.dependsOn(extractConstraints)
+ }
+ }
+
+ private static String constraintsFileName(Project project) {
+ project.name == 'grails-base-bom' ? BASE_CONSTRAINTS_FILE : "${project.name}-constraints.adoc"
+ }
+
+ private static Map<String, String> projectArtifactIds(Project project) {
+ Map<String, String> artifactIdMappings = [:]
+ project.rootProject.subprojects.each { Project subproject ->
+ artifactIdMappings[subproject.name] = (subproject.findProperty('pomArtifactId') ?: subproject.name).toString()
+ }
+
+ getGradleBuildProjects(project).each { String dependencyName, String dependencyGroup ->
+ artifactIdMappings[dependencyName] = dependencyName
+ }
+
+ artifactIdMappings
+ }
+
+ private static Map<String, String> projectCoordinateProperties(Project project) {
+ Map<String, String> projectCoordinates = [:]
+ project.rootProject.subprojects.each { Project subproject ->
+ String artifactId = (subproject.findProperty('pomArtifactId') ?: subproject.name).toString()
+ String baseVersionName = artifactId.replaceAll('[.]', '-')
+ projectCoordinates["${subproject.group}:${artifactId}:${subproject.version}".toString()] = baseVersionName
+ }
+
+ getGradleBuildProjects(project).each { String dependencyName, String dependencyGroup ->
+ projectCoordinates["${dependencyGroup}:${dependencyName}:${project.version}".toString()] = dependencyName
+ }
+
+ projectCoordinates
+ }
+
+ private static void configureSnapshotValidation(Project project) {
+ TaskProvider<Task> validateNoSnapshotDependencies = project.tasks.register('validateNoSnapshotDependencies') { Task task ->
+ task.group = 'publishing'
+ task.description = 'Validates that no snapshot dependencies are present in the project when performing a release.'
+
+ task.doLast {
+ project.configurations.each { Configuration configuration ->
+ configuration.allDependencies.each { Dependency dependency ->
+ if (dependency.version && dependency.version.contains('-SNAPSHOT')) {
+ throw new GradleException(
+ "Releases cannot have a snapshot dependency: ${dependency.group}:${dependency.name} (${dependency.version})"
+ )
+ }
+ }
+ }
+ }
+ }
+
+ if (project.extensions.extraProperties.get('isReleaseBuild') &&
+ project.extensions.extraProperties.get('isPublishedExternal')) {
+ project.tasks.matching { Task task ->
+ task.name in ['generateMetadataFileForMavenPublication', 'generatePomFileForMavenPublication']
+ }.configureEach { Task task ->
+ task.dependsOn(validateNoSnapshotDependencies)
+ }
+ }
+ }
+
+ private static void configurePomCustomization(Project project) {
+ project.extensions.extraProperties.set('pomCustomization', createPomCustomization(project))
+ }
+
+ @CompileDynamic
+ private static Closure createPomCustomization(Project project) {
+ { xml ->
+ def root = xml.asNode()
+
+ def propertiesNode = root.properties ? root.properties[0] : root.appendNode('properties')
+
+ def depMgmt = root.dependencyManagement?.getAt(0)
+ def deps = depMgmt?.dependencies?.getAt(0)
+ if (deps) {
+ PropertyNameCalculator propertyNameCalculator = new PropertyNameCalculator(
+ getStringMap(project, 'combinedPlatforms'),
+ getStringMap(project, 'combinedDependencies'),
+ getStringMap(project, 'combinedVersions')
+ )
+ propertyNameCalculator.addForcedGroupPrefix('org.apache.grails.profiles', 'grails-profile')
+ propertyNameCalculator.addProjects(project.rootProject.subprojects)
+ getGradleBuildProjects(project).each { String gradleArtifactId, String dependencyGroup ->
+ propertyNameCalculator.addProject(
+ dependencyGroup,
+ gradleArtifactId,
+ project.version as String,
+ gradleArtifactId
+ )
+ }
+
+ Map<String, String> pomProperties = [:]
+ deps.dependency.each { dep ->
+ String groupId = dep.groupId.text().trim()
+ String artifactId = dep.artifactId.text().trim()
+ boolean isBom = dep.scope.text().trim() == 'import'
+
+ String inlineVersion = dep.version.text().trim()
+ if (inlineVersion == 'null') {
+ inlineVersion = null
+ }
+
+ if (inlineVersion) {
+ ExtractedDependencyConstraint extractedConstraint = propertyNameCalculator.calculate(
+ groupId,
+ artifactId,
+ inlineVersion,
+ isBom
+ )
+ if (extractedConstraint?.versionPropertyReference) {
+ dep.version[0].value = extractedConstraint.versionPropertyReference
+ pomProperties.put(extractedConstraint.versionPropertyName, inlineVersion)
+ }
+ } else if (!inlineVersion) {
Review Comment:
`else if (!inlineVersion)` is always true at this point β carried over from the original scripts, but since this code was rewritten anyway, a plain `else` would be clearer.
##########
build-logic/plugins/src/main/groovy/org/apache/grails/buildsrc/BomConventionsPlugin.groovy:
##########
@@ -0,0 +1,261 @@
+/*
+ * 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 groovy.transform.CompileDynamic
+import groovy.transform.CompileStatic
+
+import org.gradle.api.GradleException
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+import org.gradle.api.Task
+import org.gradle.api.artifacts.Configuration
+import org.gradle.api.artifacts.Dependency
+import org.gradle.api.plugins.JavaPlatformExtension
+import org.gradle.api.tasks.TaskProvider
+
+import org.apache.grails.gradle.tasks.bom.ExtractDependenciesTask
+import org.apache.grails.gradle.tasks.bom.ExtractedDependencyConstraint
+import org.apache.grails.gradle.tasks.bom.PropertyNameCalculator
+
+@CompileStatic
+class BomConventionsPlugin implements Plugin<Project> {
+
+ private static final String BASE_CONSTRAINTS_FILE = 'grails-bom-constraints.adoc'
+
+ private static final Set<String> MICRONAUT_BOM_PROJECTS = [
+ 'grails-hibernate5-micronaut-bom',
+ 'grails-hibernate7-micronaut-bom',
+ 'grails-micronaut-bom',
+ ] as Set<String>
+
+ private static final Map<String, String> GRADLE_BUILD_PROJECTS = [
+ 'grails-gradle-plugins': 'org.apache.grails',
+ 'grails-gradle-model' : 'org.apache.grails.gradle',
+ 'grails-gradle-common' : 'org.apache.grails.gradle',
+ 'grails-gradle-tasks' : 'org.apache.grails',
+ ]
+
+ @Override
+ void apply(Project project) {
+ applyDependencyDefinitions(project)
+ configureCoordinates(project)
+ configureExtraProperties(project)
+ configurePomCustomization(project)
+
+ project.pluginManager.apply('java-platform')
+ project.extensions.configure(JavaPlatformExtension) { JavaPlatformExtension extension ->
+ extension.allowDependencies()
+ }
+ project.pluginManager.apply('org.apache.grails.buildsrc.publish')
+ project.pluginManager.apply('org.apache.grails.buildsrc.sbom')
+
+ configureBomDependencies(project)
+ configureExtractConstraints(project)
+ configureSnapshotValidation(project)
+ }
+
+ private static void applyDependencyDefinitions(Project project) {
+ project.apply([from: project.rootProject.layout.projectDirectory.file('dependencies.gradle')])
Review Comment:
The difference between this and before is it was applied in the buildscript so it was available in all contexts. I think this is ok, but it's important to note the difference.
##########
dependencies.gradle:
##########
@@ -20,6 +20,18 @@
// This file provides the 'grails-bom' dependencies, while grails-gradle/dependencies.gradle provides the 'grails-gradle-bom' dependencies
// These files are split to facilitate separation of build vs application dependencies. These are the application dependencies.
+static Map<String, String> groovyModuleDependencies(String groovyVersion) {
+ [
+ '', '-ant', '-astbuilder', '-cli-commons', '-cli-picocli', '-console', '-contracts', '-datetime',
Review Comment:
This is harder to read and should be reverted. the standard of this file is to list the dependencies. these extractions make it harder to maintain
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Extract shared BOM build conventions [grails-core]
Posted by "testlens-app[bot] (via GitHub) via notifications" <no...@grails.apache.org>.
testlens-app[bot] commented on PR #15827:
URL: https://github.com/apache/grails-core/pull/15827#issuecomment-6991829903
## π No tests executed π
π·οΈ Commit: c168af12e2aa057ff0878ec59dcb86c9fa3b86ee
βΆοΈ Tests: 0 executed
βͺοΈ Checks: 46/46 completed
---
_Learn more about TestLens at [testlens.app/docs](https://testlens.app/docs/features/pr-comment/)._
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Extract shared BOM build conventions [grails-core]
Posted by "jamesfredley (via GitHub)" <gi...@apache.org>.
jamesfredley commented on code in PR #15827:
URL: https://github.com/apache/grails-core/pull/15827#discussion_r3524955309
##########
build-logic/plugins/src/main/groovy/org/apache/grails/buildsrc/BomConventionsPlugin.groovy:
##########
@@ -0,0 +1,261 @@
+/*
+ * 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 groovy.transform.CompileDynamic
+import groovy.transform.CompileStatic
+
+import org.gradle.api.GradleException
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+import org.gradle.api.Task
+import org.gradle.api.artifacts.Configuration
+import org.gradle.api.artifacts.Dependency
+import org.gradle.api.plugins.JavaPlatformExtension
+import org.gradle.api.tasks.TaskProvider
+
+import org.apache.grails.gradle.tasks.bom.ExtractDependenciesTask
+import org.apache.grails.gradle.tasks.bom.ExtractedDependencyConstraint
+import org.apache.grails.gradle.tasks.bom.PropertyNameCalculator
+
+@CompileStatic
+class BomConventionsPlugin implements Plugin<Project> {
+
+ private static final String BASE_CONSTRAINTS_FILE = 'grails-bom-constraints.adoc'
+
+ private static final Set<String> MICRONAUT_BOM_PROJECTS = [
+ 'grails-hibernate5-micronaut-bom',
+ 'grails-hibernate7-micronaut-bom',
+ 'grails-micronaut-bom',
+ ] as Set<String>
+
+ private static final Map<String, String> GRADLE_BUILD_PROJECTS = [
+ 'grails-gradle-plugins': 'org.apache.grails',
+ 'grails-gradle-model' : 'org.apache.grails.gradle',
+ 'grails-gradle-common' : 'org.apache.grails.gradle',
+ 'grails-gradle-tasks' : 'org.apache.grails',
+ ]
+
+ @Override
+ void apply(Project project) {
+ applyDependencyDefinitions(project)
+ configureCoordinates(project)
+ configureExtraProperties(project)
+ configurePomCustomization(project)
+
+ project.pluginManager.apply('java-platform')
+ project.extensions.configure(JavaPlatformExtension) { JavaPlatformExtension extension ->
+ extension.allowDependencies()
+ }
+ project.pluginManager.apply('org.apache.grails.buildsrc.publish')
+ project.pluginManager.apply('org.apache.grails.buildsrc.sbom')
+
+ configureBomDependencies(project)
+ configureExtractConstraints(project)
+ configureSnapshotValidation(project)
+ }
+
+ private static void applyDependencyDefinitions(Project project) {
+ project.apply([from: project.rootProject.layout.projectDirectory.file('dependencies.gradle')])
+ }
+
+ private static void configureCoordinates(Project project) {
+ project.version = project.findProperty('projectVersion')
+ project.group = 'org.apache.grails'
+ }
+
+ private static void configureExtraProperties(Project project) {
+ project.extensions.extraProperties.set('isReleaseBuild', System.getenv('GRAILS_PUBLISH_RELEASE') == 'true')
+ project.extensions.extraProperties.set(
+ 'isPublishedExternal',
+ System.getenv().containsKey('NEXUS_PUBLISH_STAGING_PROFILE_ID')
+ )
+ project.extensions.extraProperties.set('gradleBuildProjects', new LinkedHashMap<String, String>(GRADLE_BUILD_PROJECTS))
+ }
+
+ private static void configureBomDependencies(Project project) {
+ project.configurations.register('bomDependencies') { Configuration configuration ->
+ configuration.canBeResolved = true
+ configuration.transitive = true
+ configuration.extendsFrom(project.configurations.named('api').get())
+ }
+ }
+
+ private static void configureExtractConstraints(Project project) {
+ TaskProvider<ExtractDependenciesTask> extractConstraints = project.tasks.register(
+ 'extractConstraints',
+ ExtractDependenciesTask
+ ) { ExtractDependenciesTask task ->
+ task.captureProjectServices(project.dependencies, project.configurations)
+ task.setConfiguration(project.configurations.named('bomDependencies'))
+ task.destination.set(project.layout.buildDirectory.file(constraintsFileName(project)))
+ task.platformDefinitions.set(project.provider { getStringMap(project, 'combinedPlatforms') })
+ task.definitions.set(project.provider { getStringMap(project, 'combinedDependencies') })
+ task.projectName.set(project.name)
+ task.versions.set(project.provider { getStringMap(project, 'combinedVersions') })
+ task.autoRegisterTransitivePlatforms.set(MICRONAUT_BOM_PROJECTS.contains(project.name))
+
+ project.rootProject.subprojects.each { Project subproject ->
+ project.evaluationDependsOn(subproject.path)
+ }
+ task.projectArtifactIds.set(project.provider { projectArtifactIds(project) })
+ task.forcedGroupPrefixes.set(['org.apache.grails.profiles': 'grails-profile'])
+ task.projectCoordinateProperties.set(project.provider { projectCoordinateProperties(project) })
+ task.dependsOn('generateMetadataFileForMavenPublication', 'generatePomFileForMavenPublication')
+ }
+
+ project.tasks.named('check') { Task task ->
+ task.dependsOn(extractConstraints)
+ }
+ }
+
+ private static String constraintsFileName(Project project) {
+ project.name == 'grails-base-bom' ? BASE_CONSTRAINTS_FILE : "${project.name}-constraints.adoc"
+ }
+
+ private static Map<String, String> projectArtifactIds(Project project) {
+ Map<String, String> artifactIdMappings = [:]
+ project.rootProject.subprojects.each { Project subproject ->
+ artifactIdMappings[subproject.name] = (subproject.findProperty('pomArtifactId') ?: subproject.name).toString()
+ }
+
+ getGradleBuildProjects(project).each { String dependencyName, String dependencyGroup ->
+ artifactIdMappings[dependencyName] = dependencyName
+ }
+
+ artifactIdMappings
+ }
+
+ private static Map<String, String> projectCoordinateProperties(Project project) {
+ Map<String, String> projectCoordinates = [:]
+ project.rootProject.subprojects.each { Project subproject ->
+ String artifactId = (subproject.findProperty('pomArtifactId') ?: subproject.name).toString()
+ String baseVersionName = artifactId.replaceAll('[.]', '-')
+ projectCoordinates["${subproject.group}:${artifactId}:${subproject.version}".toString()] = baseVersionName
+ }
+
+ getGradleBuildProjects(project).each { String dependencyName, String dependencyGroup ->
+ projectCoordinates["${dependencyGroup}:${dependencyName}:${project.version}".toString()] = dependencyName
+ }
+
+ projectCoordinates
+ }
+
+ private static void configureSnapshotValidation(Project project) {
+ TaskProvider<Task> validateNoSnapshotDependencies = project.tasks.register('validateNoSnapshotDependencies') { Task task ->
+ task.group = 'publishing'
+ task.description = 'Validates that no snapshot dependencies are present in the project when performing a release.'
+
+ task.doLast {
+ project.configurations.each { Configuration configuration ->
+ configuration.allDependencies.each { Dependency dependency ->
+ if (dependency.version && dependency.version.contains('-SNAPSHOT')) {
+ throw new GradleException(
+ "Releases cannot have a snapshot dependency: ${dependency.group}:${dependency.name} (${dependency.version})"
+ )
+ }
+ }
+ }
+ }
+ }
+
+ if (project.extensions.extraProperties.get('isReleaseBuild') &&
+ project.extensions.extraProperties.get('isPublishedExternal')) {
+ project.tasks.matching { Task task ->
+ task.name in ['generateMetadataFileForMavenPublication', 'generatePomFileForMavenPublication']
+ }.configureEach { Task task ->
+ task.dependsOn(validateNoSnapshotDependencies)
+ }
+ }
+ }
+
+ private static void configurePomCustomization(Project project) {
+ project.extensions.extraProperties.set('pomCustomization', createPomCustomization(project))
+ }
+
+ @CompileDynamic
+ private static Closure createPomCustomization(Project project) {
+ { xml ->
+ def root = xml.asNode()
+
+ def propertiesNode = root.properties ? root.properties[0] : root.appendNode('properties')
+
+ def depMgmt = root.dependencyManagement?.getAt(0)
+ def deps = depMgmt?.dependencies?.getAt(0)
+ if (deps) {
+ PropertyNameCalculator propertyNameCalculator = new PropertyNameCalculator(
+ getStringMap(project, 'combinedPlatforms'),
+ getStringMap(project, 'combinedDependencies'),
+ getStringMap(project, 'combinedVersions')
+ )
+ propertyNameCalculator.addForcedGroupPrefix('org.apache.grails.profiles', 'grails-profile')
+ propertyNameCalculator.addProjects(project.rootProject.subprojects)
+ for (String gradleArtifactId : project.ext.gradleBuildProjects) {
+ propertyNameCalculator.addProject(
+ 'org.apache.grails.gradle',
+ gradleArtifactId,
+ project.version as String,
+ gradleArtifactId
+ )
+ }
Review Comment:
Fixed in 206a4b6129 by iterating the configured gradleBuildProjects map and passing each artifact-specific group into PropertyNameCalculator.addProject. The regenerated base BOM POM now emits version properties for the Gradle-build artifacts, and the constraints output remains unchanged versus the 8.0.x baseline.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Extract shared BOM build conventions [grails-core]
Posted by "testlens-app[bot] (via GitHub)" <gi...@apache.org>.
testlens-app[bot] commented on PR #15827:
URL: https://github.com/apache/grails-core/pull/15827#issuecomment-4884355514
## π¨ TestLens detected 1 failed test π¨
Here is what you can do:
1) Inspect the test failures carefully.
2) If you are convinced that some of the tests are flaky, you can mute them below.
3) Finally, trigger a rerun by checking the rerun checkbox.
### Test Summary
#### [CI / Build Grails-Core \(windows-latest, 25\)](https://github.com/apache/grails-core/actions/runs/28724228854/job/85178600658?pr=15827) > :grails-shell-cli:test
| Test | Runs |
|---|---|
| RunningApplicationProcessSpec > stop terminates a running process and removes the PID file | β |
π·οΈ Commit: fc7349fa2847993871611a2081bf4f4f4b2d6e79
βΆοΈ Tests: 37519 executed
π‘ Checks: 33/40 completed
### Test Failures
<details>
<summary><strong>RunningApplicationProcessSpec > stop terminates a running process and removes the PID file</strong> (:grails-shell-cli:test in <a href="https://github.com/apache/grails-core/actions/runs/28724228854/job/85178600658?pr=15827">CI / Build Grails-Core (windows-latest, 25)</a>)</summary>
```
Condition not satisfied:
!process.isAlive()
|| |
|| true
|Process[pid=5944, exitValue=1]
false
at org.grails.cli.gradle.RunningApplicationProcessSpec.stop terminates a running process and removes the PID file(RunningApplicationProcessSpec.groovy:217)
```
</details>
### Muted Tests
> [!NOTE]
> Checks are currently running using the configuration below.
Select tests to mute in this pull request:
π² RunningApplicationProcessSpec > stop terminates a running process and removes the PID file <!-- uniqueId=[engine:spock]/[spec:org.grails.cli.gradle.RunningApplicationProcessSpec]/[feature:$spock_feature_0_13] -->
Reuse successful test results:
π² β»οΈ Only rerun the tests that failed or were muted before
Click the checkbox to trigger a rerun:
π² **Rerun jobs**
---
_Learn more about TestLens at [testlens.app](https://testlens.app)._
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Extract shared BOM build conventions [grails-core]
Posted by "testlens-app[bot] (via GitHub)" <gi...@apache.org>.
testlens-app[bot] commented on PR #15827:
URL: https://github.com/apache/grails-core/pull/15827#issuecomment-4938614624
## β
All tests passed β
π·οΈ Commit: 7749b58839232d9f068085e34bcdacec04f8d80e
βΆοΈ Tests: 19099 executed
βͺοΈ Checks: 59/59 completed
---
_Learn more about TestLens at [testlens.app](https://testlens.app)._
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Extract shared BOM build conventions [grails-core]
Posted by "testlens-app[bot] (via GitHub)" <gi...@apache.org>.
testlens-app[bot] commented on PR #15827:
URL: https://github.com/apache/grails-core/pull/15827#issuecomment-4886273378
## π¨ TestLens detected 1 failed test π¨
Here is what you can do:
1) Inspect the test failures carefully.
2) If you are convinced that some of the tests are flaky, you can mute them below.
3) Finally, trigger a rerun by checking the rerun checkbox.
### Test Summary
#### [CI / Functional Tests \(Java 25, indy\=false\)](https://github.com/apache/grails-core/actions/runs/28741985300/job/85226271319?pr=15827) > :grails-test-examples-gorm:integrationTest
| Test | Runs |
|---|---|
| DirtyCheckBindingSpec > an explicit bindable:true id constraint declared on a \@DirtyCheck base is inherited and binds over HTTP | β |
π·οΈ Commit: 206a4b612939e0c61a37bb4042c6976569e3b697
βΆοΈ Tests: 11746 executed
π‘ Checks: 21/39 completed
### Test Failures
<details>
<summary><strong>DirtyCheckBindingSpec > an explicit bindable:true id constraint declared on a @DirtyCheck base is inherited and binds over HTTP</strong> (:grails-test-examples-gorm:integrationTest in <a href="https://github.com/apache/grails-core/actions/runs/28741985300/job/85226271319?pr=15827">CI / Functional Tests (Java 25, indy=false)</a>)</summary>
```
groovy.lang.MissingPropertyException: No such property: FORM for class: gorm.DirtyCheckBindingSpec
at gorm.DirtyCheckBindingSpec.an explicit bindable:true id constraint declared on a @DirtyCheck base is inherited and binds over HTTP(DirtyCheckBindingSpec.groovy:83)
```
</details>
### Muted Tests
> [!NOTE]
> Checks are currently running using the configuration below.
Select tests to mute in this pull request:
π² DirtyCheckBindingSpec > an explicit bindable:true id constraint declared on a \@DirtyCheck base is inherited and binds over HTTP <!-- uniqueId=[engine:spock]/[spec:gorm.DirtyCheckBindingSpec]/[feature:$spock_feature_0_2] -->
Reuse successful test results:
π² β»οΈ Only rerun the tests that failed or were muted before
Click the checkbox to trigger a rerun:
π² **Rerun jobs**
---
_Learn more about TestLens at [testlens.app](https://testlens.app)._
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Extract shared BOM build conventions [grails-core]
Posted by "testlens-app[bot] (via GitHub)" <gi...@apache.org>.
testlens-app[bot] commented on PR #15827:
URL: https://github.com/apache/grails-core/pull/15827#issuecomment-4931668238
## β
All tests passed β
π·οΈ Commit: e2a24979f1e25615042d5a6d7599bb4c633c76e1
βΆοΈ Tests: 17522 executed
βͺοΈ Checks: 59/59 completed
---
_Learn more about TestLens at [testlens.app](https://testlens.app)._
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Extract shared BOM build conventions [grails-core]
Posted by "jamesfredley (via GitHub)" <gi...@apache.org>.
jamesfredley commented on PR #15827:
URL: https://github.com/apache/grails-core/pull/15827#issuecomment-4997826317
The Gradle-technical points are valid - I'll address them:
- **`.matching { }.configureEach { }`** - agreed this is the main issue. It silently no-ops if the publication tasks are never created (e.g. the publish plugin renames its publication), so on a real release the snapshot validation could silently not run. Since that guard only matters when `isReleaseBuild && isPublishedExternal`, I'll assert the tasks exist in that case rather than matching by name.
- **`check` -> `extractConstraints` lifecycle** - I'll remove it and keep constraint extraction explicit (`grails-doc:generateBomDocumentation` already invokes it). As you noted it also breaks the previously configuration-cache-compatible BOM check (`ConfigurationContainer`/`DependencyHandler`/`Project` serialization).
- **`projectVersion` handling** - fail fast (`project.property('projectVersion')` / explicit check) instead of letting `findProperty` return null and silently producing `:unspecified` coordinates.
- **Rename to `GrailsBomPlugin`**, and **keep `publish` & `sbom` on the individual projects** rather than an aggregate plugin (matching existing convention).
- **`else if (!inlineVersion)`** - simplify to a plain `else`.
- Noted your point that the buildscript-vs-plugin application difference (line 73) is OK but worth calling out.
On **`dependencies.gradle`** - fair. The standard for that file is a flat, readable list of dependencies, and the extractions make it harder to maintain. I'll revert the `dependencies.gradle` extraction and keep the flat listing.
Net: this becomes a smaller, lazier convention-plugin extraction (the parts that genuinely dedupe the BOM build logic) without the `dependencies.gradle` churn, the aggregate-plugin behavior, or the non-lazy `.matching`/`check`-hook changes. I'll push the rework.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Extract shared BOM build conventions [grails-core]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #15827:
URL: https://github.com/apache/grails-core/pull/15827#issuecomment-4884340328
## [Codecov](https://app.codecov.io/gh/apache/grails-core/pull/15827?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 49.5648%. Comparing base ([`9702f00`](https://app.codecov.io/gh/apache/grails-core/commit/9702f0056f19066e4aae78e9590afc975847a1c3?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`fc7349f`](https://app.codecov.io/gh/apache/grails-core/commit/fc7349fa2847993871611a2081bf4f4f4b2d6e79?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
<details><summary>Additional details and impacted files</summary>
[](https://app.codecov.io/gh/apache/grails-core/pull/15827?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
```diff
@@ Coverage Diff @@
## 8.0.x #15827 +/- ##
==================================================
- Coverage 49.5680% 49.5648% -0.0032%
+ Complexity 16689 16688 -1
==================================================
Files 1947 1947
Lines 92598 92598
Branches 16179 16179
==================================================
- Hits 45899 45896 -3
- Misses 39598 39601 +3
Partials 7101 7101
```
[see 3 files with indirect coverage changes](https://app.codecov.io/gh/apache/grails-core/pull/15827/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
</details>
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Extract shared BOM build conventions [grails-core]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #15827:
URL: https://github.com/apache/grails-core/pull/15827#discussion_r3524051876
##########
build-logic/plugins/src/main/groovy/org/apache/grails/buildsrc/BomConventionsPlugin.groovy:
##########
@@ -0,0 +1,261 @@
+/*
+ * 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 groovy.transform.CompileDynamic
+import groovy.transform.CompileStatic
+
+import org.gradle.api.GradleException
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+import org.gradle.api.Task
+import org.gradle.api.artifacts.Configuration
+import org.gradle.api.artifacts.Dependency
+import org.gradle.api.plugins.JavaPlatformExtension
+import org.gradle.api.tasks.TaskProvider
+
+import org.apache.grails.gradle.tasks.bom.ExtractDependenciesTask
+import org.apache.grails.gradle.tasks.bom.ExtractedDependencyConstraint
+import org.apache.grails.gradle.tasks.bom.PropertyNameCalculator
+
+@CompileStatic
+class BomConventionsPlugin implements Plugin<Project> {
+
+ private static final String BASE_CONSTRAINTS_FILE = 'grails-bom-constraints.adoc'
+
+ private static final Set<String> MICRONAUT_BOM_PROJECTS = [
+ 'grails-hibernate5-micronaut-bom',
+ 'grails-hibernate7-micronaut-bom',
+ 'grails-micronaut-bom',
+ ] as Set<String>
+
+ private static final Map<String, String> GRADLE_BUILD_PROJECTS = [
+ 'grails-gradle-plugins': 'org.apache.grails',
+ 'grails-gradle-model' : 'org.apache.grails.gradle',
+ 'grails-gradle-common' : 'org.apache.grails.gradle',
+ 'grails-gradle-tasks' : 'org.apache.grails',
+ ]
+
+ @Override
+ void apply(Project project) {
+ applyDependencyDefinitions(project)
+ configureCoordinates(project)
+ configureExtraProperties(project)
+ configurePomCustomization(project)
+
+ project.pluginManager.apply('java-platform')
+ project.extensions.configure(JavaPlatformExtension) { JavaPlatformExtension extension ->
+ extension.allowDependencies()
+ }
+ project.pluginManager.apply('org.apache.grails.buildsrc.publish')
+ project.pluginManager.apply('org.apache.grails.buildsrc.sbom')
+
+ configureBomDependencies(project)
+ configureExtractConstraints(project)
+ configureSnapshotValidation(project)
+ }
+
+ private static void applyDependencyDefinitions(Project project) {
+ project.apply([from: project.rootProject.layout.projectDirectory.file('dependencies.gradle')])
+ }
+
+ private static void configureCoordinates(Project project) {
+ project.version = project.findProperty('projectVersion')
+ project.group = 'org.apache.grails'
+ }
+
+ private static void configureExtraProperties(Project project) {
+ project.extensions.extraProperties.set('isReleaseBuild', System.getenv('GRAILS_PUBLISH_RELEASE') == 'true')
+ project.extensions.extraProperties.set(
+ 'isPublishedExternal',
+ System.getenv().containsKey('NEXUS_PUBLISH_STAGING_PROFILE_ID')
+ )
+ project.extensions.extraProperties.set('gradleBuildProjects', new LinkedHashMap<String, String>(GRADLE_BUILD_PROJECTS))
+ }
+
+ private static void configureBomDependencies(Project project) {
+ project.configurations.register('bomDependencies') { Configuration configuration ->
+ configuration.canBeResolved = true
+ configuration.transitive = true
+ configuration.extendsFrom(project.configurations.named('api').get())
+ }
+ }
+
+ private static void configureExtractConstraints(Project project) {
+ TaskProvider<ExtractDependenciesTask> extractConstraints = project.tasks.register(
+ 'extractConstraints',
+ ExtractDependenciesTask
+ ) { ExtractDependenciesTask task ->
+ task.captureProjectServices(project.dependencies, project.configurations)
+ task.setConfiguration(project.configurations.named('bomDependencies'))
+ task.destination.set(project.layout.buildDirectory.file(constraintsFileName(project)))
+ task.platformDefinitions.set(project.provider { getStringMap(project, 'combinedPlatforms') })
+ task.definitions.set(project.provider { getStringMap(project, 'combinedDependencies') })
+ task.projectName.set(project.name)
+ task.versions.set(project.provider { getStringMap(project, 'combinedVersions') })
+ task.autoRegisterTransitivePlatforms.set(MICRONAUT_BOM_PROJECTS.contains(project.name))
+
+ project.rootProject.subprojects.each { Project subproject ->
+ project.evaluationDependsOn(subproject.path)
+ }
+ task.projectArtifactIds.set(project.provider { projectArtifactIds(project) })
+ task.forcedGroupPrefixes.set(['org.apache.grails.profiles': 'grails-profile'])
+ task.projectCoordinateProperties.set(project.provider { projectCoordinateProperties(project) })
+ task.dependsOn('generateMetadataFileForMavenPublication', 'generatePomFileForMavenPublication')
+ }
+
+ project.tasks.named('check') { Task task ->
+ task.dependsOn(extractConstraints)
+ }
+ }
+
+ private static String constraintsFileName(Project project) {
+ project.name == 'grails-base-bom' ? BASE_CONSTRAINTS_FILE : "${project.name}-constraints.adoc"
+ }
+
+ private static Map<String, String> projectArtifactIds(Project project) {
+ Map<String, String> artifactIdMappings = [:]
+ project.rootProject.subprojects.each { Project subproject ->
+ artifactIdMappings[subproject.name] = (subproject.findProperty('pomArtifactId') ?: subproject.name).toString()
+ }
+
+ getGradleBuildProjects(project).each { String dependencyName, String dependencyGroup ->
+ artifactIdMappings[dependencyName] = dependencyName
+ }
+
+ artifactIdMappings
+ }
+
+ private static Map<String, String> projectCoordinateProperties(Project project) {
+ Map<String, String> projectCoordinates = [:]
+ project.rootProject.subprojects.each { Project subproject ->
+ String artifactId = (subproject.findProperty('pomArtifactId') ?: subproject.name).toString()
+ String baseVersionName = artifactId.replaceAll('[.]', '-')
+ projectCoordinates["${subproject.group}:${artifactId}:${subproject.version}".toString()] = baseVersionName
+ }
+
+ getGradleBuildProjects(project).each { String dependencyName, String dependencyGroup ->
+ projectCoordinates["${dependencyGroup}:${dependencyName}:${project.version}".toString()] = dependencyName
+ }
+
+ projectCoordinates
+ }
+
+ private static void configureSnapshotValidation(Project project) {
+ TaskProvider<Task> validateNoSnapshotDependencies = project.tasks.register('validateNoSnapshotDependencies') { Task task ->
+ task.group = 'publishing'
+ task.description = 'Validates that no snapshot dependencies are present in the project when performing a release.'
+
+ task.doLast {
+ project.configurations.each { Configuration configuration ->
+ configuration.allDependencies.each { Dependency dependency ->
+ if (dependency.version && dependency.version.contains('-SNAPSHOT')) {
+ throw new GradleException(
+ "Releases cannot have a snapshot dependency: ${dependency.group}:${dependency.name} (${dependency.version})"
+ )
+ }
+ }
+ }
+ }
+ }
+
+ if (project.extensions.extraProperties.get('isReleaseBuild') &&
+ project.extensions.extraProperties.get('isPublishedExternal')) {
+ project.tasks.matching { Task task ->
+ task.name in ['generateMetadataFileForMavenPublication', 'generatePomFileForMavenPublication']
+ }.configureEach { Task task ->
+ task.dependsOn(validateNoSnapshotDependencies)
+ }
+ }
+ }
+
+ private static void configurePomCustomization(Project project) {
+ project.extensions.extraProperties.set('pomCustomization', createPomCustomization(project))
+ }
+
+ @CompileDynamic
+ private static Closure createPomCustomization(Project project) {
+ { xml ->
+ def root = xml.asNode()
+
+ def propertiesNode = root.properties ? root.properties[0] : root.appendNode('properties')
+
+ def depMgmt = root.dependencyManagement?.getAt(0)
+ def deps = depMgmt?.dependencies?.getAt(0)
+ if (deps) {
+ PropertyNameCalculator propertyNameCalculator = new PropertyNameCalculator(
+ getStringMap(project, 'combinedPlatforms'),
+ getStringMap(project, 'combinedDependencies'),
+ getStringMap(project, 'combinedVersions')
+ )
+ propertyNameCalculator.addForcedGroupPrefix('org.apache.grails.profiles', 'grails-profile')
+ propertyNameCalculator.addProjects(project.rootProject.subprojects)
+ for (String gradleArtifactId : project.ext.gradleBuildProjects) {
+ propertyNameCalculator.addProject(
+ 'org.apache.grails.gradle',
+ gradleArtifactId,
+ project.version as String,
+ gradleArtifactId
+ )
+ }
Review Comment:
In pom customization, `gradleBuildProjects` is a `Map<String,String>` (artifactId -> group). Iterating it as `for (String gradleArtifactId : project.ext.gradleBuildProjects)` will iterate map entries (not keys) and also hard-codes the group to `org.apache.grails.gradle`, ignoring the per-artifact group mapping. This prevents `PropertyNameCalculator` from registering the correct coordinates for these Gradle-build artifacts, so their dependency versions wonβt be replaced with version properties in the generated POM.
##########
build-logic/plugins/src/main/groovy/org/apache/grails/buildsrc/BomConventionsPlugin.groovy:
##########
@@ -0,0 +1,261 @@
+/*
+ * 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 groovy.transform.CompileDynamic
+import groovy.transform.CompileStatic
+
+import org.gradle.api.GradleException
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+import org.gradle.api.Task
+import org.gradle.api.artifacts.Configuration
+import org.gradle.api.artifacts.Dependency
+import org.gradle.api.plugins.JavaPlatformExtension
+import org.gradle.api.tasks.TaskProvider
+
+import org.apache.grails.gradle.tasks.bom.ExtractDependenciesTask
+import org.apache.grails.gradle.tasks.bom.ExtractedDependencyConstraint
+import org.apache.grails.gradle.tasks.bom.PropertyNameCalculator
+
+@CompileStatic
+class BomConventionsPlugin implements Plugin<Project> {
+
+ private static final String BASE_CONSTRAINTS_FILE = 'grails-bom-constraints.adoc'
Review Comment:
This introduces a new Gradle plugin (`BomConventionsPlugin`) with non-trivial behavior (task registration, POM XML mutation, snapshot validation) but no accompanying TestKit/Spock coverage in `build-logic/plugins` (where other plugins already have specs). Adding at least a minimal GradleRunner-based test would help prevent regressions across the multiple BOM builds that now depend on this shared logic.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org