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


##########
grails-beans-dsl/src/main/java/org/grails/compiler/beans/GrailsBeansASTTransformation.java:
##########
@@ -324,9 +326,18 @@ private ClassNode createAutoConfigurationSibling(ClassNode 
pluginClass, Annotati
         sibling.addAnnotations(siblingAnnotations);
         pluginClass.getAnnotations().removeAll(siblingAnnotations);
 
+        // The name is settled here and nowhere else, so this is where it can 
be registered.
+        AutoConfigurationImportsWriter.register(siblingName, 
targetDirectory(source), source, compilationUnit);
+
         return sibling;
     }
 
+    /** The compiler's output directory, which is where generated metadata 
belongs. */
+    private static File targetDirectory(SourceUnit source) {
+        CompilerConfiguration configuration = source == null ? null : 
source.getConfiguration();
+        return configuration == null ? null : 
configuration.getTargetDirectory();

Review Comment:
   Correcting my earlier reply on this thread, which was wrong in two ways.
   
   It claimed the point was addressed. It was addressed for a descriptor whose 
`beans` closure is claimed by the convention, and not for one carrying 
`@GrailsBeans` explicitly: the local transform skipped its write, and the 
global transform registers from node metadata that is not set yet when it runs, 
because for an annotated descriptor the local transform runs afterwards. So 
under Groovy-Eclipse that descriptor was registered by neither path. I found 
that after replying, not before.
   
   It also described a mechanism that no longer exists. Rather than the name 
being carried out to a directory the global transform resolves, the directory 
is now carried in: the global transform seeds what it resolved onto every class 
of the source unit before anything is transformed, and the local transform 
prefers it over the compiler configuration. With a directory it can trust the 
local transform no longer skips, so `isEclipseSourceUnit` and its guard are 
gone, and the registration that read the metadata went with them - one call 
site, correct under both compilers. 512cc6f and d014214.
   
   Still not verified against a real Groovy-Eclipse build: the specification 
proves the seeded directory is preferred over the configured one, which is the 
mechanism, not the IDE. That helper has no test in this repository either.



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