matrei commented on code in PR #15055:
URL: https://github.com/apache/grails-core/pull/15055#discussion_r2334591659
##########
grails-gradle/plugins/src/main/groovy/org/grails/gradle/plugin/core/GrailsGradlePlugin.groovy:
##########
@@ -512,6 +512,8 @@ class GrailsGradlePlugin extends GroovyPlugin {
for (String f in grailsAppResourceDirs) {
grailsResourceDirs.add(project.file("grails-app/${f}"))
}
+ // force a defined order for build reproducibility
+ grailsResourceDirs.sort { File a, File b -> a.name <=> b.name }
Review Comment:
`.sort` returns the list, so the return on the next line is redundant.
Possible simplification of method:
```groovy
@CompileStatic
protected List<File> resolveGrailsResourceDirs1(Project project) {
['src/main/resources']
.addAll(grailsAppResourceDirs.collect { 'grails-app/' + it })
.collect { project.file(it) }
.sort { it.name } // sort for build reproducibility
}
```
##########
grails-gradle/plugins/src/main/groovy/org/grails/gradle/plugin/core/GrailsGradlePlugin.groovy:
##########
@@ -527,6 +529,8 @@ class GrailsGradlePlugin extends GroovyPlugin {
}
}
grailsSourceDirs.add(project.file('src/main/groovy'))
+ // force a defined order for build reproducibility
+ grailsSourceDirs.sort { File a, File b -> a.name <=> b.name }
grailsSourceDirs
Review Comment:
Same here that `.sort` already returns the list.
Possible simplification:
```groovy
grailsSourceDirs
.tap { add(project.file('src/main/groovy')) }
.sort { it.name } // sort for build reproducibility
```
--
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]