From 023d8cbdc2035f56e956c36845dc5e0e753339f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?moon=20dav=C3=A9?= Date: Fri, 23 Oct 2026 00:19:57 -0400 Subject: [PATCH 1/4] update github actions to use JVM25, and to get submodules --- .github/actions/setup/action.yml | 5 ++++- .github/workflows/build.yml | 4 ++++ .github/workflows/release.yml | 10 ++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index cc65b83095..d3f04694c4 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -10,9 +10,12 @@ runs: - name: Install Java uses: actions/setup-java@v4 with: - java-version: '17' + java-version: '25' distribution: 'temurin' architecture: ${{ inputs.arch }} + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + - name: Setup Gradle uses: gradle/actions/setup-gradle@v4 \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bbca994d60..7f46dba606 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,6 +18,8 @@ jobs: steps: - name: Checkout Repository uses: actions/checkout@v4 + with: + submodules: recursive - name: Setup Processing uses: ./.github/actions/setup @@ -70,6 +72,8 @@ jobs: steps: - name: Checkout Repository uses: actions/checkout@v4 + with: + submodules: recursive - name: Setup Processing uses: ./.github/actions/setup diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 04a4985699..a3f65ccfea 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -109,6 +109,8 @@ jobs: steps: - name: Checkout Repository uses: actions/checkout@v4 + with: + submodules: recursive - name: Setup Processing uses: ./.github/actions/setup @@ -137,6 +139,8 @@ jobs: steps: - name: Checkout Repository uses: actions/checkout@v4 + with: + submodules: recursive - name: Setup Processing uses: ./.github/actions/setup @@ -183,6 +187,8 @@ jobs: steps: - name: Checkout Repository uses: actions/checkout@v4 + with: + submodules: recursive - name: Setup Processing uses: ./.github/actions/setup @@ -249,6 +255,8 @@ jobs: - name: Checkout Repository uses: actions/checkout@v4 + with: + submodules: recursive - name: Setup Processing uses: ./.github/actions/setup @@ -304,6 +312,8 @@ jobs: steps: - name: Checkout Repository uses: actions/checkout@v4 + with: + submodules: recursive - name: Setup Processing uses: ./.github/actions/setup From eeb7777ab842459c5760f0b12772b21546d0a020 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?moon=20dav=C3=A9?= Date: Fri, 23 Oct 2026 00:20:14 -0400 Subject: [PATCH 2/4] Update documentation --- BUILD.md | 97 ++++++++++++++++++++------------------------------------ 1 file changed, 34 insertions(+), 63 deletions(-) diff --git a/BUILD.md b/BUILD.md index 2cc31446a4..d50b6b871d 100644 --- a/BUILD.md +++ b/BUILD.md @@ -7,30 +7,24 @@ Great to see you are interested in contributing to Processing. To get started yo _**Note:** A paid subscription is **not** required. Everything needed to build and work on Processing is available for free in IntelliJ IDEA._ 1. [Download IntelliJ IDEA](https://www.jetbrains.com/idea/download/) and install it. -1. Clone the `Processing4` repository locally. +1. Install [Rust](https://rustup.rs/). It is needed to build `libprocessing`, the native library behind the WebGPU renderer. +1. Clone the `processing4` repository locally, including its submodules (`git clone --recursive`, or `git submodule update --init --recursive` in an existing clone). 1. Open the cloned repository in **IntelliJ IDEA**. 1. When prompted, select **Trust Project**. (You can preview the project in Safe Mode, but you will not be able to build Processing.) 1. If IntelliJ asks whether to import the Gradle project, select **Load Gradle Project**. -1. Make sure IntelliJ and Gradle are both using **JDK 17**: +1. Make sure IntelliJ and Gradle are both using **JDK 25**: * Go to **`File > Project Structure > Project`** - * Set **Project SDK** to **JDK 17** (we recommend **Eclipse Temurin**) - * If needed, choose **Download JDK…** and install **Version 17** + * Set **Project SDK** to **JDK 25** (we recommend **Eclipse Temurin**) + * If needed, choose **Download JDK…** and install **Version 25** * Then go to **`Settings > Build, Execution, Deployment > Build Tools > Gradle`** - * Set **Gradle JVM** to the same **JDK 17** + * Set **Gradle JVM** to the same **JDK 25** (the project requests 25 in `gradle/gradle-daemon-jvm.properties`, so this is usually picked automatically) 1. Wait for Gradle sync to finish. 1. Click the green **Run** button in the top right to build and launch Processing. You can also use this menu to start a debug session. > [!TIP] > If you encounter any issues with this process, Read the [Troubleshooting and Setup Tips for IntelliJ IDEA](#troubleshooting-and-setup-tips-intellij-idea) -1. Clone the Processing4 repository to your machine locally -1. Open the cloned repository in IntelliJ IDEA CE -1. When prompted, select **Trust Project**. You can preview the project in Safe Mode but you won't be able to build Processing. -1. IntelliJ may ask if you want to load Gradle project. If you allow this, make sure you are using JDK version 17. -1. In the main menu, go to File > Project Structure > Project Settings > Project. -1. In the SDK Dropdown option, select a JDK version 17 or Download the jdk -1. Click the green Run Icon in the top right of the window. This is also where you can find the option to debug Processing. -1. Logs can be found in the `Build` or `Debug` pane on the bottom left of the window +Logs can be found in the `Build` or `Debug` pane on the bottom left of the window. ## VSCode @@ -52,7 +46,7 @@ If you prefer not to use an IDE, you can also build Processing directly from the ### Set Up the Environment -If you don't have them installed, you will need to install [Git](https://git-scm.com/downloads) and [Gradle](https://gradle.org/install/) first. Then follow these steps: +If you don't have them installed, you will need to install [Git](https://git-scm.com/downloads), [Gradle](https://gradle.org/install/) and [Rust](https://rustup.rs/) first. Then follow these steps: 1. **Clone the repository:** ```bash @@ -60,61 +54,29 @@ If you don't have them installed, you will need to install [Git](https://git-scm cd processing4 ``` -2. **Install Temurin JDK 17:** +2. **Install Temurin JDK 25:** - Download and install the appropriate version for your platform: - - - [Linux (x86)](https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.15%2B6/OpenJDK17U-jdk_x64_linux_hotspot_17.0.15_6.tar.gz) - - [macOS (Apple Silicon)](https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.15%2B6/OpenJDK17U-jdk_aarch64_mac_hotspot_17.0.15_6.pkg) - - [Other platforms](https://adoptium.net/temurin/releases/?package=jdk&version=17&os=any&arch=any) - -### macOS: -```bash -brew install --cask temurin@17 -```` - -### Windows (using winget): -```bash -winget install --id=EclipseAdoptium.Temurin.17.JDK -e -``` - -### SDKMAN! - -[SDKMAN!](https://sdkman.io/) is a useful tool for developers working on multiple versions of the JVM. - -## WebGPU Support (Optional) - -To build Processing with the experimental WebGPU renderer, you need JDK 25, Rust, and jextract. - -### Install Temurin JDK 25 - -```bash -brew install --cask temurin@25 # macOS -``` - -### Install `jextract` + Download and install the appropriate version for your platform from [Adoptium](https://adoptium.net/temurin/releases/?package=jdk&version=25&os=any&arch=any), or use a package manager: -`jextract` generates Java bindings from C header files. -You can download it [here](https://jdk.java.net/jextract/) or install it using SDKMAN!: - -```bash -sdk install jextract -```` - -### Build with WebGPU + ```bash + brew install --cask temurin@25 # macOS + winget install --id=EclipseAdoptium.Temurin.25.JDK -e # Windows + ``` -```bash -./gradlew build -PenableWebGPU=true -``` + [SDKMAN!](https://sdkman.io/) is also a useful tool for developers working on multiple versions of the JVM. 3. **Set the `JAVA_HOME` environment variable:** -It may be necessary to set the `JAVA_HOME` environment variable to point to your Temurin JDK installation. + It may be necessary to set the `JAVA_HOME` environment variable to point to your Temurin JDK installation. ```bash - export JAVA_HOME=/path/to/temurin/jdk-17.0.15+6/ + export JAVA_HOME=/path/to/temurin/jdk-25/ ``` +4. **(Optional) Install `jextract`:** + + `jextract` generates the Java bindings for `libprocessing`. The build downloads it automatically, but if you already have it installed (for example with `sdk install jextract`), that copy will be used instead. + ### Build, Run, and Package Processing #### Build the Project (Required First Step) @@ -191,18 +153,18 @@ If you are specifically trying to run the `Processing CLI`, you can test command If you’re building Processing using IntelliJ IDEA and something’s not working, here are a few things that might help: -### Use the Correct JDK (temurin-17) +### Use the Correct JDK (temurin-25) -Make sure IntelliJ is using **temurin-17**, not another version. If building with WebGPU (`-PenableWebGPU=true`), use **temurin-25** instead. +Make sure IntelliJ is using **temurin-25**, not another version. 1. Go to **File > Project Structure > Project** -2. Set the **Project SDK** to: `temurin-17 java version "17.0.15"` +2. Set the **Project SDK** to: `temurin-25 java version "25"` ![JDK Selection](.github/media/troubleshooting-Intellij-setting-djk-version-manually.png) 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)` +2. Select Version: `25`, Vendor: `Eclipse Temurin (AdoptOpenJDK HotSpot)` JDK Download @@ -212,6 +174,15 @@ Now go back to your main window and 1. Click the green Run Icon in the top right of the window. +### “libprocessing submodule directory not found” + +The `libprocessing` submodule hasn't been checked out. Run: + +```bash +git submodule update --init --recursive +``` + + ### “Duplicate content roots detected” You may see this warning in IntelliJ: From c3b3417ac553eedb5497846a3d75925931e20b60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?moon=20dav=C3=A9?= Date: Fri, 23 Oct 2026 00:20:37 -0400 Subject: [PATCH 3/4] Specify JVM 25 for gradle daemon --- gradle/gradle-daemon-jvm.properties | 1 + 1 file changed, 1 insertion(+) create mode 100644 gradle/gradle-daemon-jvm.properties diff --git a/gradle/gradle-daemon-jvm.properties b/gradle/gradle-daemon-jvm.properties new file mode 100644 index 0000000000..d35f707fd9 --- /dev/null +++ b/gradle/gradle-daemon-jvm.properties @@ -0,0 +1 @@ +toolchainVersion=25 From ee385e9bea735087dce95baaf9cf5ec72120398a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?moon=20dav=C3=A9?= Date: Fri, 23 Oct 2026 00:21:51 -0400 Subject: [PATCH 4/4] remove conditionals around enableWebGPU --- app/build.gradle.kts | 5 +- build.gradle.kts | 9 +- core/build.gradle.kts | 261 ++++++++---------- gradle.properties | 2 +- gradle/libs.versions.toml | 2 +- .../main/kotlin/ProcessingLibraryPlugin.kt | 3 +- .../src/main/kotlin/ProcessingPlugin.kt | 3 +- 7 files changed, 129 insertions(+), 156 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index ebbc09c8a1..7c6dd48b19 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -142,6 +142,7 @@ dependencies { @OptIn(ExperimentalComposeLibrary::class) testImplementation(compose.uiTest) testImplementation(kotlin("test")) + testImplementation(libs.mockito) testImplementation(libs.mockitoKotlin) testImplementation(libs.junitJupiter) testImplementation(libs.junitJupiterParams) @@ -442,10 +443,8 @@ tasks.register("includeJavaMode") { into(composeResources("modes/java/mode")) duplicatesStrategy = DuplicatesStrategy.EXCLUDE } -val enableWebGPU = findProperty("enableWebGPU")?.toString()?.toBoolean() ?: false - tasks.register("includeJdk") { - val jdkVersion = if (enableWebGPU) 25 else 17 + val jdkVersion = 25 val jdkHome = project.the().launcherFor { languageVersion.set(JavaLanguageVersion.of(jdkVersion)) }.map { it.metadata.installationPath.asFile } diff --git a/build.gradle.kts b/build.gradle.kts index ca163e476c..95bed60f07 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -12,13 +12,8 @@ plugins { // Can be deleted after the migration to Gradle is complete layout.buildDirectory = file(".build") -val enableWebGPU = findProperty("enableWebGPU")?.toString()?.toBoolean() ?: false -val javaVersion = if (enableWebGPU) "25" else "17" -val kotlinJvmTarget = if (enableWebGPU) { - org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_25 -} else { - org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 -} +val javaVersion = "25" +val kotlinJvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_25 allprojects { tasks.withType().configureEach { diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 19b42773a8..857c1f98a4 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -12,17 +12,11 @@ repositories { maven { url = uri("https://jogamp.org/deployment/maven") } } -val enableWebGPU = findProperty("enableWebGPU")?.toString()?.toBoolean() ?: false - sourceSets{ main{ java{ srcDirs("src") exclude("**/*.jnilib") - if (!enableWebGPU) { - exclude("processing/webgpu/**") - exclude("processing/ffi/**") - } } resources{ srcDirs("src") @@ -32,9 +26,6 @@ sourceSets{ test{ java{ srcDirs("test") - if (!enableWebGPU) { - exclude("processing/webgpu/**") - } } } } @@ -43,170 +34,160 @@ dependencies { implementation(libs.jogl) implementation(libs.gluegen) - if (enableWebGPU) { - val lwjglVersion = "3.3.6" - val lwjglNatives = when { - System.getProperty("os.name").lowercase().contains("mac") -> { - if (System.getProperty("os.arch").contains("aarch64")) { - "natives-macos-arm64" - } else { - "natives-macos" - } + val lwjglVersion = "3.3.6" + val lwjglNatives = when { + System.getProperty("os.name").lowercase().contains("mac") -> { + if (System.getProperty("os.arch").contains("aarch64")) { + "natives-macos-arm64" + } else { + "natives-macos" } - System.getProperty("os.name").lowercase().contains("win") -> "natives-windows" - System.getProperty("os.name").lowercase().contains("linux") -> "natives-linux" - else -> "natives-linux" } - - implementation(platform("org.lwjgl:lwjgl-bom:$lwjglVersion")) - implementation("org.lwjgl", "lwjgl") - implementation("org.lwjgl", "lwjgl-glfw") - runtimeOnly("org.lwjgl", "lwjgl", classifier = lwjglNatives) - runtimeOnly("org.lwjgl", "lwjgl-glfw", classifier = lwjglNatives) + System.getProperty("os.name").lowercase().contains("win") -> "natives-windows" + System.getProperty("os.name").lowercase().contains("linux") -> "natives-linux" + else -> "natives-linux" } + implementation(platform("org.lwjgl:lwjgl-bom:$lwjglVersion")) + implementation("org.lwjgl", "lwjgl") + implementation("org.lwjgl", "lwjgl-glfw") + runtimeOnly("org.lwjgl", "lwjgl", classifier = lwjglNatives) + runtimeOnly("org.lwjgl", "lwjgl-glfw", classifier = lwjglNatives) + testImplementation(libs.junit) } -if (enableWebGPU) { - val currentPlatform = PlatformUtils.detect() - val libprocessingDir = file("${project.rootDir}/libprocessing") +val currentPlatform = PlatformUtils.detect() +val libprocessingDir = file("${project.rootDir}/libprocessing") - if (!libprocessingDir.exists()) { - throw GradleException( - "libprocessing submodule directory not found at: ${libprocessingDir.absolutePath}\n" + - "Please initialize the submodule with: git submodule update --init --recursive" - ) - } - - val rustTargetDir = file("$libprocessingDir/target") - val nativeOutputDir = file("${layout.buildDirectory.get()}/native/${currentPlatform.target}") - - val ffiManifestPath = fileTree(libprocessingDir) { - include("**/processing_ffi/Cargo.toml") - }.files.firstOrNull()?.let { it.relativeTo(libprocessingDir).path } - ?: throw GradleException( - "Could not find processing_ffi Cargo.toml in libprocessing.\n" + - "Searched in: ${libprocessingDir.absolutePath}\n" + - "The libprocessing structure may have changed." - ) - - val buildRustRelease by tasks.registering(CargoBuildTask::class) { - cargoWorkspaceDir.set(libprocessingDir) - manifestPath.set(ffiManifestPath) - release.set(true) - cargoPath.set(PlatformUtils.getCargoPath()) - if (currentPlatform.os == "linux") { - features.set(listOf("x11", "wayland")) - } - outputLibrary.set(file("$rustTargetDir/release/${currentPlatform.libName}")) - - inputs.files(fileTree("$libprocessingDir/crates") { - include("**/src/**/*.rs") - include("**/Cargo.toml") - include("**/build.rs") - include("**/cbindgen.toml") - }) - inputs.file("$libprocessingDir/Cargo.toml") - inputs.file("$libprocessingDir/Cargo.lock") - - val headerDir = file("$libprocessingDir/${ffiManifestPath}").parentFile.resolve("include") - outputs.file("$headerDir/processing.h") - } +if (!libprocessingDir.exists()) { + throw GradleException( + "libprocessing submodule directory not found at: ${libprocessingDir.absolutePath}\n" + + "Please initialize the submodule with: git submodule update --init --recursive" + ) +} - val copyNativeLibs by tasks.registering(Copy::class) { - group = "rust" - description = "Copy processing library to build directory" +val rustTargetDir = file("$libprocessingDir/target") +val nativeOutputDir = file("${layout.buildDirectory.get()}/native/${currentPlatform.target}") + +val ffiManifestPath = fileTree(libprocessingDir) { + include("**/processing_ffi/Cargo.toml") +}.files.firstOrNull()?.let { it.relativeTo(libprocessingDir).path } + ?: throw GradleException( + "Could not find processing_ffi Cargo.toml in libprocessing.\n" + + "Searched in: ${libprocessingDir.absolutePath}\n" + + "The libprocessing structure may have changed." + ) + +val buildRustRelease by tasks.registering(CargoBuildTask::class) { + cargoWorkspaceDir.set(libprocessingDir) + manifestPath.set(ffiManifestPath) + release.set(true) + cargoPath.set(PlatformUtils.getCargoPath()) + if (currentPlatform.os == "linux") { + features.set(listOf("x11", "wayland")) + } + outputLibrary.set(file("$rustTargetDir/release/${currentPlatform.libName}")) + + inputs.files(fileTree("$libprocessingDir/crates") { + include("**/src/**/*.rs") + include("**/Cargo.toml") + include("**/build.rs") + include("**/cbindgen.toml") + }) + inputs.file("$libprocessingDir/Cargo.toml") + inputs.file("$libprocessingDir/Cargo.lock") + + val headerDir = file("$libprocessingDir/${ffiManifestPath}").parentFile.resolve("include") + outputs.file("$headerDir/processing.h") +} - dependsOn(buildRustRelease) +val copyNativeLibs by tasks.registering(Copy::class) { + group = "rust" + description = "Copy processing library to build directory" - from("$rustTargetDir/release") { - include(currentPlatform.libName) - } + dependsOn(buildRustRelease) - into(nativeOutputDir) + from("$rustTargetDir/release") { + include(currentPlatform.libName) } - val bundleNativeLibs by tasks.registering(Copy::class) { - group = "rust" - description = "Bundle native library into resources" - - dependsOn(copyNativeLibs) - - from(nativeOutputDir) - into("${sourceSets.main.get().output.resourcesDir}/native/${currentPlatform.target}") - } + into(nativeOutputDir) +} - val cleanRust by tasks.registering(CargoCleanTask::class) { - cargoWorkspaceDir.set(libprocessingDir) - manifestPath.set(ffiManifestPath) - cargoPath.set(PlatformUtils.getCargoPath()) +val bundleNativeLibs by tasks.registering(Copy::class) { + group = "rust" + description = "Bundle native library into resources" - mustRunAfter(buildRustRelease) - } + dependsOn(copyNativeLibs) - tasks.named("clean") { - dependsOn(cleanRust) - } + from(nativeOutputDir) + into("${sourceSets.main.get().output.resourcesDir}/native/${currentPlatform.target}") +} - val generatedJavaDir = file("${layout.buildDirectory.get()}/generated/sources/jextract/java") +val cleanRust by tasks.registering(CargoCleanTask::class) { + cargoWorkspaceDir.set(libprocessingDir) + manifestPath.set(ffiManifestPath) + cargoPath.set(PlatformUtils.getCargoPath()) - sourceSets.main { - java.srcDirs(generatedJavaDir) - } + mustRunAfter(buildRustRelease) +} - val jextractVersionString = "22-jextract+6-47" - val jextractDirectory = file("${gradle.gradleUserHomeDir}/jextract-22") - val jextractTarballFile = file("${gradle.gradleUserHomeDir}/jextract-$jextractVersionString.tar.gz") +tasks.named("clean") { + dependsOn(cleanRust) +} - val downloadJextract by tasks.registering(DownloadJextractTask::class) { - jextractVersion.set(jextractVersionString) - platform.set(currentPlatform.jextractPlatform) - jextractDir.set(jextractDirectory) - downloadTarball.set(jextractTarballFile) +val generatedJavaDir = file("${layout.buildDirectory.get()}/generated/sources/jextract/java") - onlyIf { !jextractDirectory.exists() } - } +val jextractVersionString = "22-jextract+6-47" +val jextractDirectory = file("${gradle.gradleUserHomeDir}/jextract-22") +val jextractTarballFile = file("${gradle.gradleUserHomeDir}/jextract-$jextractVersionString.tar.gz") - val makeJextractExecutable by tasks.registering(Exec::class) { - group = "rust" - description = "Make jextract binary executable on Unix systems" +val downloadJextract by tasks.registering(DownloadJextractTask::class) { + jextractVersion.set(jextractVersionString) + platform.set(currentPlatform.jextractPlatform) + jextractDir.set(jextractDirectory) + downloadTarball.set(jextractTarballFile) - dependsOn(downloadJextract) - onlyIf { !System.getProperty("os.name").lowercase().contains("windows") } + onlyIf { !jextractDirectory.exists() } +} - val jextractBin = file("$jextractDirectory/bin/jextract") - commandLine("chmod", "+x", jextractBin.absolutePath) - } +val makeJextractExecutable by tasks.registering(Exec::class) { + group = "rust" + description = "Make jextract binary executable on Unix systems" - val generateJavaBindings by tasks.registering(GenerateJextractBindingsTask::class) { - dependsOn(buildRustRelease) + dependsOn(downloadJextract) + onlyIf { !System.getProperty("os.name").lowercase().contains("windows") } - val userJextract = JextractUtils.findUserJextract() - if (userJextract == null) { - dependsOn(downloadJextract, makeJextractExecutable) - } + val jextractBin = file("$jextractDirectory/bin/jextract") + commandLine("chmod", "+x", jextractBin.absolutePath) +} - // Find header file dynamically based on FFI manifest location - val headerDir = file("$libprocessingDir/${ffiManifestPath}").parentFile.resolve("include") - headerFile.set(file("$headerDir/processing.h")) - outputDirectory.set(generatedJavaDir) - targetPackage.set("processing.ffi") +val generateJavaBindings by tasks.registering(GenerateJextractBindingsTask::class) { + dependsOn(buildRustRelease) - jextractPath.set(userJextract ?: "$jextractDirectory/bin/${JextractUtils.getExecutableName()}") + val userJextract = JextractUtils.findUserJextract() + if (userJextract == null) { + dependsOn(downloadJextract, makeJextractExecutable) } - tasks.named("compileJava") { - dependsOn(generateJavaBindings) - } + // Find header file dynamically based on FFI manifest location + val headerDir = file("$libprocessingDir/${ffiManifestPath}").parentFile.resolve("include") + headerFile.set(file("$headerDir/processing.h")) + outputDirectory.set(generatedJavaDir) + targetPackage.set("processing.ffi") - tasks.named("compileKotlin") { - dependsOn(generateJavaBindings) - } + jextractPath.set(userJextract ?: "$jextractDirectory/bin/${JextractUtils.getExecutableName()}") +} - tasks.named("processResources") { - dependsOn(bundleNativeLibs) - } +// Registering the task output (rather than the bare directory) makes every task that +// reads the main sources (compileJava, compileKotlin, sourcesJar, javadoc) depend on it +sourceSets.main { + java.srcDir(generateJavaBindings.flatMap { it.outputDirectory }) +} + +tasks.named("processResources") { + dependsOn(bundleNativeLibs) } mavenPublishing{ diff --git a/gradle.properties b/gradle.properties index f2f02a91ed..8ea07c4e94 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,2 @@ group=org.processing -version=4.5.6 +version=5.0.0 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 4455f92044..c72067574a 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -17,7 +17,7 @@ kaml = { module = "com.charleskorn.kaml:kaml", version = "0.65.0" } junit = { module = "junit:junit", version = "4.13.2" } junitJupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "jupiter" } junitJupiterParams = { module = "org.junit.jupiter:junit-jupiter-params", version.ref = "jupiter" } -mockito = { module = "org.mockito:mockito-core", version = "4.11.0" } +mockito = { module = "org.mockito:mockito-core", version = "5.20.0" } mockitoKotlin = { module = "org.mockito.kotlin:mockito-kotlin", version = "5.4.0" } antlr = { module = "org.antlr:antlr4", version = "4.7.2" } eclipseJDT = { module = "org.eclipse.jdt:org.eclipse.jdt.core", version = "3.16.0" } diff --git a/gradle/plugins/library/src/main/kotlin/ProcessingLibraryPlugin.kt b/gradle/plugins/library/src/main/kotlin/ProcessingLibraryPlugin.kt index 9cac968141..d491d9b641 100644 --- a/gradle/plugins/library/src/main/kotlin/ProcessingLibraryPlugin.kt +++ b/gradle/plugins/library/src/main/kotlin/ProcessingLibraryPlugin.kt @@ -36,9 +36,8 @@ class ProcessingLibraryPlugin : Plugin { target.dependencies.add("compileOnly", "org.processing:core:$processingVersion") } } - val javaVersionOverride = target.findProperty("enableWebGPU")?.toString()?.toBoolean()?.let { if (it) 25 else 17 } ?: 17 target.extensions.configure(JavaPluginExtension::class.java) { extension -> - extension.toolchain.languageVersion.set(JavaLanguageVersion.of(javaVersionOverride)) + extension.toolchain.languageVersion.set(JavaLanguageVersion.of(25)) } target.plugins.withType(JavaPlugin::class.java) { diff --git a/java/gradle/src/main/kotlin/ProcessingPlugin.kt b/java/gradle/src/main/kotlin/ProcessingPlugin.kt index 6e1d7d96f6..358669f3d0 100644 --- a/java/gradle/src/main/kotlin/ProcessingPlugin.kt +++ b/java/gradle/src/main/kotlin/ProcessingPlugin.kt @@ -38,8 +38,7 @@ class ProcessingPlugin @Inject constructor(private val objectFactory: ObjectFact val settings = project.findProperty("processing.settings") as String? val root = project.findProperty("processing.root") as String? - val webgpu = (project.findProperty("processing.webgpu") as String?)?.toBoolean() ?: false - val javaVersion = if (webgpu) 25 else 17 + val javaVersion = 25 // Apply the Java plugin to the Project, equivalent of // plugins {