Skip to content

Commit 30dddff

Browse files
committed
macOS distribution
1 parent fe152b7 commit 30dddff

4 files changed

Lines changed: 52 additions & 7 deletions

File tree

app/build.gradle.kts

Lines changed: 52 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
22
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
3+
import org.jetbrains.compose.desktop.application.tasks.AbstractJPackageTask
34
import org.jetbrains.compose.internal.de.undercouch.gradle.tasks.download.Download
5+
import org.jetbrains.kotlin.fir.scopes.impl.overrides
46

57
plugins{
68
id("java")
@@ -51,23 +53,24 @@ compose.desktop {
5153
packageName = "Processing"
5254

5355
macOS{
54-
bundleID = "org.processing.app"
55-
iconFile = project.file("../build/macos/processing.icns")
56+
bundleID = "${rootProject.group}.app"
57+
iconFile = rootProject.file("build/macos/processing.icns")
5658
infoPlist{
57-
extraKeysRawXml = layout.projectDirectory.file("info.plist").asFile.readText()
59+
extraKeysRawXml = file("macos/info.plist").readText()
5860
}
59-
entitlementsFile.set(project.file("entitlements.plist"))
60-
runtimeEntitlementsFile.set(project.file("entitlements.plist"))
61+
entitlementsFile.set(file("macos/entitlements.plist"))
62+
runtimeEntitlementsFile.set(file("macos/entitlements.plist"))
63+
appStore = true
6164
}
6265
windows{
63-
iconFile = project.file("../build/windows/processing.ico")
66+
iconFile = rootProject.file("build/windows/processing.ico")
6467
menuGroup = "Processing"
6568
upgradeUuid = "89d8d7fe-5602-4b12-ba10-0fe78efbd602"
6669
}
6770
linux {
6871
appCategory = "Programming"
6972
menuGroup = "Processing"
70-
iconFile = project.file("../build/linux/processing.png")
73+
iconFile = rootProject.file("build/linux/processing.png")
7174
// Fix fonts on some Linux distributions
7275
jvmArgs("-Dawt.useSystemAAFontSettings=on")
7376

@@ -105,6 +108,48 @@ tasks.compileJava{
105108
options.encoding = "UTF-8"
106109
}
107110

111+
tasks.register<Exec>("installCreateDmg") {
112+
commandLine("brew", "install", "--quiet", "create-dmg")
113+
}
114+
tasks.register<Exec>("packageCustomDmg"){
115+
group = "compose desktop"
116+
117+
val distributable = tasks.named<AbstractJPackageTask>("createDistributable").get()
118+
dependsOn(distributable, "installCreateDmg")
119+
120+
val packageName = distributable.packageName.get()
121+
val dir = distributable.destinationDir.get()
122+
val dmg = dir.file("../dmg/$packageName-$version.dmg").asFile
123+
val app = dir.file("$packageName.app").asFile
124+
125+
dmg.parentFile.deleteRecursively()
126+
dmg.parentFile.mkdirs()
127+
128+
commandLine("brew", "install", "--quiet", "create-dmg")
129+
130+
commandLine("create-dmg",
131+
"--volname", packageName,
132+
"--volicon", rootProject.file("build/macos/processing.icns"),
133+
"--background", file("macos/background.png"),
134+
"--icon", "$packageName.app", "200", "200",
135+
"--window-pos", "200", "200",
136+
"--window-size", "775", "485",
137+
"--app-drop-link", "500", "200",
138+
"--hide-extension", "$packageName.app",
139+
dmg,
140+
app
141+
)
142+
}
143+
144+
afterEvaluate{
145+
tasks.named("packageDmg").configure{
146+
dependsOn("packageCustomDmg")
147+
group = "compose desktop"
148+
actions = emptyList()
149+
}
150+
}
151+
152+
108153

109154
// LEGACY TASKS
110155
// Most of these are shims to be compatible with the old build system

app/macos/background.png

14.5 KB
Loading
File renamed without changes.

0 commit comments

Comments
 (0)