in gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/files/MacJarSignFileCopyingProcessor.kt [19:52]
override fun copy(source: File, target: File) {
if (source.isJarFile) {
signNativeLibsInJar(source, target)
} else {
SimpleFileCopyingProcessor.copy(source, target)
if (source.name.isDylibPath) {
when {
jvmRuntimeVersion < 17 -> signer.sign(target)
/**
* JDK 17 started to sign non-jar dylibs,
* but it fails, when libs are already signed,
* so we need to remove signature before running jpackage.
*
* JDK 18 processes signed libraries fine, so we don't have to do anything.
*
* Note that the JDK only signs dylib files and not jnilib files,
* so jnilib files still need to be signed here.
*/
jvmRuntimeVersion == 17 -> {
if (source.name.endsWith(".jnilib")) {
signer.sign(target)
} else {
signer.unsign(target)
}
}
else -> {
if (source.name.endsWith(".jnilib")) {
signer.sign(target)
}
}
}
}
}
}