mirror of https://github.com/zlatinb/muwire
strip archives
parent
f5783bbd86
commit
2831cfd43d
23
build.gradle
23
build.gradle
|
@ -34,5 +34,28 @@ subprojects {
|
||||||
tasks.withType(AbstractArchiveTask) {
|
tasks.withType(AbstractArchiveTask) {
|
||||||
preserveFileTimestamps = false
|
preserveFileTimestamps = false
|
||||||
reproducibleFileOrder = true
|
reproducibleFileOrder = true
|
||||||
|
doLast {
|
||||||
|
stripJar(it.archivePath)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
import java.util.jar.*
|
||||||
|
void stripJar(File file) {
|
||||||
|
if (file.getName().endsWith('.tar'))
|
||||||
|
return
|
||||||
|
println "stripping $file"
|
||||||
|
File newFile = new File(file.parent, 'tmp-' + file.name)
|
||||||
|
newFile.withOutputStream { fout ->
|
||||||
|
JarOutputStream out = new JarOutputStream(fout)
|
||||||
|
JarFile jf = new JarFile(file)
|
||||||
|
jf.entries().unique {it.name}.sort {it.name}.each {
|
||||||
|
def copy = new JarEntry(it.name)
|
||||||
|
copy.time = 1001
|
||||||
|
out.putNextEntry(copy)
|
||||||
|
out << jf.getInputStream(it)
|
||||||
|
}
|
||||||
|
out.finish()
|
||||||
|
}
|
||||||
|
newFile.renameTo file
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue