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


##########
build-logic/plugins/src/main/groovy/org/apache/grails/buildsrc/CompilePlugin.groovy:
##########
@@ -83,11 +83,27 @@ class CompilePlugin implements Plugin<Project> {
                     'Implementation-Version': lookupPropertyByType(project, 
'grailsVersion', String),
                     'Implementation-Vendor': 'grails.apache.org'
             )
+            if (!jar.archiveClassifier.present) {
+                jar.manifest.attributes('Automatic-Module-Name': 
automaticModuleName(project))
+            }

Review Comment:
   `jar.archiveClassifier.present` is typically true even when the classifier 
is the empty string for the main `jar` task, so this condition will likely skip 
setting `Automatic-Module-Name` for the primary artifact. Check for an empty 
classifier value instead (so it applies to the main jar but not 
`sourcesJar`/`javadocJar`).



##########
build-logic/plugins/src/test/groovy/org/apache/grails/buildsrc/CompilePluginSpec.groovy:
##########
@@ -0,0 +1,43 @@
+/*
+ *  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.testfixtures.ProjectBuilder
+import spock.lang.Specification
+
+class CompilePluginSpec extends Specification {
+
+    void 'automatic module name is derived from group and project name'() {

Review Comment:
   The new behavior that adds `Automatic-Module-Name` to the main jar manifest 
isn’t covered by tests yet (this spec only asserts the name-derivation helper). 
Add a test that applies the plugin to a real project (ProjectBuilder or 
TestKit), runs/configures the `jar` task, and asserts the manifest contains 
`Automatic-Module-Name` for the main jar but not for `sourcesJar`/`javadocJar`.



##########
grails-doc/src/en/guide/upgrading/automaticModuleNames.adoc:
##########
@@ -0,0 +1,7 @@
+=== Automatic module names
+
+Grails 8.1 starts publishing `Automatic-Module-Name` manifest entries for the 
main framework jars produced by the shared compile convention.

Review Comment:
   This upgrade note says “Grails 8.1”, but the PR description states it 
targets `8.0.x`. Please align the documented version with the actual 
release/branch this change will ship in (or phrase it more generally as “Grails 
8”).



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