Skip to content

Commit 48ce16e

Browse files
authored
Merge pull request #14946 from apache/reproducibleViewRegistry
#14930 - make views reproducible by sorting views always
2 parents 7d06b75 + e8506da commit 48ce16e

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

grails-core/src/main/groovy/org/grails/compiler/injection/GlobalGrailsClassInjectorTransformation.groovy

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import grails.util.GrailsNameUtils
2828
import groovy.transform.CompilationUnitAware
2929
import groovy.transform.CompileDynamic
3030
import groovy.transform.CompileStatic
31+
import org.springframework.core.CollectionFactory
3132
import groovy.xml.MarkupBuilder
3233
import groovy.xml.StreamingMarkupBuilder
3334
import groovy.xml.XmlSlurper
@@ -191,7 +192,8 @@ class GlobalGrailsClassInjectorTransformation implements ASTTransformation, Comp
191192
if (Modifier.isAbstract(classNode.getModifiers())) return false
192193

193194
def classNodeName = classNode.name
194-
def props = new Properties()
195+
// Use SortedProperties to ensure a consistent order of entries for reproducible builds
196+
def props = CollectionFactory.createSortedProperties(false)
195197
def superTypeName = superType.getName()
196198

197199
// generate META-INF/grails.factories

grails-gsp/core/src/main/groovy/org/grails/gsp/compiler/GroovyPageCompiler.groovy

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ import org.grails.gsp.GroovyPageMetaInfo
3030
import org.grails.gsp.compiler.transform.GroovyPageInjectionOperation
3131
import org.grails.taglib.encoder.OutputEncodingSettings
3232
import groovy.transform.CompileStatic
33+
import org.springframework.core.CollectionFactory
34+
3335
import java.util.concurrent.Callable
3436
import java.util.concurrent.Executors
3537
import java.util.concurrent.ExecutorService
@@ -148,7 +150,8 @@ class GroovyPageCompiler {
148150
// write the view registry to a properties file (this is read by GroovyPagesTemplateEngine at runtime)
149151
File viewregistryFile = new File(targetDir, "gsp/views.properties")
150152
viewregistryFile.parentFile.mkdirs()
151-
Properties views = new Properties()
153+
// Use SortedProperties to ensure a consistent order of entries for reproducible builds
154+
Properties views = CollectionFactory.createSortedProperties(false)
152155
if (viewregistryFile.exists()) {
153156
// only changed files are added to the mapping, read the existing mapping file
154157
viewregistryFile.withInputStream { stream ->

0 commit comments

Comments
 (0)