@@ -279,12 +279,13 @@ tasks.register<Zip>("zipDistributable"){
279279}
280280
281281afterEvaluate{
282+ // Override the default DMG task to use our custom one
282283 tasks.named(" packageDmg" ).configure{
283284 dependsOn(" packageCustomDmg" )
284285 group = " compose desktop"
285286 actions = emptyList()
286287 }
287-
288+ // Override the default MSI task to use our custom one
288289 tasks.named(" packageMsi" ).configure{
289290 dependsOn(" packageCustomMsi" )
290291 group = " compose desktop"
@@ -335,12 +336,26 @@ tasks.register("includeJdk") {
335336 ? : error(" Could not find include.jdk" )
336337
337338 val isWindows = System .getProperty(" os.name" ).lowercase().contains(" win" )
339+ val isMacOS = System .getProperty(" os.name" ).lowercase().contains(" mac" )
338340 val command = if (isWindows) {
339341 listOf (" xcopy" , " /E" , " /I" , " /Q" , jdk, target)
340342 } else {
341343 listOf (" cp" , " -a" , jdk, target)
342344 }
343345 ProcessBuilder (command).inheritIO().start().waitFor()
346+
347+ if (org.gradle.internal.os.OperatingSystem .current().isMacOsX
348+ && compose.desktop.application.nativeDistributions.macOS.notarization.appleID.isPresent
349+ ) {
350+ // Sign the main binary again since changed it.
351+ val info = layout.buildDirectory.dir(" compose/binaries" ).get().asFileTree.matching { include(" **/Info.plist" ) }
352+ .files
353+ .firstOrNull()
354+ ?.parentFile ? : error(" Could not find Info.plist" )
355+ val signCommand = listOf (" codesign" , " --timestamp" , " --force" , " --deep" ," --options=runtime" , " --sign" , " Developer ID Application" , info.absolutePath)
356+ ProcessBuilder (signCommand).inheritIO().start().waitFor()
357+ }
358+
344359 }
345360}
346361tasks.register<Copy >(" includeSharedAssets" ){
@@ -526,6 +541,6 @@ afterEvaluate {
526541 }
527542 tasks.named(" createDistributable" ).configure {
528543 dependsOn(" signResources" )
529- finalizedBy( " includeJdk" ," setExecutablePermissions" )
544+ finalizedBy( " includeJdk" , " setExecutablePermissions" )
530545 }
531546}
0 commit comments