mirror of
https://github.com/processing/processing4.git
synced 2026-04-20 03:09:28 +02:00
Merge pull request #1200 from Stefterv/snap-classic-support
Adding snap classic confinement support
This commit is contained in:
1
.github/workflows/release-gradle.yml
vendored
1
.github/workflows/release-gradle.yml
vendored
@@ -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'
|
||||
|
||||
@@ -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"){
|
||||
|
||||
42
app/linux/snapcraft.base.yml
Normal file
42
app/linux/snapcraft.base.yml
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user