jdaugherty commented on code in PR #16224:
URL: https://github.com/apache/grails-core/pull/16224#discussion_r3903596307


##########
grails-core/src/test/groovy/org/grails/compiler/injection/GlobalGrailsClassInjectorTransformationSpec.groovy:
##########
@@ -349,6 +349,71 @@ class GlobalGrailsClassInjectorTransformationSpec extends 
Specification {
 
         then: "the property is consumed by the transform, unlike the two cases 
above"
             classNode.getProperty('beans') == null
+
+        and: "the name settled by the local transform is registered at the 
global transform's target"
+            new File(targetDir,
+                    
'META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports').text.trim()
 ==
+                    'DslBeansAutoConfiguration'
+    }
+
+    void "the implicit beans convention claims the closure of a descriptor 
that is not a Plugin"() {

Review Comment:
   Every end-to-end case here goes through the implicit convention; the 
explicit `@GrailsBeans` entry path - where the local transform runs after this 
transform and picks up the seeded directory - has no coverage at this level. A 
descriptor carrying both `@grails.compiler.beans.GrailsBeans` and 
`@AutoConfiguration`, compiled through `compileToFile`, ends up with the 
imports file holding the sibling's name at the target directory (I ran exactly 
that and it passes), so it is a cheap add that pins the second of the two entry 
paths through the real pipeline. It cannot discriminate the seeded directory 
from the compiler-configuration fallback - only Groovy-Eclipse diverges there, 
as the writer spec's mechanism test already notes - but it would catch the 
explicit path silently registering nothing, which is the regression d014214's 
earlier shape actually had.



##########
grails-beans-dsl/src/test/groovy/org/grails/compiler/beans/AutoConfigurationImportsWriterSpec.groovy:
##########
@@ -0,0 +1,356 @@
+/*
+ *  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.grails.compiler.beans
+
+import org.codehaus.groovy.ast.ClassNode
+import org.codehaus.groovy.classgen.GeneratorContext
+import org.codehaus.groovy.control.CompilationUnit
+import org.codehaus.groovy.control.CompilerConfiguration
+import org.codehaus.groovy.control.Phases
+import org.codehaus.groovy.control.SourceUnit
+import org.codehaus.groovy.control.SourceUnit

Review Comment:
   Duplicate import - `org.codehaus.groovy.control.SourceUnit` is already 
imported on the line above. (`codeStyle` does not catch it, I checked.)



##########
grails-beans-dsl/src/main/java/org/grails/compiler/beans/GrailsBeansASTTransformation.java:
##########
@@ -324,9 +339,27 @@ private ClassNode createAutoConfigurationSibling(ClassNode 
pluginClass, Annotati
         sibling.addAnnotations(siblingAnnotations);
         pluginClass.getAnnotations().removeAll(siblingAnnotations);
 
+        // The name is settled here and nowhere else.
+        
pluginClass.putNodeMetaData(GENERATED_AUTO_CONFIGURATION_NAME_METADATA, 
siblingName);

Review Comment:
   With the global transform's registration gone, nothing reads 
`GENERATED_AUTO_CONFIGURATION_NAME_METADATA` any more - this write and the 
constant are the only references left in the repository, and the constant's 
javadoc still describes the removed mechanism ("carrying the generated 
sibling's binary name to the global transform"). Either drop the constant and 
this write, or keep it as a deliberate hook for tooling and reword the javadoc 
to say so.



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