You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@grails.apache.org by jd...@apache.org on 2025/07/17 15:30:59 UTC
(grails-core) 01/01: fix: #14910 - make property files reproducible by default (per day)
This is an automated email from the ASF dual-hosted git repository.
jdaugherty pushed a commit to branch issue-14910-property-reproducible
in repository https://gitbox.apache.org/repos/asf/grails-core.git
commit 2c5bf3b1b8b348132f086c5866a9fdf0e31c5a4c
Author: James Daugherty <jd...@jdresources.net>
AuthorDate: Thu Jul 17 09:07:35 2025 -0600
fix: #14910 - make property files reproducible by default (per day)
---
.../org/apache/grails/common/properties/PropertyFileUtils.groovy | 6 +++++-
.../groovy/org/grails/gradle/plugin/core/GrailsGradlePlugin.groovy | 6 +++++-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/grails-common/src/main/groovy/org/apache/grails/common/properties/PropertyFileUtils.groovy b/grails-common/src/main/groovy/org/apache/grails/common/properties/PropertyFileUtils.groovy
index 24a0fb7f1d..e1c9b776c2 100644
--- a/grails-common/src/main/groovy/org/apache/grails/common/properties/PropertyFileUtils.groovy
+++ b/grails-common/src/main/groovy/org/apache/grails/common/properties/PropertyFileUtils.groovy
@@ -17,6 +17,8 @@
package org.apache.grails.common.properties
import java.nio.charset.StandardCharsets
+import java.time.LocalDate
+import java.time.ZoneOffset
import java.util.regex.Pattern
final class PropertyFileUtils {
@@ -30,7 +32,9 @@ final class PropertyFileUtils {
static void makePropertiesFileReproducible(File factoriesFile) {
String sourceDateEpoch = System.getenv('SOURCE_DATE_EPOCH')
if (!sourceDateEpoch) {
- return
+ sourceDateEpoch = LocalDate.now(ZoneOffset.UTC)
+ .atStartOfDay(ZoneOffset.UTC)
+ .toEpochSecond().toString()
}
Pattern timeRegex = Pattern.compile('^#(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)(?:,|\\\\s).*$')
diff --git a/grails-gradle/plugins/src/main/groovy/org/grails/gradle/plugin/core/GrailsGradlePlugin.groovy b/grails-gradle/plugins/src/main/groovy/org/grails/gradle/plugin/core/GrailsGradlePlugin.groovy
index d66d87293f..e6c20dd9e4 100644
--- a/grails-gradle/plugins/src/main/groovy/org/grails/gradle/plugin/core/GrailsGradlePlugin.groovy
+++ b/grails-gradle/plugins/src/main/groovy/org/grails/gradle/plugin/core/GrailsGradlePlugin.groovy
@@ -72,6 +72,8 @@ import org.springframework.boot.gradle.tasks.run.BootRun
import javax.inject.Inject
import java.nio.charset.StandardCharsets
+import java.time.LocalDate
+import java.time.ZoneOffset
import java.util.regex.Pattern
/**
@@ -173,7 +175,9 @@ class GrailsGradlePlugin extends GroovyPlugin {
static void makePropertiesFileReproducible(File factoriesFile) {
String sourceDateEpoch = System.getenv('SOURCE_DATE_EPOCH')
if (!sourceDateEpoch) {
- return
+ sourceDateEpoch = LocalDate.now(ZoneOffset.UTC)
+ .atStartOfDay(ZoneOffset.UTC)
+ .toEpochSecond().toString()
}
Pattern timeRegex = Pattern.compile('^#(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)(?:,|\\\\s).*$')