Files
processing4/BUILD.md
Vaivaswat Dubey 1723bd3e90 pr05 Visual Regression Testing #1: Initial Visual Testing Framework (#1261)
* Update README.md

* added the image comparator which is the pixel matching algorithm

* added build.gradle file

* added the test runner

* added the simple test

* Revise README for Jetpack Compose migration strategy

Updated README to reflect migration to Jetpack Compose and strategy for replacing JEditTextArea with RSyntaxTextArea. Added insights on LSP-based editor research and the need for user feedback on Tweak Mode and autocompletion features.

* fixing the build issues

* added junit as dependency

* removing custom class implementation

* inclding visual-tests in settings

* fixed the overlapping cmd

* cleaning

* adding packages

* added updated screenshot structure

* refactoring

* added tests in suits

* removed simple test

* deleting earlier files

* updated the core/gradle file

* added the infrastructure

* added some tests ported by p5js

* removing test rendering suite and its test file

* added screenshots

* config files

* fixed the pixeldensity to 1

* Revert "fixed the pixeldensity to 1"

This reverts commit 66071ac191.

* fixed pixeldensity to 1

* Configure dependencyUpdates task in build.gradle.kts

Add configuration for dependencyUpdates task to manage non-stable versions.

* removing rendering gradient screenshot

* General cleanup of `Base`

I started cleaning up some of `Base`'s startup sequence for clarity of what is being started when. Nowhere near completion and I think a lot of this class will need to be refactored in the future.

Also removed some of the timing measurement comments

Added some comments to the Processing CLI class

