From e6b091f39735dfb4de3dbaeeb1d729fd21ec4657 Mon Sep 17 00:00:00 2001 From: Leonidas Spyropoulos Date: Fri, 7 Apr 2023 15:07:05 +0300 Subject: [PATCH 1/2] feat: add support for reproducible builds As per gradle [docs] add support to remove timestamps and package with same order which is required from [reproducible] builds [docs]: https://docs.gradle.org/current/userguide/working_with_files.html#sec:archives [reproducible]: https://reproducible-builds.org/ Signed-off-by: Leonidas Spyropoulos --- build.gradle | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index a2ea3d0..10c8dda 100644 --- a/build.gradle +++ b/build.gradle @@ -54,7 +54,6 @@ jar { manifest { attributes( 'Built-By' : System.properties['user.name'], - 'Build-Timestamp': new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ").format(new Date()), 'Build-Revision' : versioning.info.commit, 'Created-By' : "Gradle ${gradle.gradleVersion}", 'Build-Jdk' : "${System.properties['java.version']} (${System.properties['java.vendor']} ${System.properties['java.vm.version']})", @@ -63,3 +62,8 @@ jar { ) } } + +tasks.withType(AbstractArchiveTask.class).configureEach { + preserveFileTimestamps = false + reproducibleFileOrder = true +} From 6cb0c196f1a8baff86c75d0d11b04198e83b65ad Mon Sep 17 00:00:00 2001 From: Leonidas Spyropoulos Date: Thu, 13 Apr 2023 10:29:13 +0100 Subject: [PATCH 2/2] feat: remove variable fields from manifest Including the gradle,jdk versions along with kernel versiona dn JDK might be variable in different systems and affects the hash of each jar. Signed-off-by: Leonidas Spyropoulos --- build.gradle | 4 ---- 1 file changed, 4 deletions(-) diff --git a/build.gradle b/build.gradle index 10c8dda..0003ea5 100644 --- a/build.gradle +++ b/build.gradle @@ -53,11 +53,7 @@ jar { } manifest { attributes( - 'Built-By' : System.properties['user.name'], 'Build-Revision' : versioning.info.commit, - 'Created-By' : "Gradle ${gradle.gradleVersion}", - 'Build-Jdk' : "${System.properties['java.version']} (${System.properties['java.vendor']} ${System.properties['java.vm.version']})", - 'Build-OS' : "${System.properties['os.name']} ${System.properties['os.arch']} ${System.properties['os.version']}", 'Version' : "${gradle.rootProject.version}" ) }