Commit 20e72842 authored by Nikolay Igotti's avatar Nikolay Igotti

Rework signing.

parent b25d00bb
...@@ -299,7 +299,7 @@ project.tasks.register<Exec>("objcCompile") { ...@@ -299,7 +299,7 @@ project.tasks.register<Exec>("objcCompile") {
outputs.files(outs) outputs.files(outs)
} }
fun localSign(signer: String, lib: File) { fun localSign(signer: String, lib: File): File {
println("Local signing $lib as $signer") println("Local signing $lib as $signer")
val proc = ProcessBuilder("codesign", "-f", "-s", signer, lib.absolutePath) val proc = ProcessBuilder("codesign", "-f", "-s", signer, lib.absolutePath)
.redirectOutput(ProcessBuilder.Redirect.PIPE) .redirectOutput(ProcessBuilder.Redirect.PIPE)
...@@ -313,9 +313,10 @@ fun localSign(signer: String, lib: File) { ...@@ -313,9 +313,10 @@ fun localSign(signer: String, lib: File) {
println(err) println(err)
throw GradleException("Cannot sign $lib: $err") throw GradleException("Cannot sign $lib: $err")
} }
return lib
} }
fun remoteSign(signHost: String, lib: File) { fun remoteSign(signHost: String, lib: File): 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")
val token = skiko.signToken ?: error("signToken is null") val token = skiko.signToken ?: error("signToken is null")
...@@ -339,8 +340,7 @@ fun remoteSign(signHost: String, lib: File) { ...@@ -339,8 +340,7 @@ fun remoteSign(signHost: String, lib: File) {
println(err) println(err)
throw GradleException("Cannot sign $lib: $err") throw GradleException("Cannot sign $lib: $err")
} else { } else {
lib.delete() return out
out.renameTo(lib)
} }
} }
...@@ -388,20 +388,6 @@ tasks.withType(LinkSharedLibrary::class.java).configureEach { ...@@ -388,20 +388,6 @@ tasks.withType(LinkSharedLibrary::class.java).configureEach {
) )
} }
} }
doLast {
val dylib = outputs.files.files.singleOrNull { it.name.endsWith(".dylib") }
logger.info("Resulting dylib: $dylib")
if (dylib != null) {
(project.properties["signer"] as String?)?.let { signer ->
localSign(signer, dylib)
}
skiko.signHost?.let { signHost ->
remoteSign(signHost, dylib)
}
}
}
} }
extensions.configure<CppLibrary> { extensions.configure<CppLibrary> {
...@@ -459,7 +445,17 @@ val skikoJvmRuntimeJar by project.tasks.registering(Jar::class) { ...@@ -459,7 +445,17 @@ val skikoJvmRuntimeJar by project.tasks.registering(Jar::class) {
dependsOn(createChecksums) dependsOn(createChecksums)
from(skikoJvmJar.map { zipTree(it.archiveFile) }) from(skikoJvmJar.map { zipTree(it.archiveFile) })
val linkTask = project.tasks.withType(LinkSharedLibrary::class.java).single { it.name.contains(buildType.id) } val linkTask = project.tasks.withType(LinkSharedLibrary::class.java).single { it.name.contains(buildType.id) }
from(linkTask.outputs.files.filter { it.isFile }) val lib = linkTask.outputs.files.single { it.isFile }
val maybeSigned = if (lib.name.endsWith(".dylib")) {
println("Resulting dylib: $lib")
skiko.signHost?.let { signHost ->
remoteSign(signHost, lib)
} ?: lib
} else {
lib
}
from(maybeSigned)
rename("${lib.name}.signed", lib.name)
if (targetOs.isWindows) { if (targetOs.isWindows) {
from(files(skiaDir.map { it.resolve("out/${buildType.id}-x64/icudtl.dat") })) from(files(skiaDir.map { it.resolve("out/${buildType.id}-x64/icudtl.dat") }))
} }
......
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