Skip to content

Commit e6474e1

Browse files
committed
Small tweaks and wrote motivation for Gradle Build system
1 parent 67de82f commit e6474e1

File tree

6 files changed

+37
-11
lines changed

6 files changed

+37
-11
lines changed

app/src/processing/app/gradle/GradleService.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,9 @@ import kotlin.io.path.writeText
2020
// TODO: Test running examples
2121
// TODO: Report failures to the console
2222
// TODO: Highlight errors in the editor
23-
// TODO: Stop running sketches if modern build system is turned off
2423

2524
// TODO: ---- FUTURE ----
26-
// TODO: Improve progress tracking
25+
// TODO: Improve progress tracking and show it in the UI
2726
// TODO: PoC new debugger/tweak mode
2827
// TODO: Allow for plugins to skip gradle entirely / new modes
2928
// TODO: Add background building
@@ -196,6 +195,7 @@ class GradleService(
196195

197196

198197
private fun BuildLauncher.setup(extraArguments: List<String> = listOf()) {
198+
// TODO: Instead of shipping Processing with a build-in JDK we should download the JDK through Gradle
199199
setJavaHome(Platform.getJavaHome())
200200

201201
val arguments = setupGradle()
@@ -208,6 +208,7 @@ class GradleService(
208208
return active.value
209209
}
210210
fun setEnabled(active: Boolean) {
211+
if(!active) stopActions()
211212
this.active.value = active
212213
}
213214
}

app/src/processing/app/ui/EditorConsole.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public EditorConsole(Editor editor) {
8181

8282
sketchOut = new PrintStream(new EditorConsoleStream(false));
8383
sketchErr = new PrintStream(new EditorConsoleStream(true));
84-
84+
8585
startTimer();
8686
}
8787

java/README.md

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
This the Java Mode in Processing. It compiles your sketches and runs them. It is the primary mode of Processing.
44

55
## Folders
6-
- `application` assets for exporting applications within the mode
7-
- `generated` generated antlr code for the mode, should be moved to a proper `antlr` plugin within gradle
6+
- `application` assets for exporting applications within the mode (Deprecated)
7+
- `generated` generated antlr code for the mode, should be moved to a proper `antlr` plugin within gradle (Deprecated)
8+
- `gradle` the Processing java gradle plugin
89
- `libraries` libraries that are available within the mode
910
- `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`
1011
- `mode` legacy files for `Ant`
@@ -13,8 +14,25 @@ This the Java Mode in Processing. It compiles your sketches and runs them. It is
1314
- `test` tests for the mode
1415
- `theme` assets for the mode, related to autocomplete and syntax highlighting
1516

16-
## Future plans
17-
- Decouple the `lsp` and `preprocessor` from the mode and move them to their own repositories
18-
- Move the `antlr` code to a proper plugin within gradle
19-
- Create a gradle plugin to convert `.pde` file to `.java` files
20-
- Create a gradle based version of Java mode.
17+
## The Modern Build system
18+
19+
Since 2025 work has started on creating a new internal build system for the Java Mode based on Gradle.
20+
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.
21+
22+
### How it used to work
23+
24+
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.
25+
26+
### How it will work going forward
27+
28+
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.
29+
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.
30+
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.
31+
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.
32+
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.
33+
34+
### How to work on the modern build system
35+
36+
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.
37+
38+
Within the editor, the gradle plugin is embedded in Processing's embedded maven repository so that Gradle can find it.

java/gradle/example/.idea/.name

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

java/gradle/example/.idea/compiler.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

java/gradle/example/.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)