Skip to content

Commit 4495cc5

Browse files
authored
Merge branch 'main' into dxfMigration
2 parents 20425fd + 34a85df commit 4495cc5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+2098
-511
lines changed

.all-contributorsrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1642,6 +1642,15 @@
16421642
"contributions": [
16431643
"doc"
16441644
]
1645+
},
1646+
{
1647+
"login": "catilac",
1648+
"name": "Moon",
1649+
"avatar_url": "https://avatars.githubusercontent.com/u/15107?v=4",
1650+
"profile": "https://softmoon.world",
1651+
"contributions": [
1652+
"code"
1653+
]
16451654
}
16461655
],
16471656
"repoType": "github",

.github/ISSUE_TEMPLATE/1_bug_report.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ body:
4242
- type: input
4343
attributes:
4444
label: Operating system
45-
description: "Ex: Windows/MacOSX/Linux/Android/iOS along with version"
45+
description: "Ex: Windows/macOS/Linux/Android/iOS along with version"
4646
validations:
4747
required: true
4848

@@ -60,11 +60,11 @@ body:
6060
label: Steps to reproduce this
6161
description: Describe what steps will produce the bug.
6262
value: |
63-
"1.
63+
1.
6464
6565
2.
6666
67-
3."
67+
3.
6868
validations:
6969
required: true
7070

