@@ -4,6 +4,9 @@ import org.jetbrains.compose.desktop.application.dsl.TargetFormat
44import org.jetbrains.compose.desktop.application.tasks.AbstractJPackageTask
55import org.jetbrains.compose.internal.de.undercouch.gradle.tasks.download.Download
66import org.jetbrains.kotlin.fir.scopes.impl.overrides
7+ import java.io.FileOutputStream
8+ import java.util.zip.ZipEntry
9+ import java.util.zip.ZipOutputStream
710
811plugins{
912 id(" java" )
@@ -47,7 +50,7 @@ compose.desktop {
4750
4851 nativeDistributions{
4952 modules(" jdk.jdi" , " java.compiler" , " jdk.accessibility" )
50- targetFormats(TargetFormat .Dmg , TargetFormat .Msi , TargetFormat .Deb )
53+ targetFormats(TargetFormat .Dmg , TargetFormat .Msi , TargetFormat .Deb , TargetFormat . Pkg )
5154 packageName = " Processing"
5255
5356 macOS{
@@ -233,7 +236,7 @@ tasks.register<Exec>("packageSnap"){
233236 commandLine(" snapcraft" )
234237}
235238tasks.register<Zip >(" zipDistributable" ){
236- dependsOn(" createDistributable" )
239+ dependsOn(" createDistributable" , " setExecutablePermissions " )
237240 group = " compose desktop"
238241
239242 val distributable = tasks.named<AbstractJPackageTask >(" createDistributable" ).get()
@@ -388,7 +391,17 @@ tasks.register<Copy>("renameWindres") {
388391tasks.register(" signResources" ){
389392 onlyIf { org.gradle.internal.os.OperatingSystem .current().isMacOsX }
390393 group = " compose desktop"
391- dependsOn(" prepareAppResources" )
394+ dependsOn(
395+ " includeCore" ,
396+ " includeJavaMode" ,
397+ " includeJdk" ,
398+ " includeSharedAssets" ,
399+ " includeProcessingExamples" ,
400+ " includeProcessingWebsiteExamples" ,
401+ " includeJavaModeResources" ,
402+ " renameWindres"
403+ )
404+ finalizedBy(" prepareAppResources" )
392405
393406 val resourcesPath = composeResources(" " )
394407
@@ -415,28 +428,44 @@ tasks.register("signResources"){
415428 from(zipTree(file))
416429 into(tempDir)
417430 }
418- jars.add(tempDir )
431+ file.delete( )
419432 }
420433 fileTree(resourcesPath){
421434 include(" **/bin/**" )
422435 include(" **/*.jnilib" )
423436 include(" **/*.dylib" )
424437 include(" **/*aarch64*" )
425438 include(" **/*x86_64*" )
439+ include(" **/*ffmpeg*" )
440+ include(" **/ffmpeg*/**" )
426441 exclude(" jdk-*/**" )
427442 exclude(" *.jar" )
428443 exclude(" *.so" )
429444 exclude(" *.dll" )
430445 }.forEach{ file ->
431- println (" signign $file " )
432446 exec {
433- commandLine(" codesign" , " --timestamp" , " --force" , " --deep" , " --sign" , " Developer ID Application" , file)
447+ commandLine(" codesign" , " --timestamp" , " --force" , " --deep" ," --options=runtime " , " --sign" , " Developer ID Application" , file)
434448 }
435449 }
436- }
437- doLast {
438450 jars.forEach { file ->
439- zipTo(file.resolve(file.nameWithoutExtension), file)
451+ FileOutputStream (File (file.parentFile, file.nameWithoutExtension)).use { fos ->
452+ ZipOutputStream (fos).use { zos ->
453+ file.walkTopDown().forEach { fileEntry ->
454+ if (fileEntry.isFile) {
455+ // Calculate the relative path for the zip entry
456+ val zipEntryPath = fileEntry.relativeTo(file).path
457+ val entry = ZipEntry (zipEntryPath)
458+ zos.putNextEntry(entry)
459+
460+ // Copy file contents to the zip
461+ fileEntry.inputStream().use { input ->
462+ input.copyTo(zos)
463+ }
464+ zos.closeEntry()
465+ }
466+ }
467+ }
468+ }
440469
441470 file.deleteRecursively()
442471 }
@@ -457,7 +486,6 @@ afterEvaluate {
457486 " includeJavaModeResources" ,
458487 " renameWindres"
459488 )
460- finalizedBy()
461489 }
462490 tasks.register(" setExecutablePermissions" ) {
463491 description = " Sets executable permissions on binaries in Processing.app resources"
0 commit comments