Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/release-gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ jobs:
ORG_GRADLE_PROJECT_compose.desktop.mac.notarization.password: ${{ secrets.PROCESSING_APP_PASSWORD }}
ORG_GRADLE_PROJECT_compose.desktop.mac.notarization.teamID: ${{ secrets.PROCESSING_TEAM_ID }}
ORG_GRADLE_PROJECT_snapname: ${{ vars.SNAP_NAME }}
ORG_GRADLE_PROJECT_snapconfinement: ${{ vars.SNAP_CONFINEMENT }}

- name: Sign files with Trusted Signing
if: runner.os == 'Windows'
Expand Down
81 changes: 32 additions & 49 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -229,61 +229,44 @@ tasks.register<Exec>("packageCustomMsi"){


tasks.register("generateSnapConfiguration"){
val name = findProperty("snapname") ?: rootProject.name
onlyIf { OperatingSystem.current().isLinux }

val distributable = tasks.named<AbstractJPackageTask>("createDistributable").get()
dependsOn(distributable)

val name = findProperty("snapname") as String? ?: rootProject.name
val arch = when (System.getProperty("os.arch")) {
"amd64", "x86_64" -> "amd64"
"aarch64" -> "arm64"
else -> System.getProperty("os.arch")
}

onlyIf { OperatingSystem.current().isLinux }
val distributable = tasks.named<AbstractJPackageTask>("createDistributable").get()
dependsOn(distributable)

val confinement = findProperty("snapconfinement") as String? ?: "strict"
val dir = distributable.destinationDir.get()
val content = """
name: $name
version: $version
base: core22
summary: A creative coding editor
description: |
Processing is a flexible software sketchbook and a programming language designed for learning how to code.
confinement: strict

apps:
processing:
command: opt/processing/bin/Processing
desktop: opt/processing/lib/processing-Processing.desktop
environment:
LD_LIBRARY_PATH: ${'$'}SNAP/opt/processing/lib/runtime/lib:${'$'}LD_LIBRARY_PATH
LIBGL_DRIVERS_PATH: ${'$'}SNAP/usr/lib/${'$'}SNAPCRAFT_ARCH_TRIPLET/dri
plugs:
- desktop
- desktop-legacy
- wayland
- x11
- network
- opengl
- home
- removable-media
- audio-playback
- audio-record
- pulseaudio
- gpio

parts:
processing:
plugin: dump
source: deb/processing_$version-1_$arch.deb
source-type: deb
stage-packages:
- openjdk-17-jre
override-prime: |
snapcraftctl prime
rm -vf usr/lib/jvm/java-17-openjdk-*/lib/security/cacerts
chmod -R +x opt/processing/lib/app/resources/jdk
""".trimIndent()
dir.file("../snapcraft.yaml").asFile.writeText(content)
val base = layout.projectDirectory.file("linux/snapcraft.base.yml")

doFirst {

var content = base
.asFile
.readText()
.replace("\$name", name)
.replace("\$arch", arch)
.replace("\$version", version as String)
.replace("\$confinement", confinement)
.let {
if (confinement != "classic") return@let it
// If confinement is not strict, remove the PLUGS section
val start = it.indexOf("# PLUGS START")
val end = it.indexOf("# PLUGS END")
if (start != -1 && end != -1) {
val before = it.substring(0, start)
val after = it.substring(end + "# PLUGS END".length)
return@let before + after
}
return@let it
}
dir.file("../snapcraft.yaml").asFile.writeText(content)
}
}

tasks.register<Exec>("packageSnap"){
Expand Down
42 changes: 42 additions & 0 deletions app/linux/snapcraft.base.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: $name
version: $version
base: core22
summary: A creative coding editor
description: |
Processing is a flexible software sketchbook and a programming language designed for learning how to code.
confinement: $confinement

apps:
processing:
command: opt/processing/bin/Processing
desktop: opt/processing/lib/processing-Processing.desktop
environment:
LD_LIBRARY_PATH: $SNAP/opt/processing/lib/runtime/lib:$LD_LIBRARY_PATH
LIBGL_DRIVERS_PATH: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/dri
# PLUGS START
plugs:
- desktop
- desktop-legacy
- wayland
- x11
- network
- opengl
- home
- removable-media
- audio-playback
- audio-record
- pulseaudio
- gpio
# PLUGS END

parts:
processing:
plugin: dump
source: deb/processing_$version-1_$arch.deb
source-type: deb
stage-packages:
- openjdk-17-jre
override-prime: |
snapcraftctl prime
rm -vf usr/lib/jvm/java-17-openjdk-*/lib/security/cacerts
chmod -R +x opt/processing/lib/app/resources/jdk
Loading