@@ -174,22 +174,25 @@ tasks.register<Exec>("packageCustomMsi"){
174174 )
175175}
176176
177+ val snapname = findProperty(" snapname" ) ? : rootProject.name
178+ val snaparch = when (System .getProperty(" os.arch" )) {
179+ " amd64" , " x86_64" -> " amd64"
180+ " aarch64" -> " arm64"
181+ else -> System .getProperty(" os.arch" )
182+ }
177183tasks.register(" generateSnapConfiguration" ){
178184 onlyIf { org.gradle.internal.os.OperatingSystem .current().isLinux }
179185 val distributable = tasks.named<AbstractJPackageTask >(" createDistributable" ).get()
180186 dependsOn(distributable)
181187
182- val arch = when (System .getProperty(" os.arch" )) {
183- " amd64" , " x86_64" -> " amd64"
184- " aarch64" -> " arm64"
185- else -> System .getProperty(" os.arch" )
186- }
188+
187189
188190 val version = if (version == " unspecified" ) " 1.0.0" else version
189191
192+
190193 val dir = distributable.destinationDir.get()
191194 val content = """
192- name: ${rootProject.name}
195+ name: $snapname
193196 version: $version
194197 base: core22
195198 summary: A creative coding editor
@@ -210,13 +213,14 @@ tasks.register("generateSnapConfiguration"){
210213 parts:
211214 processing:
212215 plugin: dump
213- source: deb/processing_$version -1_$arch .deb
216+ source: deb/processing_$version -1_$snaparch .deb
214217 source-type: deb
215218 stage-packages:
216219 - openjdk-17-jdk
217220 override-prime: |
218221 snapcraftctl prime
219222 chmod -R +x opt/processing/lib/app/resources/jdk-*
223+ rm -vf usr/lib/jvm/java-17-openjdk-*/lib/security/cacerts
220224 """ .trimIndent()
221225 dir.file(" ../snapcraft.yaml" ).asFile.writeText(content)
222226}
@@ -230,6 +234,17 @@ tasks.register<Exec>("packageSnap"){
230234 workingDir = distributable.destinationDir.dir(" ../" ).get().asFile
231235
232236 commandLine(" snapcraft" )
237+ commandLine(" cp ${snapname} _${version} _${snaparch} .snap ${name} _${version} _${snaparch} .snap" )
238+ }
239+ tasks.register<Exec >(" uploadSnap" ){
240+ onlyIf { org.gradle.internal.os.OperatingSystem .current().isLinux }
241+ dependsOn(" packageSnap" )
242+ group = " compose desktop"
243+
244+ val distributable = tasks.named<AbstractJPackageTask >(" createDistributable" ).get()
245+ workingDir = distributable.destinationDir.dir(" ../" ).get().asFile
246+
247+ commandLine(" snapcraft upload ${snapname} _${version} _${snaparch} .snap" )
233248}
234249tasks.register<Zip >(" zipDistributable" ){
235250 dependsOn(" createDistributable" )
@@ -262,7 +277,7 @@ afterEvaluate{
262277 if (compose.desktop.application.nativeDistributions.macOS.notarization.appleID.isPresent){
263278 dependsOn(" notarizeDmg" )
264279 }
265- dependsOn(" packageSnap" )
280+ dependsOn(" packageSnap" , " uploadSnap " )
266281 }
267282}
268283
0 commit comments