Compare commits
1 commit
bdf39d741b
...
4462d569f2
Author | SHA1 | Date | |
---|---|---|---|
4462d569f2 |
1 changed files with 9 additions and 10 deletions
|
@ -82,18 +82,17 @@ private fun buildMagiskModule(target: Project) = buildZipFile {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildZipFile(builderAction: MutableMap<String, (ZipEntry) -> ByteArray>.() -> Unit): ByteArray {
|
private fun buildZipFile(builderAction: MutableMap<String, ZipEntry.() -> ByteArray>.() -> Unit): ByteArray {
|
||||||
val out = ByteArrayOutputStream()
|
val out = ByteArrayOutputStream()
|
||||||
val zip = ZipOutputStream(out)
|
ZipOutputStream(out).use {
|
||||||
for ((name, invoke) in buildMap(builderAction)) {
|
for ((name, invoke) in buildMap(builderAction)) {
|
||||||
val entry = ZipEntry(name)
|
val entry = ZipEntry(name)
|
||||||
entry.time = 0 // reproducible builds
|
entry.time = 0 // reproducible builds
|
||||||
zip.putNextEntry(entry)
|
it.putNextEntry(entry)
|
||||||
zip.write(invoke(entry))
|
it.write(entry.invoke())
|
||||||
zip.closeEntry()
|
it.closeEntry()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
zip.close()
|
|
||||||
out.close()
|
|
||||||
return out.toByteArray()
|
return out.toByteArray()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue