Skip to content

Commit 0299209

Browse files
committed
Squashed commit of the following:
commit 3a1aa8e Author: Stef Tervelde <[email protected]> Date: Tue Jul 1 12:53:59 2025 +0200 Restore welcome & Cleanup commit 7d94b30 Author: Stef Tervelde <[email protected]> Date: Tue Jul 1 12:20:17 2025 +0200 PR Cleanup commit 27764e9 Author: Stef Tervelde <[email protected]> Date: Mon Jun 23 13:33:50 2025 +0200 Update Toolbar.kt commit 97fc4c2 Author: Stef Tervelde <[email protected]> Date: Mon Jun 23 13:30:47 2025 +0200 Removed background job differentiation commit 85566c8 Author: Stef Tervelde <[email protected]> Date: Mon Jun 23 13:09:11 2025 +0200 CLI Compatibility commit 7f2f2b6 Merge: 1c8581e bf34ade Author: Stef Tervelde <[email protected]> Date: Mon Jun 23 11:14:57 2025 +0200 Merge branch 'main' into runner commit 1c8581e Author: Stef Tervelde <[email protected]> Date: Thu May 15 13:39:21 2025 +0200 Move Gradle connection into GradleJob commit d742002 Author: Stef Tervelde <[email protected]> Date: Thu May 15 10:10:33 2025 +0200 Exclude jnilib from sources commit 2c9ee1c Author: Stef Tervelde <[email protected]> Date: Thu May 15 09:51:08 2025 +0200 Linux Platform addition commit 49988e9 Author: Stef Tervelde <[email protected]> Date: Thu May 15 09:34:44 2025 +0200 Use forward slashes on Windows commit da5092e Author: Stef Tervelde <[email protected]> Date: Thu May 15 09:10:11 2025 +0200 Add support for .java files & Cleanup commit ab7c216 Author: Stef Tervelde <[email protected]> Date: Thu May 15 08:15:11 2025 +0200 Preferences in the PDE will now be read from system before looking at files commit 7775d01 Author: Stef Tervelde <[email protected]> Date: Wed May 14 18:07:50 2025 +0200 Identified Bugs commit 80c48f2 Author: Stef Tervelde <[email protected]> Date: Wed May 14 17:59:07 2025 +0200 Windows Bugfix commit 5ad43e0 Author: Stef Tervelde <[email protected]> Date: Wed May 14 17:51:57 2025 +0200 Set a default tab size commit 2f99a69 Author: Stef Tervelde <[email protected]> Date: Wed May 14 16:14:59 2025 +0200 Bundle necessary plugins commit f9b94c5 Author: Stef Tervelde <[email protected]> Date: Wed May 14 15:17:55 2025 +0200 Only make parent dirs commit 982c111 Author: Stef Tervelde <[email protected]> Date: Wed May 14 15:11:54 2025 +0200 Show debug on gradle tests commit 917d0d3 Author: Stef Tervelde <[email protected]> Date: Wed May 14 15:08:47 2025 +0200 Listen for folder changes commit 12ce442 Author: Stef Tervelde <[email protected]> Date: Wed May 14 14:25:06 2025 +0200 Fix saved files using an old version commit 04ac9f2 Author: Stef Tervelde <[email protected]> Date: Wed May 14 13:47:21 2025 +0200 Plugin rework for caching heavy work commit e31d37d Merge: df1277e 540d299 Author: Stef Tervelde <[email protected]> Date: Wed May 14 10:43:43 2025 +0200 Merge branch 'main' into runner commit df1277e Author: Stef Tervelde <[email protected]> Date: Wed May 14 10:39:22 2025 +0200 Disabled modern UI for now. Added preference instead commit c5c3b2f Author: Stef Tervelde <[email protected]> Date: Mon Apr 21 14:04:39 2025 +0200 Added todos commit 612126a Merge: 3e89bfe ecd219b Author: Stef Tervelde <[email protected]> Date: Thu Apr 17 12:37:06 2025 +0200 Merge branch 'main' into runner commit 3e89bfe Merge: efa77bb 7489870 Author: Stef Tervelde <[email protected]> Date: Thu Apr 17 12:34:57 2025 +0200 Merge branch 'runner' of https://github.com/Stefterv/processing4 into runner commit efa77bb Author: Stef Tervelde <[email protected]> Date: Tue Apr 1 18:19:58 2025 +0200 Cleanup [skip ci] commit 7489870 Author: Stef Tervelde <[email protected]> Date: Tue Apr 1 18:19:58 2025 +0200 Cleanup [skip ci] commit 97ec5e4 Merge: 221ee28 3d6a6ce Author: Stef Tervelde <[email protected]> Date: Tue Apr 1 17:54:41 2025 +0200 Merge branch 'gradle-welcome-screen' into runner commit 221ee28 Author: Stef Tervelde <[email protected]> Date: Tue Apr 1 17:53:48 2025 +0200 Toolbar UI design start commit a870cd0 Author: Stef Tervelde <[email protected]> Date: Tue Apr 1 10:14:22 2025 +0200 GradleJob Refactor commit 2269fd3 Author: Stef Tervelde <[email protected]> Date: Tue Apr 1 09:15:47 2025 +0200 Gradle Runner, build script management commit 6758d68 Author: Stef Tervelde <[email protected]> Date: Mon Mar 31 18:40:19 2025 +0200 Richer console output and richer exception output commit 15114a1 Author: Stef Tervelde <[email protected]> Date: Mon Mar 31 15:00:12 2025 +0200 Retry vm debug connection commit 36ce0ab Author: Stef Tervelde <[email protected]> Date: Mon Mar 31 12:05:58 2025 +0200 Runner: Fixing build errors commit 701f9f5 Author: Stef Tervelde <[email protected]> Date: Sun Mar 30 23:58:36 2025 +0200 Gradle Runner PoC Refactor commit 947a90e Author: Stef Tervelde <[email protected]> Date: Sun Mar 30 14:51:48 2025 +0200 Toolbar functionality PoC commit 3d6a6ce Merge: f7f22c5 2222331 Author: Stef Tervelde <[email protected]> Date: Sun Mar 30 08:52:37 2025 +0200 Merge branch 'processing:main' into gradle-welcome-screen commit 4602ef1 Author: Stef Tervelde <[email protected]> Date: Sat Mar 29 22:50:35 2025 +0100 Fixes for windows commit 0d3795f Author: Stef Tervelde <[email protected]> Date: Sat Mar 29 22:31:47 2025 +0100 Gradle Runner, more variables commit ab38e5f Author: Stef Tervelde <[email protected]> Date: Sat Mar 29 20:54:02 2025 +0100 Arguments refactor commit 17acb01 Author: Stef Tervelde <[email protected]> Date: Sat Mar 29 20:10:15 2025 +0100 Copy running JDK rather than download commit b534c26 Merge: d6cb3ee 2222331 Author: Stef Tervelde <[email protected]> Date: Sat Mar 29 18:17:20 2025 +0100 Merge branch 'main' into runner commit d6cb3ee Author: Stef Tervelde <[email protected]> Date: Sat Mar 29 10:20:17 2025 +0100 Fix for signing release commit bf82d53 Merge: 73dfa0a dd823a7 Author: Stef Tervelde <[email protected]> Date: Sat Mar 29 10:17:06 2025 +0100 Merge branch 'runner' of https://github.com/Stefterv/processing4 into runner commit 73dfa0a Author: Stef Tervelde <[email protected]> Date: Sat Mar 29 10:17:04 2025 +0100 Only sign with signing set up commit 41ef1cc Author: Stef Tervelde <[email protected]> Date: Fri Mar 28 09:00:23 2025 +0100 Fix plugin name in tests commit dd823a7 Author: Stef Tervelde <[email protected]> Date: Fri Mar 28 09:00:23 2025 +0100 Fix plugin name in tests commit 3a14ff4 Author: Stef Tervelde <[email protected]> Date: Fri Mar 28 08:18:53 2025 +0100 Added Stubs commit 00f8afa Merge: 700599e 1ab2359 Author: Stef Tervelde <[email protected]> Date: Fri Mar 28 08:13:11 2025 +0100 Merge branch 'schema-threading' into runner commit 700599e Merge: 1fae461 499d200 Author: Stef Tervelde <[email protected]> Date: Fri Mar 28 08:13:06 2025 +0100 Merge branch 'main' into runner commit 1fae461 Author: Stef Tervelde <[email protected]> Date: Thu Mar 27 21:37:55 2025 +0100 UI Cleanup commit f762a3e Author: Stef Tervelde <[email protected]> Date: Thu Mar 27 20:05:01 2025 +0100 Added debugging commit c2071a0 Merge: f453eca 8fb9ef5 Author: Stef Tervelde <[email protected]> Date: Thu Mar 27 18:23:23 2025 +0100 Merge branch 'hide-scrollbars' into runner commit f453eca Merge: 8f47d21 694eb0c Author: Stef Tervelde <[email protected]> Date: Thu Mar 27 18:03:34 2025 +0100 Merge remote-tracking branch 'upstream/fix-jdk-requirement' into runner commit 8f47d21 Author: Stef Tervelde <[email protected]> Date: Thu Mar 27 18:00:15 2025 +0100 Scan libaries for dependencies commit 5d71244 Author: Stef Tervelde <[email protected]> Date: Thu Mar 27 14:58:11 2025 +0100 Plugin rework commit e164fe4 Author: Stef Tervelde <[email protected]> Date: Thu Mar 27 13:01:33 2025 +0100 Gradle variables from Processing, Group resolution commit 672c2ac Author: Stef Tervelde <[email protected]> Date: Thu Mar 27 11:51:08 2025 +0100 Removed the need for settings.gradle.kts & Embedding maven repo commit cdec594 Author: Stef Tervelde <[email protected]> Date: Wed Mar 26 18:39:04 2025 +0100 Added export support commit 3ad3654 Author: Stef Tervelde <[email protected]> Date: Wed Mar 26 17:25:51 2025 +0100 Gradle Runner visual styling commit bc063e8 Author: Stef Tervelde <[email protected]> Date: Wed Mar 26 14:17:25 2025 +0100 Gradle Runner PoC commit 47d3428 Author: Stef Tervelde <[email protected]> Date: Sun Mar 23 18:18:54 2025 +0100 More todo's commit 29d76eb Merge: ba49656 9760a63 Author: Stef Tervelde <[email protected]> Date: Sun Mar 23 17:58:39 2025 +0100 Merge branch 'processing:main' into gradle-plugin commit ba49656 Author: Stef Tervelde <[email protected]> Date: Tue Mar 18 10:15:40 2025 +0100 Adding tests and direct linking commit e01d02a Author: Stef Tervelde <[email protected]> Date: Mon Mar 17 15:31:25 2025 +0100 Update settings.gradle.kts commit b0b12dd Merge: 7e6c97a ad5c27e Author: Stef Tervelde <[email protected]> Date: Mon Mar 17 15:14:35 2025 +0100 Merge branch 'gradle-preprocessor' into gradle-plugin commit ad5c27e Author: Stef Tervelde <[email protected]> Date: Mon Mar 17 15:11:24 2025 +0100 Apply same parser & lexer fixes from before commit 743ea14 Merge: c28a267 8e8f7dc Author: Stef Tervelde <[email protected]> Date: Mon Mar 17 13:53:40 2025 +0100 Merge branch 'main' into gradle-preprocessor commit 7e6c97a Merge: f126d4b 8e8f7dc Author: Stef Tervelde <[email protected]> Date: Mon Mar 17 13:43:21 2025 +0100 Merge branch 'main' into gradle-plugin commit f7f22c5 Author: Stef Tervelde <[email protected]> Date: Mon Mar 17 10:40:37 2025 +0100 Create Directory as well commit d17ca0c Author: Stef Tervelde <[email protected]> Date: Mon Mar 17 10:36:35 2025 +0100 Removed PlatformStart and create new file if doesn't exist commit b0e7f96 Author: Stef Tervelde <[email protected]> Date: Mon Mar 17 10:28:12 2025 +0100 Added initial tests commit 0df4dc0 Merge: 6974811 8e8f7dc Author: Stef Tervelde <[email protected]> Date: Sun Mar 16 21:18:22 2025 +0100 Merge branch 'main' into gradle-welcome-screen commit 6974811 Merge: 7452d65 1455512 Author: Stef Tervelde <[email protected]> Date: Tue Mar 11 20:42:46 2025 +0100 Merge branch 'test-schema' into gradle-welcome-screen commit 7452d65 Merge: babf54e fe152b7 Author: Stef Tervelde <[email protected]> Date: Fri Mar 7 15:07:56 2025 +0100 Merge branch 'main' into gradle-welcome-screen commit c28a267 Merge: e188336 fe152b7 Author: Stef Tervelde <[email protected]> Date: Fri Mar 7 15:06:27 2025 +0100 Merge branch 'processing:main' into gradle-preprocessor commit f126d4b Merge: da852b4 fe152b7 Author: Stef Tervelde <[email protected]> Date: Fri Mar 7 15:06:08 2025 +0100 Merge branch 'processing:main' into gradle-plugin commit babf54e Merge: 0e56f89 00c5760 Author: Stef Tervelde <[email protected]> Date: Mon Feb 10 17:58:35 2025 +0100 Merge branch 'gradle-loggin' into gradle-welcome-screen commit 0e56f89 Merge: 54944af 29b557a Author: Stef Tervelde <[email protected]> Date: Sun Feb 9 21:15:36 2025 +0100 Merge branch 'main-gradle' into gradle-welcome-screen commit 54944af Author: Stef Tervelde <[email protected]> Date: Sun Feb 9 14:36:37 2025 +0100 Welcome Screen: JDK Module commit 8d8bd01 Author: Stef Tervelde <[email protected]> Date: Sun Feb 9 13:54:07 2025 +0100 Welcome Screen: Close Functionality commit 3df4da9 Author: Stef Tervelde <[email protected]> Date: Sun Feb 9 12:57:55 2025 +0100 Welcome Screen: Bugfixes commit cb184fb Author: Stef Tervelde <[email protected]> Date: Sun Feb 9 12:19:33 2025 +0100 Welcome Screen: Layout fixes commit 3d81b02 Author: Stef Tervelde <[email protected]> Date: Sat Feb 8 22:47:28 2025 +0100 Welcome Screen: Language selection commit b0c61a4 Author: Stef Tervelde <[email protected]> Date: Sat Feb 8 11:10:33 2025 +0100 Welcome Screen: Load & Display examples commit 2f12d13 Author: Stef Tervelde <[email protected]> Date: Fri Feb 7 21:53:49 2025 +0100 Saveable/Reactive Preferences commit 8ed2d1b Author: Stef Tervelde <[email protected]> Date: Fri Feb 7 16:34:23 2025 +0100 Welcome Screen: WIP commit 5c020dd Author: Stef Tervelde <[email protected]> Date: Fri Feb 7 15:49:25 2025 +0100 Welcome Screen: Initial Layout commit bd3a77e Author: Stef Tervelde <[email protected]> Date: Fri Feb 7 12:09:58 2025 +0100 Welcome Screen: Window Abstraction commit b1910de Author: Stef Tervelde <[email protected]> Date: Fri Feb 7 11:24:30 2025 +0100 Welcome Screen: Initial Frame commit da852b4 Author: Stef Tervelde <[email protected]> Date: Wed Feb 5 20:54:32 2025 +0100 Fullscreen support commit 44ab816 Author: Stef Tervelde <[email protected]> Date: Wed Feb 5 20:38:27 2025 +0100 disable full screen from settings and fixed a few bugs commit e188336 Merge: df745bb 3f3e7d7 Author: Stef Tervelde <[email protected]> Date: Wed Feb 5 13:03:51 2025 +0100 Merge branch 'main-gradle' into gradle/preprocessor commit 031d304 Merge: 25e147e 3f3e7d7 Author: Stef Tervelde <[email protected]> Date: Wed Feb 5 13:03:12 2025 +0100 Merge branch 'main-gradle' into gradle/plugin commit 25e147e Merge: 7f00d5b 3b9aea1 Author: Stef Tervelde <[email protected]> Date: Wed Feb 5 12:56:55 2025 +0100 Merge branch 'main-gradle' into gradle/plugin commit df745bb Merge: f016cc4 3b9aea1 Author: Stef Tervelde <[email protected]> Date: Wed Feb 5 12:56:38 2025 +0100 Merge branch 'main-gradle' into gradle/preprocessor commit 7f00d5b Author: Stef Tervelde <[email protected]> Date: Wed Feb 5 12:36:18 2025 +0100 added example of plugin usage commit f4d7fbf Author: Stef Tervelde <[email protected]> Date: Wed Feb 5 09:19:08 2025 +0100 Changed naming commit 1b8a8ed Author: Stef Tervelde <[email protected]> Date: Wed Feb 5 09:10:42 2025 +0100 Gradle Plugin from PoC commit 5468da0 Author: Stef Tervelde <[email protected]> Date: Tue Feb 4 16:18:29 2025 +0100 Removed outdated ant backwards compatibility marks commit 23c8a46 Author: Stef Tervelde <[email protected]> Date: Mon Feb 3 12:07:01 2025 +0100 - Imports cleanup - Disable system look & feel on macOS for readability - Cleaned unnecessary space - Cleaned finished TODO commit f016cc4 Author: Stef Tervelde <[email protected]> Date: Wed Feb 5 12:01:47 2025 +0100 Removed core dependency from the pre-processor commit 971d98b Author: Stef Tervelde <[email protected]> Date: Thu Jan 30 22:59:16 2025 +0100 Preprocessor with antlr Plugin
1 parent 9de5e36 commit 0299209

