@@ -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{
@@ -388,7 +391,8 @@ 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(" renameWindres" )
395
+ finalizedBy(" prepareAppResources" )
392
396
393
397
val resourcesPath = composeResources(" " )
394
398
@@ -415,6 +419,7 @@ tasks.register("signResources"){
415
419
from(zipTree(file))
416
420
into(tempDir)
417
421
}
422
+ file.delete()
418
423
jars.add(tempDir)
419
424
}
420
425
fileTree(resourcesPath){
@@ -428,15 +433,31 @@ tasks.register("signResources"){
428
433
exclude(" *.so" )
429
434
exclude(" *.dll" )
430
435
}.forEach{ file ->
431
- println (" signign $file " )
432
436
exec {
433
437
commandLine(" codesign" , " --timestamp" , " --force" , " --deep" , " --sign" , " Developer ID Application" , file)
434
438
}
435
439
}
436
440
}
437
441
doLast {
438
442
jars.forEach { file ->
439
- zipTo(file.resolve(file.nameWithoutExtension), file)
443
+ FileOutputStream (File (file.parentFile, file.nameWithoutExtension)).use { fos ->
444
+ ZipOutputStream (fos).use { zos ->
445
+ file.walkTopDown().forEach { fileEntry ->
446
+ if (fileEntry.isFile) {
447
+ // Calculate the relative path for the zip entry
448
+ val zipEntryPath = fileEntry.relativeTo(file).path
449
+ val entry = ZipEntry (zipEntryPath)
450
+ zos.putNextEntry(entry)
451
+
452
+ // Copy file contents to the zip
453
+ fileEntry.inputStream().use { input ->
454
+ input.copyTo(zos)
455
+ }
456
+ zos.closeEntry()
457
+ }
458
+ }
459
+ }
460
+ }
440
461
441
462
file.deleteRecursively()
442
463
}
@@ -457,7 +478,6 @@ afterEvaluate {
457
478
" includeJavaModeResources" ,
458
479
" renameWindres"
459
480
)
460
- finalizedBy()
461
481
}
462
482
tasks.register(" setExecutablePermissions" ) {
463
483
description = " Sets executable permissions on binaries in Processing.app resources"
0 commit comments