added example of plugin usage

This commit is contained in:
Stef Tervelde
2025-02-05 12:36:18 +01:00
parent f4d7fbf99b
commit 7f00d5b028
8 changed files with 55 additions and 8 deletions

3
.gitignore vendored
View File

@@ -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

View File

@@ -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" }

View File

@@ -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{

View 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;
}
}

View File

@@ -0,0 +1,3 @@
plugins{
id("org.processing.java.gradle") version "4.4.0"
}

View File

@@ -0,0 +1,6 @@
pluginManagement {
repositories {
mavenLocal()
gradlePluginPortal()
}
}

View File

@@ -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") })
}
}

View File

@@ -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{