@@ -111,4 +111,4 @@ body:
111111
attributes:
112112
value: |
113113
> [!NOTE]
114-
> Processing is a community-driven, open-source project. If you have time and interest to help, your contribution would be greatly appreciated! See the [contribution guide](https://github.com/processing/processing4/blob/main/CONTRIBUTING.md) to learn more. And if you need some guidance or support, we're happy to help you get started.
114+
> Processing is a community-driven, open-source project. If you have time and interest to help, your contribution would be greatly appreciated! See the [contribution guide](https://github.com/processing/processing4/blob/main/CONTRIBUTING.md) to learn more. And if you need some guidance or support, we're happy to help you get started.

.github/workflows/release-gradle.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ jobs:
153153
ORG_GRADLE_PROJECT_compose.desktop.mac.notarization.password: ${{ secrets.PROCESSING_APP_PASSWORD }}
154154
ORG_GRADLE_PROJECT_compose.desktop.mac.notarization.teamID: ${{ secrets.PROCESSING_TEAM_ID }}
155155
ORG_GRADLE_PROJECT_snapname: ${{ vars.SNAP_NAME }}
156+
ORG_GRADLE_PROJECT_snapconfinement: ${{ vars.SNAP_CONFINEMENT }}
156157

157158
- name: Sign files with Trusted Signing
158159
if: runner.os == 'Windows'

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ _Note: due to GitHub's limitations, this repository's [Contributors](https://git
313313
<td align="center" valign="top" width="16.66%"><a href="https://github.com/aj-m"><img src="https://avatars.githubusercontent.com/u/2524348?v=4?s=120" width="120px;" alt="Andrew"/><br /><sub><b>Andrew</b></sub></a><br /><a href="https://github.com/processing/processing4/commits?author=aj-m" title="Code">💻</a></td>
314314
<td align="center" valign="top" width="16.66%"><a href="https://github.com/pnngocdoan"><img src="https://avatars.githubusercontent.com/u/113954980?v=4?s=120" width="120px;" alt="Ngoc Doan"/><br /><sub><b>Ngoc Doan</b></sub></a><br /><a href="https://github.com/processing/processing4/commits?author=pnngocdoan" title="Code">💻</a></td>
315315
<td align="center" valign="top" width="16.66%"><a href="https://github.com/manoellribeiro"><img src="https://avatars.githubusercontent.com/u/59377764?v=4?s=120" width="120px;" alt="Manoel Ribeiro"/><br /><sub><b>Manoel Ribeiro</b></sub></a><br /><a href="https://github.com/processing/processing4/commits?author=manoellribeiro" title="Documentation">📖</a></td>
316+
<td align="center" valign="top" width="16.66%"><a href="https://softmoon.world"><img src="https://avatars.githubusercontent.com/u/15107?v=4?s=120" width="120px;" alt="Moon"/><br /><sub><b>Moon</b></sub></a><br /><a href="https://github.com/processing/processing4/commits?author=catilac" title="Code">💻</a></td>
316317
</tr>
317318
</tbody>
318319
</table>

app/build.gradle.kts

Lines changed: 37 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ compose.desktop {
5959
).map { "-D${it.first}=${it.second}" }.toTypedArray())
6060

6161
nativeDistributions{
62-
modules("jdk.jdi", "java.compiler", "jdk.accessibility", "java.management.rmi", "java.scripting")
62+
modules("jdk.jdi", "java.compiler", "jdk.accessibility", "java.management.rmi", "java.scripting", "jdk.httpserver")
6363
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
6464
packageName = "Processing"
6565

@@ -98,6 +98,7 @@ compose.desktop {
9898
dependencies {
9999
implementation(project(":core"))
100100
runtimeOnly(project(":java"))
101+
implementation(project(":app:utils"))
101102

102103
implementation(libs.flatlaf)
103104

@@ -124,6 +125,7 @@ dependencies {
124125
testImplementation(libs.junitJupiterParams)
125126

126127
implementation(libs.clikt)
128+
implementation(libs.kotlinxSerializationJson)
127129
}
128130

129131
tasks.test {
@@ -228,61 +230,44 @@ tasks.register<Exec>("packageCustomMsi"){
228230

229231

230232
tasks.register("generateSnapConfiguration"){
231-
val name = findProperty("snapname") ?: rootProject.name
233+
onlyIf { OperatingSystem.current().isLinux }
234+
235+
val distributable = tasks.named<AbstractJPackageTask>("createDistributable").get()
236+
dependsOn(distributable)
237+
238+
val name = findProperty("snapname") as String? ?: rootProject.name
232239
val arch = when (System.getProperty("os.arch")) {
233240
"amd64", "x86_64" -> "amd64"
234241
"aarch64" -> "arm64"
235242
else -> System.getProperty("os.arch")
236243
}
237-
238-
onlyIf { OperatingSystem.current().isLinux }
239-
val distributable = tasks.named<AbstractJPackageTask>("createDistributable").get()
240-
dependsOn(distributable)
241-
244+
val confinement = findProperty("snapconfinement") as String? ?: "strict"
242245
val dir = distributable.destinationDir.get()
243-
val content = """
244-
name: $name
245-
version: $version
246-
base: core22
247-
summary: A creative coding editor
248-
description: |
249-
Processing is a flexible software sketchbook and a programming language designed for learning how to code.
250-
confinement: strict
251-
252-
apps:
253-
processing:
254-
command: opt/processing/bin/Processing
255-
desktop: opt/processing/lib/processing-Processing.desktop
256-
environment:
257-
LD_LIBRARY_PATH: ${'$'}SNAP/opt/processing/lib/runtime/lib:${'$'}LD_LIBRARY_PATH
258-
LIBGL_DRIVERS_PATH: ${'$'}SNAP/usr/lib/${'$'}SNAPCRAFT_ARCH_TRIPLET/dri
259-
plugs:
260-
- desktop
261-
- desktop-legacy
262-
- wayland
263-
- x11
264-
- network
265-
- opengl
266-
- home
267-
- removable-media
268-
- audio-playback
269-
- audio-record
270-
- pulseaudio
271-
- gpio
272-
273-
parts:
274-
processing:
275-
plugin: dump
276-
source: deb/processing_$version-1_$arch.deb
277-
source-type: deb
278-
stage-packages:
279-
- openjdk-17-jre
280-
override-prime: |
281-
snapcraftctl prime
282-
rm -vf usr/lib/jvm/java-17-openjdk-*/lib/security/cacerts
283-
chmod -R +x opt/processing/lib/app/resources/jdk
284-
""".trimIndent()
285-
dir.file("../snapcraft.yaml").asFile.writeText(content)
246+
val base = layout.projectDirectory.file("linux/snapcraft.base.yml")
247+
248+
doFirst {
249+
250+
var content = base
251+
.asFile
252+
.readText()
253+
.replace("\$name", name)
254+
.replace("\$arch", arch)
255+
.replace("\$version", version as String)
256+
.replace("\$confinement", confinement)
257+
.let {
258+
if (confinement != "classic") return@let it
259+
// If confinement is not strict, remove the PLUGS section
260+
val start = it.indexOf("# PLUGS START")
261+
val end = it.indexOf("# PLUGS END")
262+
if (start != -1 && end != -1) {
263+
val before = it.substring(0, start)
264+
val after = it.substring(end + "# PLUGS END".length)
265+
return@let before + after
266+
}
267+
return@let it
268+
}
269+
dir.file("../snapcraft.yaml").asFile.writeText(content)
270+
}
286271
}
287272

288273
tasks.register<Exec>("packageSnap"){
@@ -424,7 +409,6 @@ tasks.register<Copy>("renameWindres") {
424409
}
425410
tasks.register("includeProcessingResources"){
426411
dependsOn(
427-
"includeJdk",
428412
"includeCore",
429413
"includeJavaMode",
430414
"includeSharedAssets",
@@ -433,6 +417,7 @@ tasks.register("includeProcessingResources"){
433417
"includeJavaModeResources",
434418
"renameWindres"
435419
)
420+
mustRunAfter("includeJdk")
436421
finalizedBy("signResources")
437422
}
438423

@@ -539,6 +524,7 @@ afterEvaluate {
539524
dependsOn("includeProcessingResources")
540525
}
541526
tasks.named("createDistributable").configure {
527+
dependsOn("includeJdk")
542528
finalizedBy("setExecutablePermissions")
543529
}
544530
}

app/linux/snapcraft.base.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: $name
2+
version: $version
3+
base: core22
4+
summary: A creative coding editor
5+
description: |
6+
Processing is a flexible software sketchbook and a programming language designed for learning how to code.
7+
confinement: $confinement
8+
9+
apps:
10+
processing:
11+
command: opt/processing/bin/Processing
12+
desktop: opt/processing/lib/processing-Processing.desktop
13+
environment:
14+
LD_LIBRARY_PATH: $SNAP/opt/processing/lib/runtime/lib:$LD_LIBRARY_PATH
15+
LIBGL_DRIVERS_PATH: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/dri
16+
# PLUGS START
17+
plugs:
18+
- desktop
19+
- desktop-legacy
20+
- wayland
21+
- x11
22+
- network
23+
- opengl
24+
- home
25+
- removable-media
26+
- audio-playback
27+
- audio-record
28+
- pulseaudio
29+
- gpio
30+
# PLUGS END
31+
32+
parts:
33+
processing:
34+
plugin: dump
35+
source: deb/processing_$version-1_$arch.deb
36+
source-type: deb
37+
stage-packages:
38+
- openjdk-17-jre
39+
override-prime: |
40+
snapcraftctl prime
41+
rm -vf usr/lib/jvm/java-17-openjdk-*/lib/security/cacerts
42+
chmod -R +x opt/processing/lib/app/resources/jdk

app/src/processing/app/Base.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -166,18 +166,6 @@ static public void main(final String[] args) {
166166
static private void createAndShowGUI(String[] args) {
167167
// these times are fairly negligible relative to Base.<init>
168168
// long t1 = System.currentTimeMillis();
169-
var preferences = java.util.prefs.Preferences.userRoot().node("org/processing/app");
170-
var installLocations = new ArrayList<>(List.of(preferences.get("installLocations", "").split(",")));
171-
var installLocation = System.getProperty("user.dir") + "^" + Base.getVersionName();
172-
173-
// Check if the installLocation is already in the list
174-
if (!installLocations.contains(installLocation)) {
175-
// Add the installLocation to the list
176-
installLocations.add(installLocation);
177-
178-
// Save the updated list back to preferences
179-
preferences.put("installLocations", String.join(",", installLocations));
180-
}
181169
// TODO: Cleanup old locations if no longer installed
182170
// TODO: Cleanup old locations if current version is installed in the same location
183171

app/src/processing/app/Mode.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import processing.app.ui.Recent;
4141
import processing.app.ui.Toolkit;
4242
import processing.core.PApplet;
43+
import processing.utils.SketchException;
4344

4445

4546
public abstract class Mode {

app/src/processing/app/Platform.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ static public void init() {
105105
"An unknown error occurred while trying to load\n" +
106106
"platform-specific code for your machine.", e);
107107
}
108+
109+
// Fix the issue where `java.home` points to the JRE instead of the JDK. processing/processing4#1163
110+
System.setProperty("java.home", getJavaHome().getAbsolutePath());
108111
}
109112

110113

@@ -389,6 +392,7 @@ static public File getContentFile(String name) {
389392
}
390393

391394
static public File getJavaHome() {
395+
// Get the build in JDK location from the Jetpack Compose resources
392396
var resourcesDir = System.getProperty("compose.application.resources.dir");
393397
if(resourcesDir != null) {
394398
var jdkFolder = new File(resourcesDir,"jdk");
@@ -397,10 +401,13 @@ static public File getJavaHome() {
397401
}
398402
}
399403

404+
// If the JDK is set in the environment, use that.
400405
var home = System.getProperty("java.home");
401406
if(home != null){
402407
return new File(home);
403408
}
409+
410+
// Otherwise try to use the Ant embedded JDK.
404411
if (Platform.isMacOS()) {
405412
//return "Contents/PlugIns/jdk1.7.0_40.jdk/Contents/Home/jre/bin/java";
406413
File[] plugins = getContentFile("../PlugIns").listFiles((dir, name) -> dir.isDirectory() &&

0 commit comments

Comments
 (0)