Some content is hidden

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

50 files changed

+2704
-89
lines changed

.gitignore

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,20 +98,27 @@ bin-test
9898
processing-examples
9999

100100
# Maven ignores
101+
.kotlin
101102
.gradle
102-
core/build/
103-
build/publish/
104-
app/build
105-
java/build/
103+
.build/
104+
/core/build/
105+
/build/publish/
106+
/app/build
107+
/java/build/
106108
/build/reports
107109
/java/bin
108110
/java/libraries/svg/bin
109111
/java/preprocessor/build
110112
/java/lsp/build
111-
/.kotlin/sessions
112-
/core/examples/build
113-
114-
.build/
115-
/app/windows/obj
116113
/java/gradle/build
114+
/core/examples/build
117115
/java/gradle/example/.processing
116+
/app/windows/obj
117+
/java/android/example/build
118+
/java/android/example/.processing
119+
/java/gradle/example/build
120+
/java/gradle/example/gradle/wrapper/gradle-wrapper.jar
121+
/java/gradle/example/gradle/wrapper/gradle-wrapper.properties
122+
/java/gradle/example/gradlew
123+
/java/gradle/example/gradlew.bat
124+
/java/gradle/example/.kotlin/errors

.idea/jarRepositories.xml

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package processing.app.gradle;
2+
3+
import processing.app.ui.Editor;
4+
5+
public class GradleService {
6+
public GradleService(Editor editor) { }
7+
8+
public void setEnabled(boolean enabled) {}
9+
public boolean getEnabled() { return false; }
10+
public void prepare(){}
11+
public void run() {}
12+
public void export(){}
13+
public void stop() {}
14+
public void startService() {}
15+
}

