@@ -157,6 +157,61 @@ tasks.register<Exec>("packageCustomMsi"){
157157 )
158158}
159159
160+ tasks.register(" generateSnapConfiguration" ){
161+ onlyIf { org.gradle.internal.os.OperatingSystem .current().isLinux }
162+ val distributable = tasks.named<AbstractJPackageTask >(" createDistributable" ).get()
163+ dependsOn(distributable)
164+
165+ val arch = when (System .getProperty(" os.arch" )) {
166+ " amd64" , " x86_64" -> " amd64"
167+ else -> System .getProperty(" os.arch" )
168+ }
169+
170+ val dir = distributable.destinationDir.get()
171+ val content = """
172+ name: ${rootProject.name}
173+ version: ${rootProject.version}
174+ base: core22
175+ summary: A creative coding editor
176+ description: |
177+ Processing is a flexible software sketchbook and a programming language designed for learning how to code.
178+ confinement: strict
179+
180+ apps:
181+ processing:
182+ command: opt/processing/bin/Processing
183+ desktop: opt/processing/lib/processing-Processing.desktop
184+ plugs:
185+ - desktop
186+ - desktop-legacy
187+ - wayland
188+ - x11
189+
190+ parts:
191+ processing:
192+ plugin: dump
193+ source: deb/processing_$version -1_$arch .deb
194+ source-type: deb
195+ stage-packages:
196+ - openjdk-17-jdk
197+ override-prime: |
198+ snapcraftctl prime
199+ chmod -R +x opt/processing/lib/app/resources/jdk-*
200+ """ .trimIndent()
201+ dir.file(" ../snapcraft.yaml" ).asFile.writeText(content)
202+ }
203+
204+ tasks.register<Exec >(" packageSnap" ){
205+ onlyIf { org.gradle.internal.os.OperatingSystem .current().isLinux }
206+ dependsOn(" packageDeb" , " generateSnapConfiguration" )
207+ group = " compose desktop"
208+
209+ val distributable = tasks.named<AbstractJPackageTask >(" createDistributable" ).get()
210+ workingDir = distributable.destinationDir.dir(" ../" ).get().asFile
211+
212+ commandLine(" snapcraft" )
213+ }
214+
160215afterEvaluate{
161216 tasks.named(" packageDmg" ).configure{
162217 dependsOn(" packageCustomDmg" )
@@ -168,6 +223,9 @@ afterEvaluate{
168223 group = " compose desktop"
169224 actions = emptyList()
170225 }
226+ tasks.named(" packageDistributionForCurrentOS" ).configure {
227+ dependsOn(" packageSnap" )
228+ }
171229}
172230
173231
0 commit comments