diff --git a/app/src/processing/app/gradle/GradleService.kt b/app/src/processing/app/gradle/GradleService.kt index 9b22e4e33..4e8bfde0a 100644 --- a/app/src/processing/app/gradle/GradleService.kt +++ b/app/src/processing/app/gradle/GradleService.kt @@ -20,10 +20,9 @@ import kotlin.io.path.writeText // TODO: Test running examples // TODO: Report failures to the console // TODO: Highlight errors in the editor -// TODO: Stop running sketches if modern build system is turned off // TODO: ---- FUTURE ---- -// TODO: Improve progress tracking +// TODO: Improve progress tracking and show it in the UI // TODO: PoC new debugger/tweak mode // TODO: Allow for plugins to skip gradle entirely / new modes // TODO: Add background building @@ -196,6 +195,7 @@ class GradleService( private fun BuildLauncher.setup(extraArguments: List = listOf()) { + // TODO: Instead of shipping Processing with a build-in JDK we should download the JDK through Gradle setJavaHome(Platform.getJavaHome()) val arguments = setupGradle() @@ -208,6 +208,7 @@ class GradleService( return active.value } fun setEnabled(active: Boolean) { + if(!active) stopActions() this.active.value = active } } \ No newline at end of file diff --git a/app/src/processing/app/ui/EditorConsole.java b/app/src/processing/app/ui/EditorConsole.java index 57724970d..c8c40ee48 100644 --- a/app/src/processing/app/ui/EditorConsole.java +++ b/app/src/processing/app/ui/EditorConsole.java @@ -81,7 +81,7 @@ public class EditorConsole extends JScrollPane { sketchOut = new PrintStream(new EditorConsoleStream(false)); sketchErr = new PrintStream(new EditorConsoleStream(true)); - + startTimer(); } diff --git a/java/README.md b/java/README.md index a4be6e9a8..0a905208d 100644 --- a/java/README.md +++ b/java/README.md @@ -3,8 +3,9 @@ This the Java Mode in Processing. It compiles your sketches and runs them. It is the primary mode of Processing. ## Folders -- `application` assets for exporting applications within the mode -- `generated` generated antlr code for the mode, should be moved to a proper `antlr` plugin within gradle +- `application` assets for exporting applications within the mode (Deprecated) +- `generated` generated antlr code for the mode, should be moved to a proper `antlr` plugin within gradle (Deprecated) +- `gradle` the Processing java gradle plugin - `libraries` libraries that are available within the mode - `lsp` gradle build system for the language server protocol, in the future we should decouple the lsp from the java mode and pde and move all relevant code here. For now it can be found in `src/.../lsp` - `mode` legacy files for `Ant` @@ -13,8 +14,25 @@ This the Java Mode in Processing. It compiles your sketches and runs them. It is - `test` tests for the mode - `theme` assets for the mode, related to autocomplete and syntax highlighting -## Future plans -- Decouple the `lsp` and `preprocessor` from the mode and move them to their own repositories -- Move the `antlr` code to a proper plugin within gradle -- Create a gradle plugin to convert `.pde` file to `.java` files -- Create a gradle based version of Java mode. \ No newline at end of file +## The Modern Build system + +Since 2025 work has started on creating a new internal build system for the Java Mode based on Gradle. +The goal is to simplify by leaning more on Gradle, which provides a lot of the functionality that was build before out of the box and a lot more. + +### How it used to work + +The build system used to be based on some parts Ant, some parts eclipse (org.eclipse.jdt.core) and a lot of custom work build up over the years. + +### How it will work going forward + +The modern build system is based around Gradle, the main service (GradleService) for building a sketch with Gradle is included in `app` instead of into the Java mode as future modes are most likely also based on Gradle if they use `core` in some way. Most _Modes_ should/could probably be a Gradle plugin going forward. +Breaking the build system away from the java mode will mean that we create an island of isolation when it comes to the build system, allowing contributors to work on the build system without running the editor. +Another upside is that when we publish the Gradle plugin to the Gradle Plugin repository, it will become trivial to run Processing sketches outside the PDE and improvements made to the build system will be usable for everyone. +There is now also an opportunity for creating contributions that modify the build system in more subtle ways rather than having to make a complete new mode, e.g. a compilation step for shaders or some setup tweaks to make JavaFX work out of the box. +Furthermore, this change will embed Processing more into the wider Java ecosystem, if users want to upgrade from using Processing to Java whilst still using `core` that will become possible and won't need a rewrite of what they already created. + +### How to work on the modern build system + +If you want to work on the build system without the PDE, open `/java/gradle/example` into a new intellij IDEA window, this is set up to compile the Processing Java plugin and run sketches standalone. + +Within the editor, the gradle plugin is embedded in Processing's embedded maven repository so that Gradle can find it. \ No newline at end of file diff --git a/java/gradle/example/.idea/.name b/java/gradle/example/.idea/.name new file mode 100644 index 000000000..fb61c9d80 --- /dev/null +++ b/java/gradle/example/.idea/.name @@ -0,0 +1 @@ +processing-gradle-plugin-demo \ No newline at end of file diff --git a/java/gradle/example/.idea/compiler.xml b/java/gradle/example/.idea/compiler.xml new file mode 100644 index 000000000..b589d56e9 --- /dev/null +++ b/java/gradle/example/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/java/gradle/example/.idea/misc.xml b/java/gradle/example/.idea/misc.xml index 822aa1a0c..5a50b6cd2 100644 --- a/java/gradle/example/.idea/misc.xml +++ b/java/gradle/example/.idea/misc.xml @@ -1,5 +1,5 @@ - + \ No newline at end of file