Unverified Commit 5d43c933 authored by Nikolay Igotti's avatar Nikolay Igotti Committed by GitHub

Allow optional local codesigning. (#41)

parent 569b27d3
...@@ -44,3 +44,13 @@ Set up environment variables `COMPOSE_REPO_USERNAME` and `COMPOSE_REPO_KEY`. ...@@ -44,3 +44,13 @@ Set up environment variables `COMPOSE_REPO_USERNAME` and `COMPOSE_REPO_KEY`.
``` ```
./gradlew <PUBLISH_TASK> -Pdeploy.version=0.1.2 -Pdeploy.release=true ./gradlew <PUBLISH_TASK> -Pdeploy.version=0.1.2 -Pdeploy.release=true
``` ```
##### Code signing
macOS for Apple Silicon builds aimed for distribution require mandatory code signing,
so use command like
```
./gradlew -Psigner="Apple Distribution: Nikolay Igotti (N462MKSJ7M)" <PUBLISH_TASK>
```
to codesign the JNI library.
Use `security find-identity -v -p codesigning` to find valid signing identities.
...@@ -153,14 +153,6 @@ kotlin { ...@@ -153,14 +153,6 @@ kotlin {
withJava() withJava()
} }
val nativeTarget = when (targetOs) {
// TODO: not entirely correct for macOS ARM.
OS.MacOS -> macosX64("native")
OS.Linux -> linuxX64("native")
OS.Windows -> mingwX64("native")
else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
}
sourceSets { sourceSets {
val commonMain by getting { val commonMain by getting {
dependencies { dependencies {
...@@ -187,8 +179,6 @@ kotlin { ...@@ -187,8 +179,6 @@ kotlin {
implementation(kotlin("test-junit")) implementation(kotlin("test-junit"))
} }
} }
val nativeMain by getting
val nativeTest by getting
} }
} }
...@@ -339,6 +329,26 @@ tasks.withType(LinkSharedLibrary::class.java).configureEach { ...@@ -339,6 +329,26 @@ tasks.withType(LinkSharedLibrary::class.java).configureEach {
) )
} }
} }
doLast {
(project.properties["signer"] as String?)?.let { signer ->
outputs.files.files.singleOrNull { it.name.endsWith(".dylib") }?.let { lib ->
println("Signing $lib as $signer")
val proc = ProcessBuilder("codesign", "-f", "-s", signer, lib.absolutePath)
.redirectOutput(ProcessBuilder.Redirect.PIPE)
.redirectError(ProcessBuilder.Redirect.PIPE)
.start()
proc.waitFor(5, TimeUnit.MINUTES)
if (proc.exitValue() != 0) {
val out = proc.inputStream.bufferedReader().readText()
val err = proc.errorStream.bufferedReader().readText()
println(out)
println(err)
throw GradleException("Cannot sign $lib: $err")
}
}
}
}
} }
extensions.configure<CppLibrary> { extensions.configure<CppLibrary> {
......
...@@ -6,3 +6,5 @@ dependencies.skia.windows-x64=m88-64fc64c948/Skia-m88-64fc64c948-windows-Release ...@@ -6,3 +6,5 @@ dependencies.skia.windows-x64=m88-64fc64c948/Skia-m88-64fc64c948-windows-Release
dependencies.skia.linux-x64=m88-64fc64c948/Skia-m88-64fc64c948-linux-Release-x64 dependencies.skia.linux-x64=m88-64fc64c948/Skia-m88-64fc64c948-linux-Release-x64
dependencies.skia.macos-x64=m88-64fc64c948/Skia-m88-64fc64c948-macos-Release-x64 dependencies.skia.macos-x64=m88-64fc64c948/Skia-m88-64fc64c948-macos-Release-x64
dependencies.skia.macos-arm64=m88-64fc64c948/Skia-m88-64fc64c948-macos-Release-arm64 dependencies.skia.macos-arm64=m88-64fc64c948/Skia-m88-64fc64c948-macos-Release-arm64
# signer=Apple Distribution: Nikolay Igotti (N462MKSJ7M)
\ No newline at end of file
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