mirror of
https://github.com/jlengrand/compose-multiplatform.git
synced 2026-03-10 08:11:20 +00:00
Allow using relative path, when specifying signing keychain (#988)
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
|
||||
package org.jetbrains.compose.desktop.application.internal.validation
|
||||
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.provider.Provider
|
||||
import org.jetbrains.compose.desktop.application.dsl.MacOSSigningSettings
|
||||
import org.jetbrains.compose.desktop.application.internal.ComposeProperties
|
||||
@@ -31,7 +32,8 @@ internal data class ValidatedMacOSSigningSettings(
|
||||
}
|
||||
|
||||
internal fun MacOSSigningSettings.validate(
|
||||
bundleIDProvider: Provider<String?>
|
||||
bundleIDProvider: Provider<String?>,
|
||||
project: Project
|
||||
): ValidatedMacOSSigningSettings {
|
||||
check(currentOS == OS.MacOS) { ERR_WRONG_OS }
|
||||
|
||||
@@ -41,10 +43,13 @@ internal fun MacOSSigningSettings.validate(
|
||||
?: error(ERR_UNKNOWN_PREFIX)
|
||||
val signIdentity = this.identity.orNull
|
||||
?: error(ERR_UNKNOWN_SIGN_ID)
|
||||
val keychainFile = this.keychain.orNull?.let { File(it) }
|
||||
if (keychainFile != null) {
|
||||
check(keychainFile.exists()) {
|
||||
"$ERR_PREFIX keychain is not an existing file: ${keychainFile.absolutePath}"
|
||||
val keychainPath = this.keychain.orNull
|
||||
val keychainFile =
|
||||
listOf(project.file(keychainPath), project.rootProject.file(keychainPath))
|
||||
.firstOrNull { it.exists() }
|
||||
if (keychainPath != null) {
|
||||
check(keychainFile != null && keychainFile.exists()) {
|
||||
"$ERR_PREFIX could not find the specified keychain: $keychainPath"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -178,7 +178,8 @@ abstract class AbstractJPackageTask @Inject constructor(
|
||||
private val macSigner: MacSigner? by lazy {
|
||||
val nonValidatedSettings = nonValidatedMacSigningSettings
|
||||
if (currentOS == OS.MacOS && nonValidatedSettings?.sign?.get() == true) {
|
||||
val validatedSettings = nonValidatedSettings.validate(nonValidatedMacBundleID)
|
||||
val validatedSettings =
|
||||
nonValidatedSettings.validate(nonValidatedMacBundleID, project)
|
||||
MacSigner(validatedSettings, runExternalTool)
|
||||
} else null
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ compose.desktop {
|
||||
signing {
|
||||
sign.set(true)
|
||||
identity.set("Compose Test")
|
||||
keychain.set(project.file("compose.test.keychain").absolutePath)
|
||||
keychain.set("compose.test.keychain")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user