diff --git a/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/dsl/MacOSNotarizationSettings.kt b/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/dsl/MacOSNotarizationSettings.kt index 5e3badd9f1..006902d687 100644 --- a/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/dsl/MacOSNotarizationSettings.kt +++ b/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/dsl/MacOSNotarizationSettings.kt @@ -32,4 +32,10 @@ abstract class MacOSNotarizationSettings { val password: Property = objects.nullableProperty().apply { set(ComposeProperties.macNotarizationPassword(providers)) } + + @get:Input + @get:Optional + val ascProvider: Property = objects.nullableProperty().apply { + set(ComposeProperties.macNotarizationAscProvider(providers)) + } } \ No newline at end of file diff --git a/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/ComposeProjectProperties.kt b/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/ComposeProjectProperties.kt index 961c8379ca..b032f42f2f 100644 --- a/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/ComposeProjectProperties.kt +++ b/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/ComposeProjectProperties.kt @@ -17,6 +17,7 @@ internal object ComposeProperties { internal const val MAC_SIGN_PREFIX = "compose.desktop.mac.signing.prefix" internal const val MAC_NOTARIZATION_APPLE_ID = "compose.desktop.mac.notarization.appleID" internal const val MAC_NOTARIZATION_PASSWORD = "compose.desktop.mac.notarization.password" + internal const val MAC_NOTARIZATION_ASC_PROVIDER = "compose.desktop.mac.notarization.ascProvider" fun isVerbose(providers: ProviderFactory): Provider = providers.findProperty(VERBOSE).toBoolean() @@ -42,6 +43,9 @@ internal object ComposeProperties { fun macNotarizationPassword(providers: ProviderFactory): Provider = providers.findProperty(MAC_NOTARIZATION_PASSWORD) + fun macNotarizationAscProvider(providers: ProviderFactory): Provider = + providers.findProperty(MAC_NOTARIZATION_ASC_PROVIDER) + private fun ProviderFactory.findProperty(prop: String): Provider = provider { gradleProperty(prop).forUseAtConfigurationTimeSafe().orNull diff --git a/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/validation/ValidatedMacOSNotarizationSettings.kt b/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/validation/ValidatedMacOSNotarizationSettings.kt index d937197a25..501fb162f2 100644 --- a/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/validation/ValidatedMacOSNotarizationSettings.kt +++ b/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/validation/ValidatedMacOSNotarizationSettings.kt @@ -12,7 +12,8 @@ import org.jetbrains.compose.desktop.application.internal.ComposeProperties internal data class ValidatedMacOSNotarizationSettings( val bundleID: String, val appleID: String, - val password: String + val password: String, + val ascProvider: String? ) internal fun MacOSNotarizationSettings?.validate( @@ -32,7 +33,8 @@ internal fun MacOSNotarizationSettings?.validate( return ValidatedMacOSNotarizationSettings( bundleID = bundleID, appleID = appleID.orNull!!, - password = password.orNull!! + password = password.orNull!!, + ascProvider = ascProvider.orNull ) } diff --git a/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/tasks/AbstractUploadAppForNotarizationTask.kt b/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/tasks/AbstractUploadAppForNotarizationTask.kt index 04b55cbb79..f1d5185887 100644 --- a/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/tasks/AbstractUploadAppForNotarizationTask.kt +++ b/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/tasks/AbstractUploadAppForNotarizationTask.kt @@ -34,16 +34,22 @@ abstract class AbstractUploadAppForNotarizationTask @Inject constructor( val packageFile = findOutputFileOrDir(inputDir.ioFile, targetFormat).checkExistingFile() logger.quiet("Uploading '${packageFile.name}' for notarization (package id: '${notarization.bundleID}')") + val args = arrayListOf( + "altool", + "--notarize-app", + "--primary-bundle-id", notarization.bundleID, + "--username", notarization.appleID, + "--password", notarization.password, + "--file", packageFile.absolutePath + ) + if (notarization.ascProvider != null) { + args.add("--asc-provider") + args.add(notarization.ascProvider) + } + runExternalTool( tool = MacUtils.xcrun, - args = listOf( - "altool", - "--notarize-app", - "--primary-bundle-id", notarization.bundleID, - "--username", notarization.appleID, - "--password", notarization.password, - "--file", packageFile.absolutePath - ), + args = args, processStdout = { output -> processUploadToolOutput(packageFile, output) } diff --git a/tutorials/Signing_and_notarization_on_macOS/README.md b/tutorials/Signing_and_notarization_on_macOS/README.md index 89e5fc67a3..767dcbdf3a 100644 --- a/tutorials/Signing_and_notarization_on_macOS/README.md +++ b/tutorials/Signing_and_notarization_on_macOS/README.md @@ -196,19 +196,28 @@ macOS { notarization { appleID.set("john.doe@example.com") password.set("@keychain:NOTARIZATION_PASSWORD") + + // optional + ascProvider.set("") } } ``` * Set `appleID` to your Apple ID. - * Alternatively, the `compose.desktop.mac.notarization.appleID` can be used. + * Alternatively, the `compose.desktop.mac.notarization.appleID` Gradle property can be used. * Set `password` to the app-specific password created previously. - * Alternatively, the `compose.desktop.mac.notarization.password` can be used. + * Alternatively, the `compose.desktop.mac.notarization.password` Gradle property can be used. * Don't write raw password directly into a build script. * If the password was added to the keychain, as described previously, it can be referenced as ``` @keychain:NOTARIZATION_PASSWORD ``` +* Set `ascProvider` to your Team ID, if your account is associated with multiple teams. + * Alternatively, the `compose.desktop.mac.notarization.ascProvider` Gradle property can be used. + * To get a table of team IDs associated with a given username and password, run: +``` +xcrun altool --list-providers -u -p " +``` ## Using Gradle