|
| 1 | +# Processing Gradle Plugin |
| 2 | + |
| 3 | +This folder contains the source for the Processing Gradle plugin. |
| 4 | +The plugin will transform any Processing sketch into a Gradle project for easy compilation and advanced features. |
| 5 | + |
| 6 | +## Usage |
| 7 | + |
| 8 | +Add the following files to any Processing sketch alongside the `.pde` files |
| 9 | + |
| 10 | +```kotlin |
| 11 | +// build.gradle.kts |
| 12 | +plugins { |
| 13 | + id("org.processing.java") version "4.5.3" // version of Processing you would like to use. |
| 14 | +} |
| 15 | + |
| 16 | +// settings.gradle.kts - create the file but leave blank |
| 17 | +``` |
| 18 | + |
| 19 | +This will make the Processing sketch a fully fledges Gradle project, usable with any editor that supports gradle. |
| 20 | +Including the `gradle` command if installed. |
| 21 | + |
| 22 | +The plugin will add the `sketch` command to the Gradle tasks lists, so run the sketch with `gradle sketch`, this will |
| 23 | +build and launch your sketch. |
| 24 | + |
| 25 | +The sketch can also be bundled into a standalone app by using the `gradle export` command. |
| 26 | +Or run in fullscreen with `gradle present` |
| 27 | + |
| 28 | +To include libraries into your sketch add `processing.sketchbook=/path/to/sketchbook` to a `gradle.properties` file in |
| 29 | +the same folder. |
| 30 | + |
| 31 | +To use any kind of dependency add as a normal gradle dependency, the plugin has already automatically added the Maven |
| 32 | +Central repository. |
| 33 | + |
| 34 | +```kotlin |
| 35 | +// build.gradle.kts |
| 36 | +plugins { |
| 37 | + id("org.processing.java") version "4.5.3" |
| 38 | +} |
| 39 | + |
| 40 | +dependencies { |
| 41 | + implementation("com.lowagie:itext:2.1.7") |
| 42 | +} |
| 43 | +``` |
| 44 | + |
| 45 | +To use an older version of Processing just change the plugin version: |
| 46 | + |
| 47 | +```kotlin |
| 48 | +// build.gradle.kts |
| 49 | +plugins { |
| 50 | + id("org.processing.java") version "4.5.0" |
| 51 | +} |
| 52 | +``` |
| 53 | + |
| 54 | +Other gradle plugins are also supported |
| 55 | + |
| 56 | +```kotlin |
| 57 | +// build.gradle.kts |
| 58 | +plugins { |
| 59 | + id("org.processing.java") version "4.5.3" |
| 60 | + id("com.gradleup.shadow") version "<version>" |
| 61 | +} |
| 62 | +``` |
| 63 | + |
| 64 | +If you want to combine multiple sketches into a single project |
| 65 | + |
| 66 | +```kotlin |
| 67 | +// sketch-a/build.gradle.kts |
| 68 | +plugins { |
| 69 | + id("org.processing.java") version "4.5.3" |
| 70 | +} |
| 71 | + |
| 72 | +// sketch-b/build.gradle.kts |
| 73 | +plugins { |
| 74 | + id("org.processing.java") version "4.5.3" |
| 75 | +} |
| 76 | + |
| 77 | +// build.gradle.kts |
| 78 | +plugins { |
| 79 | + id("org.processing.java") version "4.5.3" apply false |
| 80 | +} |
| 81 | +// settings.gradle.kts - create the file but leave blank |
| 82 | +``` |
| 83 | + |
| 84 | +Then run all sketches at once with `gradle sketch` |
0 commit comments