@@ -4,6 +4,9 @@ import org.jetbrains.compose.desktop.application.dsl.TargetFormat
4
4
import org.jetbrains.compose.desktop.application.tasks.AbstractJPackageTask
5
5
import org.jetbrains.compose.internal.de.undercouch.gradle.tasks.download.Download
6
6
import org.jetbrains.kotlin.fir.scopes.impl.overrides
7
+ import java.io.FileOutputStream
8
+ import java.util.zip.ZipEntry
9
+ import java.util.zip.ZipOutputStream
7
10
8
11
plugins{
9
12
id(" java" )
@@ -47,7 +50,7 @@ compose.desktop {
47
50
48
51
nativeDistributions{
49
52
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 )
51
54
packageName = " Processing"
52
55
53
56
macOS{
@@ -233,7 +236,7 @@ tasks.register<Exec>("packageSnap"){
233
236
commandLine(" snapcraft" )
234
237
}
235
238
tasks.register<Zip >(" zipDistributable" ){
236
- dependsOn(" createDistributable" )
239
+ dependsOn(" createDistributable" , " setExecutablePermissions " )
237
240
group = " compose desktop"
238
241
239
242
val distributable = tasks.named<AbstractJPackageTask >(" createDistributable" ).get()
@@ -388,7 +391,17 @@ tasks.register<Copy>("renameWindres") {
388
391
tasks.register(" signResources" ){
389
392
onlyIf { org.gradle.internal.os.OperatingSystem .current().isMacOsX }
390
393
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" )
392
405
393
406
val resourcesPath = composeResources(" " )
394
407
@@ -415,28 +428,44 @@ tasks.register("signResources"){
415
428
from(zipTree(file))
416
429
into(tempDir)
417
430
}
418
- jars.add(tempDir )
431
+ file.delete( )
419
432
}
420
433
fileTree(resourcesPath){
421
434
include(" **/bin/**" )
422
435
include(" **/*.jnilib" )
423
436
include(" **/*.dylib" )
424
437
include(" **/*aarch64*" )
425
438
include(" **/*x86_64*" )
439
+ include(" **/*ffmpeg*" )
440
+ include(" **/ffmpeg*/**" )
426
441
exclude(" jdk-*/**" )
427
442
exclude(" *.jar" )
428
443
exclude(" *.so" )
429
444
exclude(" *.dll" )
430
445
}.forEach{ file ->
431
- println (" signign $file " )
432
446
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)
434
448
}
435
449
}
436
- }
437
- doLast {
438
450
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
+ }
440
469
441
470
file.deleteRecursively()
442
471
}
@@ -457,7 +486,6 @@ afterEvaluate {
457
486
" includeJavaModeResources" ,
458
487
" renameWindres"
459
488
)
460
- finalizedBy()
461
489
}
462
490
tasks.register(" setExecutablePermissions" ) {
463
491
description = " Sets executable permissions on binaries in Processing.app resources"
0 commit comments