Copilot commented on code in PR #16069:
URL: https://github.com/apache/grails-core/pull/16069#discussion_r3683083348
##########
gradle/functional-test-config.gradle:
##########
@@ -17,49 +17,53 @@
* under the License.
*/
-rootProject.subprojects
+def substitutableProjects = rootProject.subprojects
.findAll { !(it.name in testProjects) && !(it.name in docProjects) &&
!(it.name in cliProjects) }
- .each { project.evaluationDependsOn(it.path) }
+ .collect {
+ project.evaluationDependsOn(it.path)
+ return [
+ project: it,
+ artifactId: it.findProperty('pomArtifactId') ?: it.name,
+ cliArtifactId: it.findProperty('cliArtifactId')
+ ]
+ }
Review Comment:
`substitutableProjects` is no longer a collection of projects; it’s a
collection of maps with metadata. Consider renaming it (e.g., `substitutions`,
`substitutableProjectMetadata`) and renaming the map key `project` (e.g.,
`targetProject`) to avoid confusion with Gradle’s `project` object in this
script.
##########
gradle/functional-test-config.gradle:
##########
@@ -17,49 +17,53 @@
* under the License.
*/
-rootProject.subprojects
+def substitutableProjects = rootProject.subprojects
.findAll { !(it.name in testProjects) && !(it.name in docProjects) &&
!(it.name in cliProjects) }
- .each { project.evaluationDependsOn(it.path) }
+ .collect {
+ project.evaluationDependsOn(it.path)
+ return [
+ project: it,
+ artifactId: it.findProperty('pomArtifactId') ?: it.name,
+ cliArtifactId: it.findProperty('cliArtifactId')
+ ]
+ }
configurations.configureEach {
resolutionStrategy.dependencySubstitution {
// Test projects will often include dependencies from local projects.
This will ensure any dependencies
// included will be substituted with the local projects in this
repository instead of pulling upstream.
- for (def possibleProject : rootProject.subprojects) {
- if (!(possibleProject.name in testProjects) &&
!(possibleProject.name in docProjects) && !(possibleProject.name in
cliProjects)) {
- def artifactId = possibleProject.findProperty('pomArtifactId')
?: possibleProject.name
- def substitutedArtifact = "$possibleProject.group:$artifactId"
- //TODO: This does not handle libraries that are both test
fixtures & a libraries like grails-data-mongodb,
- // see grails-test-examples-mongodb-base, &
grails-test-examples-mongodb-hibernate5 for project() workaround
- if (possibleProject.name == 'grails-bom') {
- substitute module(substitutedArtifact) using
platform(project(':grails-bom'))
- }
- else if(possibleProject.name == 'grails-geb') {
- def selector = it.variant(module(substitutedArtifact)) {
VariantSelectionDetails details ->
- details.capabilities {
ModuleDependencyCapabilitiesHandler handler ->
-
handler.requireCapability("${substitutedArtifact}-test-fixtures" as String)
- }
- }
-
- def replacement =
it.variant(project(":$possibleProject.name")) { v ->
- v.capabilities {
it.requireCapability("${substitutedArtifact}-test-fixtures") }
+ for (def substitution : substitutableProjects) {
+ def possibleProject = substitution.project
+ def substitutedArtifact =
"$possibleProject.group:${substitution.artifactId}"
+ //TODO: This does not handle libraries that are both test fixtures
& a libraries like grails-data-mongodb,
Review Comment:
Grammar issue in the TODO comment: 'a libraries' should be singular.
##########
gradle/functional-test-config.gradle:
##########
@@ -17,49 +17,53 @@
* under the License.
*/
-rootProject.subprojects
+def substitutableProjects = rootProject.subprojects
.findAll { !(it.name in testProjects) && !(it.name in docProjects) &&
!(it.name in cliProjects) }
- .each { project.evaluationDependsOn(it.path) }
+ .collect {
+ project.evaluationDependsOn(it.path)
+ return [
+ project: it,
+ artifactId: it.findProperty('pomArtifactId') ?: it.name,
+ cliArtifactId: it.findProperty('cliArtifactId')
+ ]
+ }
Review Comment:
The explicit `return` inside the `collect { ... }` closure is unnecessary in
Groovy (the last expression is returned). Dropping it simplifies the closure
and makes the intent a bit clearer.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]