bito-code-review[bot] commented on PR #16082:
URL: https://github.com/apache/grails-core/pull/16082#issuecomment-5158597257
<!-- Bito Reply -->
The `cleanStaleRuntimeCommandResources` task is indeed configured with
`outputs.upToDateWhen { false }`, which forces it to run every build. This task
is wired into `processResources` and `jar` tasks, causing them to be
invalidated and re-run unnecessarily. To improve this, you can make the cleanup
conditional by checking for the existence of non-hand-authored files before
deletion, or by using a more granular task input/output definition that only
triggers when stale files are actually present.
**grails-gradle/plugins/src/main/groovy/org/grails/gradle/plugin/core/GrailsPluginGradlePlugin.groovy**
```
TaskProvider cleanStaleRuntimeCommands = project.tasks
.register('cleanStaleRuntimeCommandResources') {
Task cleanTask ->
File commandsDir = new
File(processResources.destinationDir, 'META-INF/commands')
cleanTask.outputs.upToDateWhen {
!commandsDir.exists() || commandsDir.list().length == 0 }
cleanTask.doLast {
project.delete(commandsDir)
}
}
```
--
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]