@@ -5,9 +5,11 @@ import org.jetbrains.compose.ExperimentalComposeLibrary
55import org.jetbrains.compose.desktop.application.dsl.TargetFormat
66import org.jetbrains.compose.desktop.application.tasks.AbstractJPackageTask
77import org.jetbrains.compose.internal.de.undercouch.gradle.tasks.download.Download
8+ import org.gradle.process.ExecOperations
89import java.io.FileOutputStream
910import java.util.zip.ZipEntry
1011import java.util.zip.ZipOutputStream
12+ import javax.inject.Inject
1113
1214// TODO: Update to 2.10.20 and add hot-reloading: https://github.com/JetBrains/compose-hot-reload
1315
@@ -531,6 +533,11 @@ tasks.register("includeProcessingResources"){
531533 finalizedBy(" signResources" )
532534}
533535
536+ // Project.exec was removed in Gradle 9; an injected ExecOperations is the replacement
537+ interface ExecOps {
538+ @get:Inject val execOps: ExecOperations
539+ }
540+
534541tasks.register(" signResources" ) {
535542 onlyIf {
536543 OperatingSystem .current().isMacOsX
@@ -539,6 +546,9 @@ tasks.register("signResources") {
539546 }
540547 group = " compose desktop"
541548 val resourcesPath = composeResources(" " )
549+ val entitlements = file(" macos/entitlements.plist" ).absolutePath
550+
551+ val execOps = objects.newInstance<ExecOps >().execOps
542552
543553 // find jars in the resources directory
544554 val jars = mutableListOf<File >()
@@ -576,11 +586,10 @@ tasks.register("signResources") {
576586 exclude(" *.jar" )
577587 exclude(" *.so" )
578588 exclude(" *.dll" )
579- }.forEach{ f ->
580- ProcessBuilder (" codesign" , " --timestamp" , " --force" , " --deep" , " --options=runtime" , " --sign" , " Developer ID Application" , f.absolutePath)
581- .inheritIO()
582- .start()
583- .waitFor()
589+ }.forEach{ file ->
590+ execOps.exec {
591+ commandLine(" codesign" , " --timestamp" , " --force" , " --deep" ," --options=runtime" , " --entitlements" , entitlements, " --sign" , " Developer ID Application" , file)
592+ }
584593 }
585594 jars.forEach { file ->
586595 FileOutputStream (File (file.parentFile, file.nameWithoutExtension)).use { fos ->
@@ -631,6 +640,7 @@ tasks.register<Exec>("signApp"){
631640 " --force" ,
632641 " --deep" ,
633642 " --options=runtime" ,
643+ " --entitlements" , file(" macos/entitlements.plist" ).absolutePath,
634644 " --sign" , " Developer ID Application" ,
635645 app)
636646}
0 commit comments