Unverified Commit a7a3556d authored by Nikolay Igotti's avatar Nikolay Igotti Committed by GitHub

Sealing on Linux (#68)

parent 6f6bf094
...@@ -317,6 +317,21 @@ fun localSign(signer: String, lib: File): File { ...@@ -317,6 +317,21 @@ fun localSign(signer: String, lib: File): File {
return lib return lib
} }
// See https://github.com/olonho/sealer.
fun sealBinary(sealer: String, lib: File) {
println("Sealing $lib by $sealer")
val proc = ProcessBuilder(sealer, "-f", lib.absolutePath, "-p", "Java_")
.redirectOutput(ProcessBuilder.Redirect.INHERIT)
.redirectError(ProcessBuilder.Redirect.INHERIT)
.start()
proc.waitFor(2, TimeUnit.MINUTES)
if (proc.exitValue() != 0) {
throw GradleException("Cannot seal $lib")
}
println("Sealed!")
}
fun remoteSign(signHost: String, lib: File, out: File) { fun remoteSign(signHost: String, lib: File, out: File) {
println("Remote signing $lib on $signHost") println("Remote signing $lib on $signHost")
val user = skiko.signUser ?: error("signUser is null") val user = skiko.signUser ?: error("signUser is null")
...@@ -445,12 +460,16 @@ val maybeSign by project.tasks.registering { ...@@ -445,12 +460,16 @@ val maybeSign by project.tasks.registering {
outputs.files(output) outputs.files(output)
doLast { doLast {
if (targetOs == OS.Linux) {
// Linux requires additional sealing to run on wider set of platforms.
val sealer = "$projectDir/tools/sealer"
sealBinary(sealer, lib)
}
if (skiko.signHost != null) { if (skiko.signHost != null) {
remoteSign(skiko.signHost!!, lib, output) remoteSign(skiko.signHost!!, lib, output)
} else { } else {
lib.copyTo(output, overwrite = true) lib.copyTo(output, overwrite = true)
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment