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


##########
grails-gradle/plugins/src/main/groovy/org/grails/gradle/plugin/core/GrailsGradlePlugin.groovy:
##########
@@ -768,4 +770,49 @@ class GrailsGradlePlugin extends GroovyPlugin {
         }
         fileCollection
     }
+
+    /**
+     * Configures a task to verify that essential Grails project directories 
exist and creates them if missing.
+     *
+     * This method registers a task named 'verifyGrailsProjectDirectories' 
that creates the following
+     * directories if they do not already exist:
+     * - grails-app/services
+     * - grails-app/domain
+     * - grails-app/taglib
+     * - grails-app/migrations
+     *
+     * Additionally, it sets up dependencies for tasks 
'prepareKotlinBuildScriptModel' and
+     * 'cleanGroovyCompilerConfig' to ensure that the directories are verified 
before these tasks run.
+     *
+     * @param project The Gradle project for which the directories are 
verified and tasks are configured.
+     */
+    private void verifyGrailsProjectDirectories(Project project) {
+        TaskProvider<Task> verifyGrailsProjectDirectoriesTask = 
project.tasks.register('verifyGrailsProjectDirectories')
+
+        def grailsProjectDirectories = ['grails-app/services', 
'grails-app/domain',
+                                 'grails-app/taglib', 'grails-app/migrations']
+
+        verifyGrailsProjectDirectoriesTask.configure { Task task ->
+            task.group = 'build'
+            task.description = 'Ensures essential Grails project directories 
exist and creates them if missing.'
+            task.doFirst {
+                grailsProjectDirectories.each { String dir ->

Review Comment:
   I don't think you need to check if the directory exists, you can just call 
project.mkdir(dir):
   
           grailsProjectDirectories.each { project.mkdir(it) }



-- 
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: commits-unsubscr...@grails.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to