Copilot commented on code in PR #15334:
URL: https://github.com/apache/grails-core/pull/15334#discussion_r2723001706


##########
grails-shell-cli/src/main/groovy/org/grails/cli/profile/commands/CreateAppCommand.groovy:
##########
@@ -505,6 +499,30 @@ class CreateAppCommand extends ArgumentCompletingCommand 
implements ProfileRepos
         }
     }
 
+    private List<GrailsGradleRepository> createRepositoryList(List<String> 
baseRepositories) {
+        List<GrailsGradleRepository> configuredRepositories = []
+        String overrideRepo = System.getProperty('grails.repo.url') ?: 
System.getenv('GRAILS_REPO_URL')
+        if (overrideRepo) {
+            List<String> overrideRepos = Arrays.stream(overrideRepo.split(';'))
+                    .map(String::trim)
+                    .filter(s -> !s.isEmpty())
+                    .toList()
+            for (String overrideUrl : overrideRepos) {
+                System.out.println("Grails repo url override detected, 
including repo: ${overrideUrl}")
+                configuredRepositories.add(new GrailsGradleRepository(url: 
overrideUrl))
+            }
+        }
+        for (String repoUrl : baseRepositories) {
+            configuredRepositories.add(new GrailsGradleRepository(url: 
repoUrl))
+        }
+        if (variables['grails.version'].endsWith('-SNAPSHOT')) {
+            GrailsGradleRepository repository = new 
GrailsGradleRepository(url: 
'https://repository.apache.org/content/groups/snapshots', snapshotsOnly: true)
+            repository.includeOnly('org[.]apache[.](grails|groovy).*', '.*', 
'.*-SNAPSHOT')
+            configuredRepositories.add(repository)
+        }
+        configuredRepositories.unique()

Review Comment:
   The method `createRepositoryList` is missing a return statement. The method 
is declared to return `List<GrailsGradleRepository>` but only calls 
`configuredRepositories.unique()` without returning the result. This will cause 
the method to return null, leading to potential NullPointerException when the 
result is used later.



##########
build-logic/plugins/src/main/groovy/org/apache/grails/buildsrc/GrailsRepoSettingsPlugin.groovy:
##########
@@ -0,0 +1,113 @@
+/*
+ *  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.Plugin
+import org.gradle.api.artifacts.dsl.RepositoryHandler
+import org.gradle.api.initialization.Settings
+import org.gradle.api.initialization.resolve.DependencyResolutionManagement
+import org.gradle.api.initialization.resolve.RepositoriesMode
+import org.gradle.plugin.management.PluginManagementSpec
+
+class GrailsRepoSettingsPlugin implements Plugin<Settings> {
+
+    @Override
+    void apply(Settings target) {
+        target.pluginManagement { PluginManagementSpec manager ->
+            manager.repositories { RepositoryHandler repo ->
+                if (System.getenv('GRAILS_INCLUDE_MAVEN_LOCAL')) {
+                    repo.mavenLocal()
+                }
+                repo.mavenCentral()
+                repo.gradlePluginPortal()
+                repo.maven {
+                    url = 
'https://repository.apache.org/content/groups/snapshots'
+                    content {
+                        
it.includeVersionByRegex('org[.]apache[.]grails[.]gradle.*', '.*', 
'.*-SNAPSHOT')
+                    }
+                    mavenContent {
+                        it.snapshotsOnly()
+                    }
+                }
+                repo.maven {
+                    url = 
'https://central.sonatype.com/repository/maven-snapshots'
+                    content {
+                        it.includeVersionByRegex('cloud[.]wondrify.*', '.*', 
'.*-SNAPSHOT')
+                    }
+                    mavenContent {
+                        it.snapshotsOnly()
+                    }
+                }
+                repo.maven {
+                    url = 
'https://repository.apache.org/content/groups/staging'
+                    content {
+                        
it.includeModuleByRegex('org[.]apache[.]grails[.]gradle', 'grails-publish')
+                        it.includeModuleByRegex('org[.]apache[.]groovy', 
'groovy.*')
+                    }
+                    mavenContent {
+                        it.releasesOnly()
+                    }
+                }
+            }
+        }
+
+        target.dependencyResolutionManagement { DependencyResolutionManagement 
manager ->
+            
manager.repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
+            manager.repositories { RepositoryHandler repo ->
+                if (System.getenv('GRAILS_INCLUDE_MAVEN_LOCAL')) {
+                    repo.mavenLocal()
+                }
+                repo.maven {
+                    url = 'https://repo.grails.org/grails/restricted'
+                    mavenContent {
+                        it.releasesOnly()
+                    }
+                }
+                repo.maven {
+                    url = 
'https://repository.apache.org/content/groups/snapshots'
+                    content {
+                        it.includeVersionByRegex('org[.]apache[.]grails.*', 
'.*', '.*-SNAPSHOT')
+                        it.includeVersionByRegex('org[.]apache[.]groovy.*', 
'.*', '.*-SNAPSHOT')
+                    }
+                    mavenContent {
+                        it.snapshotsOnly()
+                    }
+                }
+                repo.maven {
+                    url = 
'https://central.sonatype.com/repository/maven-snapshots'
+                    content {
+                        it.includeVersionByRegex('cloud[.]wondrify.*', '.*', 
'.*-SNAPSHOT')
+                    }
+                    mavenContent {
+                        it.snapshotsOnly()
+                    }
+                }
+                repo.maven {
+                    url = 
'https://repository.apache.org/content/groups/staging'
+                    content {
+                        
it.includeModuleByRegex('org[.]apache[.]grails[.]gradle', 'grails-publish')
+                        it.includeModuleByRegex('org[.]apache[.]groovy[.]geb', 
'geb.*')
+                        it.includeModuleByRegex('org[.]apache[.]groovy', 
'groovy.*')
+                    }
+                    mavenContent {
+                        it.releasesOnly()
+                    }
+                }
+            }

Review Comment:
   The `dependencyResolutionManagement` configuration in the new 
`GrailsRepoSettingsPlugin` is missing a call to `repo.mavenCentral()`. Looking 
at the removed configurations in other settings.gradle files, they included 
`mavenCentral()` in the dependency resolution management. This could cause 
dependency resolution failures if dependencies are not available in the other 
configured repositories.



##########
grails-shell-cli/src/main/groovy/org/grails/cli/profile/commands/CreateAppCommand.groovy:
##########
@@ -505,6 +499,30 @@ class CreateAppCommand extends ArgumentCompletingCommand 
implements ProfileRepos
         }
     }
 
+    private List<GrailsGradleRepository> createRepositoryList(List<String> 
baseRepositories) {
+        List<GrailsGradleRepository> configuredRepositories = []
+        String overrideRepo = System.getProperty('grails.repo.url') ?: 
System.getenv('GRAILS_REPO_URL')
+        if (overrideRepo) {
+            List<String> overrideRepos = Arrays.stream(overrideRepo.split(';'))
+                    .map(String::trim)
+                    .filter(s -> !s.isEmpty())
+                    .toList()
+            for (String overrideUrl : overrideRepos) {
+                System.out.println("Grails repo url override detected, 
including repo: ${overrideUrl}")
+                configuredRepositories.add(new GrailsGradleRepository(url: 
overrideUrl))
+            }
+        }
+        for (String repoUrl : baseRepositories) {
+            configuredRepositories.add(new GrailsGradleRepository(url: 
repoUrl))
+        }
+        if (variables['grails.version'].endsWith('-SNAPSHOT')) {
+            GrailsGradleRepository repository = new 
GrailsGradleRepository(url: 
'https://repository.apache.org/content/groups/snapshots', snapshotsOnly: true)
+            repository.includeOnly('org[.]apache[.](grails|groovy).*', '.*', 
'.*-SNAPSHOT')

Review Comment:
   The regex pattern `'org[.]apache[.](grails|groovy).*'` uses alternation with 
parentheses, which should be escaped as `\(` and `\)` in a regex pattern. 
However, since this is being passed to Gradle's `includeVersionByRegex` method, 
it's unclear if the parentheses are intended as grouping in the regex or as 
literal characters. Looking at similar patterns elsewhere in the codebase 
(e.g., GradleRepository.java lines 61-64), the pattern is split into separate 
filters: one for `org[.]apache[.]grails.*` and another for 
`org[.]apache[.]groovy.*`. Consider using the same approach for consistency and 
correctness.



##########
.github/workflows/release-notes.yml:
##########
@@ -29,7 +29,7 @@ on:
   workflow_dispatch:
 # queue jobs and only allow 1 run per branch due to the likelihood of hitting 
GitHub resource limits
 concurrency:
-  group: ${{ github.workflow }}-${{ github.ref }}
+  group: release-pipeline

Review Comment:
   The concurrency group for the release-notes workflow has been changed from 
`${{ github.workflow }}-${{ github.ref }}` to `release-pipeline`, which is the 
same as the release workflow. This means both workflows will now share the same 
concurrency group. This could cause unintended queueing behavior where the 
release-notes workflow (triggered by push/PR events) blocks or is blocked by 
the release workflow (triggered by release events). The original configuration 
used a branch-specific concurrency group which allowed parallel execution 
across branches. Consider using distinct concurrency groups for these workflows 
or reverting to the branch-specific pattern.
   ```suggestion
     group: ${{ github.workflow }}-${{ github.ref }}
   ```



-- 
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]

Reply via email to