Skip to content

Commit 65a3800

Browse files
committed
macOS Signing bugfix
[skip ci]
1 parent 4bce2d3 commit 65a3800

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

app/build.gradle.kts

+22-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ import org.jetbrains.compose.desktop.application.dsl.TargetFormat
44
import org.jetbrains.compose.desktop.application.tasks.AbstractJPackageTask
55
import org.jetbrains.compose.internal.de.undercouch.gradle.tasks.download.Download
66
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
710

811
plugins{
912
id("java")
@@ -415,6 +418,7 @@ tasks.register("signResources"){
415418
from(zipTree(file))
416419
into(tempDir)
417420
}
421+
file.delete()
418422
jars.add(tempDir)
419423
}
420424
fileTree(resourcesPath){
@@ -436,7 +440,24 @@ tasks.register("signResources"){
436440
}
437441
doLast {
438442
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+
}
440461

441462
file.deleteRecursively()
442463
}

0 commit comments

Comments
 (0)