@@ -50,7 +50,7 @@ compose.desktop {
5050
5151 nativeDistributions{
5252 modules(" jdk.jdi" , " java.compiler" , " jdk.accessibility" )
53- targetFormats(TargetFormat .Dmg , TargetFormat .Msi , TargetFormat .Deb , TargetFormat . Pkg )
53+ targetFormats(TargetFormat .Dmg , TargetFormat .Msi , TargetFormat .Deb )
5454 packageName = " Processing"
5555
5656 macOS{
@@ -162,6 +162,22 @@ tasks.register<Exec>("packageCustomDmg"){
162162 app
163163 )
164164}
165+ tasks.register<Exec >(" packagePkg" ){
166+ dependsOn(" createDistributable" )
167+ group = " compose desktop"
168+ val distributable = tasks.named<AbstractJPackageTask >(" createDistributable" ).get()
169+ val app = distributable.destinationDir.get().file(" ${distributable.packageName.get()} .app" ).asFile
170+ val target = app.parentFile.parentFile.resolve(" pkg/${distributable.packageName.get()} -$version .pkg" )
171+ target.parentFile.mkdirs()
172+
173+ commandLine(" pkgbuild" ,
174+ " --install-location" , " /Applications" ,
175+ " --identifier" , " ${rootProject.group} .app" ,
176+ " --version" , version,
177+ " --component" , app,
178+ target
179+ )
180+ }
165181
166182tasks.register<Exec >(" packageCustomMsi" ){
167183 onlyIf { org.gradle.internal.os.OperatingSystem .current().isWindows }
@@ -205,6 +221,8 @@ tasks.register("generateSnapConfiguration"){
205221 processing:
206222 command: opt/processing/bin/Processing
207223 desktop: opt/processing/lib/processing-Processing.desktop
224+ environment:
225+ LD_LIBRARY_PATH: ${' $' } SNAP/lib:${' $' } LD_LIBRARY_PATH
208226 plugs:
209227 - desktop
210228 - desktop-legacy
@@ -216,12 +234,9 @@ tasks.register("generateSnapConfiguration"){
216234 plugin: dump
217235 source: deb/processing_$version -1_$snaparch .deb
218236 source-type: deb
219- stage-packages:
220- - openjdk-17-jdk
221237 override-prime: |
222238 snapcraftctl prime
223239 chmod -R +x opt/processing/lib/app/resources/jdk-*
224- rm -vf usr/lib/jvm/java-17-openjdk-*/lib/security/cacerts
225240 """ .trimIndent()
226241 dir.file(" ../snapcraft.yaml" ).asFile.writeText(content)
227242}
@@ -249,14 +264,12 @@ tasks.register<Zip>("zipDistributable"){
249264}
250265
251266afterEvaluate{
252- tasks.named(" createDistributable" ).configure{
253- finalizedBy(" zipDistributable" )
254- }
255267 tasks.named(" packageDmg" ).configure{
256268 dependsOn(" packageCustomDmg" )
257269 group = " compose desktop"
258270 actions = emptyList()
259271 }
272+
260273 tasks.named(" packageMsi" ).configure{
261274 dependsOn(" packageCustomMsi" )
262275 group = " compose desktop"
@@ -268,7 +281,7 @@ afterEvaluate{
268281 ){
269282 dependsOn(" notarizeDmg" )
270283 }
271- dependsOn(" packageSnap" )
284+ dependsOn(" packageSnap" , " zipDistributable " , " packagePkg " )
272285 }
273286}
274287
0 commit comments