sbglasius commented on code in PR #15118:
URL: https://github.com/apache/grails-core/pull/15118#discussion_r2411638367
##########
grails-gradle/plugins/src/main/groovy/org/grails/gradle/plugin/core/GrailsGradlePlugin.groovy:
##########
@@ -226,17 +226,47 @@ class GrailsGradlePlugin extends GroovyPlugin {
protected Closure<String> getGroovyCompilerScript(GroovyCompile compile,
Project project) {
GrailsExtension grails = project.extensions.findByType(GrailsExtension)
- if (!grails.importJavaTime) {
+
+ List<String> starImports = []
+
+ // Add java.time if enabled
+ if (grails.importJavaTime) {
+ starImports.add('java.time')
+ }
+
+ // Add Grails annotation packages if enabled and dependencies are
present
+ if (grails.importGrailsAnnotations) {
+ // Check for grails-datamapping-core (grails.gorm.annotation.*)
+ def datamappingCoreDep =
project.configurations.getByName('compileClasspath').dependencies.find {
Dependency d ->
+ d.group == 'org.apache.grails.data' && d.name ==
'grails-datamapping-core'
+ }
+ if (datamappingCoreDep) {
+ starImports.add('grails.gorm.annotation')
+ }
+
+ // Check for grails-scaffolding
(grails.plugin.scaffolding.annotation.*)
+ def scaffoldingDep =
project.configurations.getByName('compileClasspath').dependencies.find {
Dependency d ->
+ d.group == 'org.apache.grails' && d.name ==
'grails-scaffolding'
+ }
+ if (scaffoldingDep) {
+ starImports.add('grails.plugin.scaffolding.annotation')
+ }
Review Comment:
While I understand why you added it while at it, this technically does not
have anything to do with time.
It should probably be in a subsequent PR?
--
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]