app/build.gradle.kts

Lines changed: 21 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import org.gradle.internal.jvm.Jvm
2+
import org.gradle.kotlin.dsl.support.zipTo
23
import org.gradle.internal.os.OperatingSystem
34
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
5+
import org.jetbrains.compose.ExperimentalComposeLibrary
46
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
57
import org.jetbrains.compose.desktop.application.tasks.AbstractJPackageTask
68
import org.jetbrains.compose.internal.de.undercouch.gradle.tasks.download.Download
@@ -49,14 +51,18 @@ compose.desktop {
4951
application {
5052
mainClass = "processing.app.ProcessingKt"
5153

52-
jvmArgs(*listOf(
53-
Pair("processing.version", rootProject.version),
54-
Pair("processing.revision", findProperty("revision") ?: Int.MAX_VALUE),
55-
Pair("processing.contributions.source", "https://contributions.processing.org/contribs"),
56-
Pair("processing.download.page", "https://processing.org/download/"),
57-
Pair("processing.download.latest", "https://processing.org/download/latest.txt"),
58-
Pair("processing.tutorials", "https://processing.org/tutorials/"),
59-
).map { "-D${it.first}=${it.second}" }.toTypedArray())
54+
55+
val variables = mapOf(
56+
"processing.group" to (rootProject.group.takeIf { it != "" } ?: "processing"),
57+
"processing.version" to rootProject.version,
58+
"processing.revision" to (findProperty("revision") ?: Int.MAX_VALUE),
59+
"processing.contributions.source" to "https://contributions.processing.org/contribs",
60+
"processing.download.page" to "https://processing.org/download/",
61+
"processing.download.latest" to "https://processing.org/download/latest.txt",
62+
"processing.tutorials" to "https://processing.org/tutorials/"
63+
)
64+
65+
jvmArgs(*variables.entries.map { "-D${it.key}=${it.value}" }.toTypedArray())
6066

6167
nativeDistributions{
6268
modules("jdk.jdi", "java.compiler", "jdk.accessibility", "java.management.rmi", "java.scripting")
@@ -110,20 +116,21 @@ dependencies {
110116
implementation(compose.ui)
111117
implementation(compose.components.resources)
112118
implementation(compose.components.uiToolingPreview)
119+
implementation(compose.materialIconsExtended)
113120

114121
implementation(compose.desktop.currentOs)
115122

116123
implementation(libs.compottie)
117124
implementation(libs.kaml)
118125
implementation(libs.markdown)
119126
implementation(libs.markdownJVM)
127+
implementation(gradleApi())
128+
implementation(libs.clikt)
120129

121130
testImplementation(kotlin("test"))
122131
testImplementation(libs.mockitoKotlin)
123132
testImplementation(libs.junitJupiter)
124133
testImplementation(libs.junitJupiterParams)
125-
126-
implementation(libs.clikt)
127134
}
128135

129136
tasks.test {
@@ -405,23 +412,6 @@ tasks.register<Copy>("includeJavaModeResources") {
405412
from(java.layout.buildDirectory.dir("resources-bundled"))
406413
into(composeResources("../"))
407414
}
408-
// TODO: Move to java mode
409-
tasks.register<Copy>("renameWindres") {
410-
dependsOn("includeSharedAssets","includeJavaModeResources")
411-
val dir = composeResources("modes/java/application/launch4j/bin/")
412-
val os = DefaultNativePlatform.getCurrentOperatingSystem()
413-
val platform = when {
414-
os.isWindows -> "windows"
415-
os.isMacOsX -> "macos"
416-
else -> "linux"
417-
}
418-
from(dir) {
419-
include("*-$platform*")
420-
rename("(.*)-$platform(.*)", "$1$2")
421-
}
422-
duplicatesStrategy = DuplicatesStrategy.INCLUDE
423-
into(dir)
424-
}
425415
tasks.register("includeProcessingResources"){
426416
dependsOn(
427417
"includeJdk",
@@ -430,8 +420,7 @@ tasks.register("includeProcessingResources"){
430420
"includeSharedAssets",
431421
"includeProcessingExamples",
432422
"includeProcessingWebsiteExamples",
433-
"includeJavaModeResources",
434-
"renameWindres"
423+
"includeJavaModeResources"
435424
)
436425
finalizedBy("signResources")
437426
}
@@ -510,9 +499,9 @@ tasks.register("signResources"){
510499
}
511500
file(composeResources("Info.plist")).delete()
512501
}
502+
}
513503

514504

515-
}
516505
tasks.register("setExecutablePermissions") {
517506
description = "Sets executable permissions on binaries in Processing.app resources"
518507
group = "compose desktop"
@@ -537,6 +526,8 @@ tasks.register("setExecutablePermissions") {
537526
afterEvaluate {
538527
tasks.named("prepareAppResources").configure {
539528
dependsOn("includeProcessingResources")
529+
// Make sure all libraries are bundled in the maven repository distributed with the app
530+
dependsOn(listOf("core","java:preprocessor", "java:gradle").map { project(":$it").tasks.named("publishAllPublicationsToAppRepository") })
540531
}
541532
tasks.named("createDistributable").configure {
542533
finalizedBy("setExecutablePermissions")

app/src/main/resources/defaults.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,9 @@ console.temp.days = 7
186186
console.scrollback.lines = 500
187187
console.scrollback.chars = 40000
188188

189+
# run java sketches with Gradle aka the Modern Build System
190+
run.use_gradle = false
191+
189192
# Any additional Java options when running.
190193
# If you change this and can't run things, it's your own durn fault.
191194
run.options =

app/src/processing/app/Language.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,6 @@ static public Language init() {
183183
return instance;
184184
}
185185

186-
187186
static private String get(String key) {
188187
LanguageBundle bundle = init().bundle;
189188

app/src/processing/app/Preferences.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,8 @@ static public String getSketchbookPath() {
393393

394394

395395
static protected void setSketchbookPath(String path) {
396+
// Unify path seperator for all platforms
397+
path = path.replace(File.separatorChar, '/');
396398
set("sketchbook.path.four", path); //$NON-NLS-1$
397399
}
398400
}

app/src/processing/app/Processing.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import com.github.ajalt.clikt.parameters.arguments.multiple
1010
import com.github.ajalt.clikt.parameters.options.flag
1111
import com.github.ajalt.clikt.parameters.options.help
1212
import com.github.ajalt.clikt.parameters.options.option
13+
import processing.app.gradle.api.Sketch
1314
import processing.app.ui.Start
1415

1516
class Processing: SuspendingCliktCommand("processing"){
@@ -40,7 +41,8 @@ suspend fun main(args: Array<String>){
4041
Processing()
4142
.subcommands(
4243
LSP(),
43-
LegacyCLI(args)
44+
LegacyCLI(args),
45+
Sketch()
4446
)
4547
.main(args)
4648
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package processing.app.gradle
2+
3+
import com.sun.jdi.Bootstrap
4+
import com.sun.jdi.VirtualMachine
5+
import com.sun.jdi.connect.AttachingConnector
6+
import kotlinx.coroutines.delay
7+
import processing.app.Messages
8+
import kotlin.time.Duration.Companion.seconds
9+
import kotlin.time.TimeSource
10+
11+
class Debugger {
12+
companion object {
13+
suspend fun connect(port: Int?): VirtualMachine? {
14+
try {
15+
Messages.log("Attaching to VM $port")
16+
val connector = Bootstrap.virtualMachineManager().allConnectors()
17+
.firstOrNull { it.name() == "com.sun.jdi.SocketAttach" }
18+
as AttachingConnector?
19+
?: throw IllegalStateException("No socket attach connector found")
20+
val args = connector.defaultArguments()
21+
args["port"]?.setValue(port?.toString() ?: "5005")
22+
23+
// Try to attach the debugger, retrying if it fails
24+
val start = TimeSource.Monotonic.markNow()
25+
while (start.elapsedNow() < 10.seconds) {
26+
try {
27+
val sketch = connector.attach(args)
28+
sketch.resume()
29+
Messages.log("Attached to VM: ${sketch.name()}")
30+
return sketch
31+
} catch (e: Exception) {
32+
Messages.log("Error while attaching to VM: ${e.message}... Retrying")
33+
}
34+
delay(250)
35+
}
36+
} catch (e: Exception) {
37+
Messages.log("Error while attaching to VM: ${e.message}")
38+
return null
39+
}
40+
return null
41+
}
42+
}
43+
}
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
package processing.app.gradle
2+
3+
import com.sun.jdi.ObjectReference
4+
import com.sun.jdi.StackFrame
5+
import com.sun.jdi.StringReference
6+
import com.sun.jdi.VirtualMachine
7+
import com.sun.jdi.event.ExceptionEvent
8+
import com.sun.jdi.request.EventRequest
9+
import kotlinx.coroutines.CoroutineScope
10+
import kotlinx.coroutines.Dispatchers
11+
import kotlinx.coroutines.delay
12+
import kotlinx.coroutines.launch
13+
import processing.app.Messages
14+
15+
// TODO: Consider adding a panel to the footer
16+
class Exceptions {
17+
companion object {
18+
suspend fun listen(vm: VirtualMachine) {
19+
try {
20+
val manager = vm.eventRequestManager()
21+
22+
val request = manager.createExceptionRequest(null, false, true)
23+
request.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD)
24+
request.enable()
25+
26+
val queue = vm.eventQueue()
27+
while (true) {
28+
val eventSet = queue.remove()
29+
for (event in eventSet) {
30+
if (event is ExceptionEvent) {
31+
printExceptionDetails(event)
32+
event.thread().resume()
33+
}
34+
}
35+
eventSet.resume()
36+
delay(10)
37+
}
38+
} catch (e: Exception) {
39+
Messages.log("Error while listening for exceptions: ${e.message}")
40+
}
41+
}
42+
43+
fun printExceptionDetails(event: ExceptionEvent) {
44+
val exception = event.exception()
45+
val thread = event.thread()
46+
val location = event.location()
47+
val stackFrames = thread.frames()
48+
49+
println("\n🚨 Exception Caught 🚨")
50+
println("Type : ${exception.referenceType().name()}")
51+
// TODO: Fix exception message retrieval
52+
// println("Message : ${getExceptionMessage(exception)}")
53+
println("Thread : ${thread.name()}")
54+
println("Location : ${location.sourcePath()}:${location.lineNumber()}\n")
55+
56+
// TODO: Map to .pde file again
57+
// TODO: Communicate back to Editor
58+
59+
// Separate stack frames
60+
val userFrames = mutableListOf<StackFrame>()
61+
val processingFrames = mutableListOf<StackFrame>()
62+
63+
stackFrames.forEach { frame ->
64+
val className = frame.location().declaringType().name()
65+
if (className.startsWith("processing.")) {
66+
processingFrames.add(frame)
67+
} else {
68+
userFrames.add(frame)
69+
}
70+
}
71+
72+
// Print user frames first
73+
println("🔍 Stacktrace (Your Code First):")
74+
userFrames.forEachIndexed { index, frame -> printStackFrame(index, frame) }
75+
76+
// Print Processing frames second
77+
if (processingFrames.isNotEmpty()) {
78+
println("\n🔧 Processing Stacktrace (Hidden Initially):")
79+
processingFrames.forEachIndexed { index, frame -> printStackFrame(index, frame) }
80+
}
81+
82+
println("──────────────────────────────────\n")
83+
}
84+
85+
fun printStackFrame(index: Int, frame: StackFrame) {
86+
val location = frame.location()
87+
val method = location.method()
88+
println(
89+
" #$index ${location.sourcePath()}:${location.lineNumber()} -> ${
90+
method.declaringType().name()
91+
}.${method.name()}()"
92+
)
93+
}
94+
95+
// Extracts the exception's message
96+
fun getExceptionMessage(exception: ObjectReference): String {
97+
val messageMethod = exception.referenceType().methodsByName("getMessage").firstOrNull() ?: return "Unknown"
98+
val messageValue =
99+
exception.invokeMethod(null, messageMethod, emptyList(), ObjectReference.INVOKE_SINGLE_THREADED)
100+
return (messageValue as? StringReference)?.value() ?: "Unknown"
101+
}
102+
}
103+
}

0 commit comments

Comments
 (0)