mirror of
https://github.com/processing/processing4.git
synced 2026-01-26 01:41:06 +01:00
added example of plugin usage
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -111,4 +111,5 @@ java/build/
|
||||
/java/preprocessor/build
|
||||
/java/lsp/build
|
||||
/core/examples/build
|
||||
/java/gradle/build
|
||||
/java/gradle/build
|
||||
/java/gradle/example/.processing
|
||||
|
||||
@@ -24,6 +24,8 @@ lsp4j = { module = "org.eclipse.lsp4j:org.eclipse.lsp4j", version = "0.22.0" }
|
||||
jsoup = { module = "org.jsoup:jsoup", version = "1.17.2" }
|
||||
antlr4 = { module = "org.antlr:antlr4", version.ref = "antlr" }
|
||||
antlr4Runtime = { module = "org.antlr:antlr4-runtime", version.ref = "antlr" }
|
||||
composeGradlePlugin = { module = "org.jetbrains.compose:compose-gradle-plugin", version.ref = "compose-plugin" }
|
||||
kotlinGradlePlugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
|
||||
|
||||
[plugins]
|
||||
jetbrainsCompose = { id = "org.jetbrains.compose", version.ref = "compose-plugin" }
|
||||
|
||||
@@ -9,14 +9,13 @@ version = rootProject.version
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url = uri("https://jogamp.org/deployment/maven") }
|
||||
}
|
||||
|
||||
dependencies{
|
||||
implementation(project(":java:preprocessor"))
|
||||
|
||||
implementation("org.jetbrains.compose:compose-gradle-plugin:1.7.3")
|
||||
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.21")
|
||||
implementation(libs.composeGradlePlugin)
|
||||
implementation(libs.kotlinGradlePlugin)
|
||||
}
|
||||
|
||||
gradlePlugin{
|
||||
|
||||
32
java/gradle/example/brightness.pde
Normal file
32
java/gradle/example/brightness.pde
Normal file
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* Brightness
|
||||
* by Rusty Robison.
|
||||
*
|
||||
* Brightness is the relative lightness or darkness of a color.
|
||||
* Move the cursor vertically over each bar to alter its brightness.
|
||||
*/
|
||||
|
||||
int barWidth = 20;
|
||||
int lastBar = -1;
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
|
||||
void setup() {
|
||||
size(640, 360);
|
||||
colorMode(HSB, width, 100, height);
|
||||
noStroke();
|
||||
background(0);
|
||||
}
|
||||
|
||||
void draw() {
|
||||
int whichBar = mouseX / barWidth;
|
||||
if (whichBar != lastBar) {
|
||||
int barX = whichBar * barWidth;
|
||||
fill(barX, 100, mouseY);
|
||||
rect(barX, 0, barWidth, height);
|
||||
lastBar = whichBar;
|
||||
}
|
||||
}
|
||||
3
java/gradle/example/build.gradle.kts
Normal file
3
java/gradle/example/build.gradle.kts
Normal file
@@ -0,0 +1,3 @@
|
||||
plugins{
|
||||
id("org.processing.java.gradle") version "4.4.0"
|
||||
}
|
||||
6
java/gradle/example/settings.gradle.kts
Normal file
6
java/gradle/example/settings.gradle.kts
Normal file
@@ -0,0 +1,6 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
||||
@@ -130,8 +130,7 @@ class ProcessingPlugin @Inject constructor(private val objectFactory: ObjectFact
|
||||
|
||||
val sketchbook = prefs.getProperty("sketchbook.path.four")
|
||||
|
||||
File(sketchbook, "libraries").listFiles { file -> file.isDirectory
|
||||
}?.forEach{
|
||||
File(sketchbook, "libraries").listFiles { file -> file.isDirectory }?.forEach{
|
||||
project.dependencies.add("implementation", project.fileTree(it).apply { include("**/*.jar") })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ plugins{
|
||||
alias(libs.plugins.mavenPublish)
|
||||
}
|
||||
|
||||
|
||||
version = rootProject.version
|
||||
|
||||
repositories{
|
||||
mavenCentral()
|
||||
@@ -21,7 +21,12 @@ sourceSets{
|
||||
include("processing/mode/java/preproc/**/*", "processing/app/**/*")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
afterEvaluate{
|
||||
tasks.withType(Jar::class.java){
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
dependsOn(tasks.generateGrammarSource)
|
||||
}
|
||||
}
|
||||
|
||||
dependencies{
|
||||
|
||||
Reference in New Issue
Block a user