Replace manual shade patch for FG with reproducible builds plugin
This commit is contained in:
@@ -1,53 +0,0 @@
|
||||
From 2f3f4c59239b66e4ce09d2bbef39d7ce4eda44e9 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Herzig <me@johni0702.de>
|
||||
Date: Mon, 7 Aug 2017 19:53:46 +0200
|
||||
Subject: [PATCH 2/5] Manually force reproducible archives
|
||||
|
||||
For some reason shading one of the libs isn't done in an
|
||||
reproducible way (produces different jar whenever jar task is run).
|
||||
---
|
||||
build.gradle | 21 +++++++++++++++++++++
|
||||
1 file changed, 21 insertions(+)
|
||||
|
||||
diff --git a/build.gradle b/build.gradle
|
||||
index 468733e..91ea99a 100644
|
||||
--- a/build.gradle
|
||||
+++ b/build.gradle
|
||||
@@ -122,6 +122,10 @@ processResources {
|
||||
}
|
||||
}
|
||||
|
||||
+import java.util.jar.JarEntry
|
||||
+import java.util.jar.JarFile
|
||||
+import java.util.jar.JarOutputStream
|
||||
+
|
||||
jar {
|
||||
|
||||
configurations.shade.each { dep ->
|
||||
@@ -136,6 +140,23 @@ jar {
|
||||
attributes 'group':project.group
|
||||
attributes 'Implementation-Version': project.version + getGitHash()
|
||||
}
|
||||
+
|
||||
+ // For some reason using gradle's reproducibleFileOrder and preserveFileTimestamps just isn't enough
|
||||
+ doLast {
|
||||
+ File newFile = new File(archivePath.parent, 'tmp-' + archiveName)
|
||||
+ newFile.withOutputStream { fout ->
|
||||
+ JarOutputStream out = new JarOutputStream(fout)
|
||||
+ JarFile jf = new JarFile(archivePath)
|
||||
+ jf.entries().unique {it.name}.sort {it.name}.each {
|
||||
+ def copy = new JarEntry(it.name)
|
||||
+ copy.time = 0
|
||||
+ out.putNextEntry(copy)
|
||||
+ out << jf.getInputStream(it)
|
||||
+ }
|
||||
+ out.finish()
|
||||
+ }
|
||||
+ newFile.renameTo archivePath
|
||||
+ }
|
||||
}
|
||||
|
||||
javadoc {
|
||||
--
|
||||
2.5.5
|
||||
|
||||
@@ -83,7 +83,7 @@ setup_dep "srg2source" "https://github.com/MinecraftForge/Srg2Source.git" "5f11e
|
||||
|
||||
# Required for RM
|
||||
setup_dep "mixingradle" "https://github.com/SpongePowered/MixinGradle.git" "52217aa8ca221dcd0b9fb657b037e663db808f38" "build/libs/mixingradle-0.4-SNAPSHOT.jar" "8b3508867128a5d564631635dff898a36f9aca8db54b7bb3af6f4924e3f4bead"
|
||||
setup_dep "forgegradle" "https://github.com/MinecraftForge/ForgeGradle.git" "17806f45d20d0b55bff70a616eaeb939bd6a543c" "build/libs/ForgeGradle-2.1-SNAPSHOT.jar" "7f93a87e0030027916c713d47c91783d5662d2e66015a0698f1fc100d9e6e3dd"
|
||||
setup_dep "forgegradle" "https://github.com/MinecraftForge/ForgeGradle.git" "17806f45d20d0b55bff70a616eaeb939bd6a543c" "build/libs/ForgeGradle-2.1-SNAPSHOT.jar" "400f0ca3adf6a129926ec5d3af5495258ad6ec0f7951ba3b25c10ced211bc1b2"
|
||||
setup_dep "mixin" "https://github.com/SpongePowered/Mixin.git" "b558323da3bd6ce94aeb442bfd7357f6c40d2fd4" "build/libs/mixin-0.6.11-SNAPSHOT.jar" "cb446b614ce34372fc2084de9bb16adc3182a6e96120fdb4bcae561e41303694"
|
||||
|
||||
rm -rf tmp
|
||||
|
||||
Reference in New Issue
Block a user