1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-11-25 22:02:05 +01:00

Make builds reproducible

This commit is contained in:
Paul Schaub 2021-06-24 18:58:24 +02:00
parent 8a4908d29d
commit 9c8a2a0b29

View file

@ -1,5 +1,3 @@
import java.text.SimpleDateFormat
buildscript {
repositories {
@ -55,11 +53,16 @@ allprojects {
mavenCentral()
}
// Reproducible Builds
tasks.withType(AbstractArchiveTask) {
preserveFileTimestamps = false
reproducibleFileOrder = true
}
project.ext {
junitVersion = '5.7.1'
rootConfigDir = new File(rootDir, 'config')
gitCommit = getGitCommit()
builtDate = (new SimpleDateFormat("yyyy-MM-dd")).format(new Date())
isContinuousIntegrationEnvironment = Boolean.parseBoolean(System.getenv('CI'))
isReleaseVersion = !isSnapshot
signingRequired = !(isSnapshot || isContinuousIntegrationEnvironment)
@ -188,9 +191,10 @@ subprojects {
doLast {
def propertiesFile = file "$generatedVersionDir/version.properties"
propertiesFile.parentFile.mkdirs()
def properties = new Properties()
properties.setProperty("version", rootProject.version.toString())
propertiesFile.withWriter { properties.store(it, null) }
propertiesFile.createNewFile()
// Instead of using a Properties object here, we directly write to the file
// since Properties adds a timestamp, ruining reproducibility
propertiesFile.write("version="+rootProject.version.toString())
}
}
processResources.dependsOn generateVersionProperties