* Move contributor list to CONTRIBUTORS.md (#1313)

Created CONTRIBUTORS.md and updated .all-contributorsrc to reference the new file instead of README.md. This will reduce the size of the README and improve loading times.

* Update BUILD.md with build failure troubleshooting

Added troubleshooting steps for build failures related to permissions.

* fixing the build issues

* inclding visual-tests in settings

* updated the core/gradle file

* config files

* Configure dependencyUpdates task in build.gradle.kts

Add configuration for dependencyUpdates task to manage non-stable versions.

* fix rebasing

---------

Co-authored-by: Stef Tervelde <stef@steftervelde.nl>
Co-authored-by: Raphaël de Courville <raphael@processingfoundation.org>
2025-11-10 17:15:44 -05:00

8.0 KiB
Raw Permalink Blame History

How to Build Processing

Great to see you are interested in contributing to Processing. To get started you will need to have an IDE to build and develop Processing. Our recommendation and what we use ourselves is Intellij IDEA.

First, download the IntelliJ IDEA Community Edition. Make sure to select the "Community Edition", not "Ultimate". The Community Edition is free and built on open-source software. You may need to scroll down to find the download link.

Tip

If you encounter any issues with this process, Read the Troubleshooting and Setup Tips for IntelliJ IDEA

  1. Clone the Processing4 repository to your machine locally
  2. Open the cloned repository in IntelliJ IDEA CE
  3. When prompted, select Trust Project. You can preview the project in Safe Mode but you won't be able to build Processing.
  4. IntelliJ may ask if you want to load Gradle project. If you allow this, make sure you are using JDK version 17.
  5. In the main menu, go to File > Project Structure > Project Settings > Project.
  6. In the SDK Dropdown option, select a JDK version 17 or Download the jdk
  7. Click the green Run Icon in the top right of the window. This is also where you can find the option to debug Processing.
  8. Logs can be found in the Build or Debug pane on the bottom left of the window

VSCode

  1. Clone the Processing4 repository to your machine locally
  2. Open the cloned repository in VScode
  3. Wait for Gradle to set up the repository
  4. (If you want debugging install Debugger for Java and Java Extension Pack)
  5. Go to the Gradle Tab and click app -> Tasks -> compose desktop -> run

Instructions for other editors are welcome and feel free to contribute the documentation for those here

Other Editors

TBD

Command Line

If you prefer not to use an IDE, you can also build Processing directly from the command line.

Set Up the Environment

If you don't have them installed, you will need to install Git and Gradle first. Then follow these steps:

  1. Clone the repository:

    git clone https://github.com/processing/processing4.git
    cd processing4
    
  2. Install Temurin JDK 17:

    Download and install the appropriate version for your platform:

  3. Set the JAVA_HOME environment variable:

    export JAVA_HOME=/path/to/temurin/jdk-17.0.15+6/
    

Build, Run, and Package Processing

Build the Project (Required First Step)

This compiles the source code and prepares everything needed to run or test Processing:

./gradlew build

Run Tests

Run unit tests and verify your build:

./gradlew test

Launch Processing

Start the Processing Development Environment (PDE):

./gradlew run

Create a Distributable Package (Optional)

Generate a packaged version of Processing, ready for distribution:

./gradlew package

The packaged files will be available in the app/build/compose/binaries directory.

Architecture

Processing consists of three main components: Core, Java, and App. The Core is independent, while Java and App depend on it. Currently, Java and App are interdependent, but efforts are underway to decouple them.

  • Core: The essential code included with your sketches that provides Processings basic functions. When you use functions like ellipse(25,25,50,50) or background(255), their underlying code is part of Core.

  • Java: The part of Processing that compiles and runs .pde files. It supports different modes which implement support for different languages or versions of Processing. The default mode is Java.

  • App: This is the Processing Development Environment (PDE), the visual part of the editor that you see and work within when you use Processing.

Examples

  • You want to fix a bug with one of the argument of a function that you use in a sketch. The Core is probably where you would find the implementation of the function that you would like to modify.
  • A bug of the PDE editor has been keeping you up at night, you would likely find the relevant code in the App section of this project.
  • If you've written a large sketch and Processing has become slow to compile and run it, a place to improve this code can most likely be found in the Java section.

User interface

Historically, Processing's UI has been written in Java Swing and Flatlaf (and some html & css). Since 2025 we have switched to include Jetpack Compose. It is backwards-compatible with Swing, which allows us to gradually replace Java Swing components with Jetpack Compose ones, instead of doing a complete overhaul of the editor.

Build system

We use Gradle as the build system for Processing. Until 2025, Processing used Ant but we have switched to Gradle to be more in line with modern standards. We plan to migrate the internal build system of the Java mode to Gradle as well, unifying both systems for simplicity.

Kotlin vs Java

With the introduction of the Gradle build system we now support Kotlin within the repository. Refactors from Java to Kotlin are not necessary at this stage, but all new functionality should be written in Kotlin.

Any classes that end up being written in Kotlin have their equivalent Java class under app/ant/ source directory.

Running Processing

The main task to run or debug the PDE is run. That means you just need to run ./gradlew run (Linux) or ./gradlew.bat run (Windows) to build and run Processing.

If your main concern is with the Core you don't need to build and start the whole PDE to test your changes. In IntelliJ IDEA you can select any of the sketches in core/examples/src/.../ to run by click on the green arrow next to their main functions. This will just compile core and the example sketch. Feel free to create additional examples for your new functionality.

If you are specifically trying to run the Processing CLI, you can test commands from app/test/Processing.app/CLITest.

Troubleshooting and Setup Tips (IntelliJ IDEA)

If youre building Processing using IntelliJ IDEA and somethings not working, here are a few things that might help:

Use the Correct JDK (temurin-17)

Make sure IntelliJ is using temurin-17, not another version. Some users have reported issues with ms-17.

  1. Go to File > Project Structure > Project
  2. Set the Project SDK to: temurin-17 java version "17.0.15"

JDK Selection

If it is not already installed, you can download it by:

  1. Clicking the SDK input field and then selecting the Download JDK... option from the menu
  2. Select Version: 17, Vendor: Eclipse Temurin (AdoptOpenJDK HotSpot)

JDK Download

Now go back to your main window and

  1. Click the green Run Icon in the top right of the window.

“Duplicate content roots detected”

You may see this warning in IntelliJ:

Duplicate content roots detected: '.../processing4/java/src'

This happens because multiple modules reference the same source folder. Its safe to ignore.

Build Failed

If the build fails with Permission denied or Could not copy file errors, try cleaning the project.

Run:

./gradlew clean

Then, rebuild the project.