Skip to content

Commit

Permalink
Sealing on Linux (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
olonho authored Feb 25, 2021
1 parent 6f6bf09 commit a7a3556
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion skiko/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,21 @@ fun localSign(signer: String, lib: File): File {
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) {
println("Remote signing $lib on $signHost")
val user = skiko.signUser ?: error("signUser is null")
Expand Down Expand Up @@ -445,12 +460,16 @@ val maybeSign by project.tasks.registering {
outputs.files(output)

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) {
remoteSign(skiko.signHost!!, lib, output)
} else {
lib.copyTo(output, overwrite = true)
}

}
}

Expand Down
Binary file added skiko/tools/sealer
Binary file not shown.

0 comments on commit a7a3556

Please sign in to comment.