clean up build and remove unnecessary files

This commit is contained in:
Leijurv 2018-10-08 15:25:03 -07:00
parent 0ee14b4b90
commit 336154fd9b
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
1 changed files with 8 additions and 11 deletions

View File

@ -105,7 +105,12 @@ build {
JarFile jf = new JarFile(jarFile)
JarOutputStream jos = new JarOutputStream(new FileOutputStream(new File("temp.jar")))
jf.entries().unique { it.name }.sort { it.name }.each {
cloneAndCopyEntry(jf, it, jos, 0)
if (it.name != "META-INF/fml_cache_annotation.json" && it.name != "META-INF/fml_cache_class_versions.json") {
JarEntry clone = new JarEntry(it)
clone.time = 0
jos.putNextEntry(clone)
copy(jf.getInputStream(it), jos)
}
}
jos.finish()
jf.close()
@ -113,18 +118,10 @@ build {
}
}
void cloneAndCopyEntry(JarFile originalFile, JarEntry original, JarOutputStream jos, long newTimestamp) {
JarEntry clone = new JarEntry(original)
clone.time = newTimestamp
def entryIs = originalFile.getInputStream(original)
jos.putNextEntry(clone)
copyBinaryData(entryIs, jos)
}
void copyBinaryData(InputStream is, JarOutputStream jos) {
void copy(InputStream is, OutputStream os) {
byte[] buffer = new byte[1024]
int len = 0
while ((len = is.read(buffer)) != -1) {
jos.write(buffer, 0, len)
os.write(buffer, 0, len)
}
}