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:
parent
8a4908d29d
commit
9c8a2a0b29
1 changed files with 10 additions and 6 deletions
16
build.gradle
16
build.gradle
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue