From fcb554a50c186a7c12e604cfe56df0bad8e2f7b1 Mon Sep 17 00:00:00 2001 From: Stef Tervelde Date: Wed, 2 Jul 2025 09:42:19 +0200 Subject: [PATCH] Rename gradle plugin and further planning --- .../processing/app/gradle/GradleService.kt | 20 +++++++++---------- build.gradle.kts | 6 ------ build/shared/lib/languages/PDE.properties | 3 +++ java/gradle/build.gradle.kts | 2 +- java/gradle/example/build.gradle.kts | 2 +- .../src/main/kotlin/ProcessingPlugin.kt | 2 +- .../src/test/kotlin/ProcessingPluginTest.kt | 2 +- 7 files changed, 17 insertions(+), 20 deletions(-) diff --git a/app/src/processing/app/gradle/GradleService.kt b/app/src/processing/app/gradle/GradleService.kt index 4ef07f2d6..7c1fe9488 100644 --- a/app/src/processing/app/gradle/GradleService.kt +++ b/app/src/processing/app/gradle/GradleService.kt @@ -29,10 +29,12 @@ import kotlin.io.path.writeText // TODO: Add background building // TODO: Track build speed (for analytics?) -// The gradle service runs the gradle tasks and manages the gradle connection -// It will create the necessary build files for gradle to run -// Then it will kick off a new GradleJob to run the tasks -// GradleJob manages the gradle build and connects the debugger +/* +* The gradle service runs the gradle tasks and manages the gradle connection +* It will create the necessary build files for gradle to run +* Then it will kick off a new GradleJob to run the tasks +* GradleJob manages the gradle build and connects the debugger +*/ class GradleService( val mode: Mode, val editor: Editor?, @@ -92,7 +94,7 @@ class GradleService( val file = workingDir.resolve("unsaved/${code.fileName}") file.parent.toFile().mkdirs() // If tab is marked modified save it to the working directory - // Otherwise delete the file + // Otherwise delete the file so we don't compile with old code if(code.isModified){ file.writeText(code.documentText) }else{ @@ -101,10 +103,8 @@ class GradleService( return@map code.fileName } - val group = System.getProperty("processing.group", "org.processing") - val variables = mapOf( - "group" to group, + "group" to System.getProperty("processing.group", "org.processing"), "version" to Base.getVersionName(), "sketchFolder" to sketch.folder.absolutePath, "sketchbook" to Base.getSketchbookFolder(), @@ -169,14 +169,14 @@ class GradleService( // """.trimIndent() - // TODO: add instructions keys val instructions = Language.text("gradle.instructions") .split("\n") .joinToString("\n") { "// $it" } val configuration = """ + plugins{ - id("org.processing.gradle") version "${Base.getVersionName()}" + id("org.processing.java") version "${Base.getVersionName()}" } """.trimIndent() val content = "${header}\n${instructions}\n${configuration}" diff --git a/build.gradle.kts b/build.gradle.kts index faa68e5dc..bc23e286b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -6,12 +6,6 @@ plugins { alias(libs.plugins.jetbrainsCompose) apply false } -//allprojects{ -// repositories{ -// maven { url = uri("https://repo.gradle.org/gradle/libs-releases") } -// } -//} - // Set the build directory to not /build to prevent accidental deletion through the clean action // Can be deleted after the migration to Gradle is complete layout.buildDirectory = file(".build") diff --git a/build/shared/lib/languages/PDE.properties b/build/shared/lib/languages/PDE.properties index 3ea6d7652..6ead810aa 100644 --- a/build/shared/lib/languages/PDE.properties +++ b/build/shared/lib/languages/PDE.properties @@ -319,6 +319,9 @@ debugger.name = Name debugger.value = Value debugger.type = Type +# Gradle +gradle.instructions = About this file: \nProcessing creates this file when you run your sketch. \nIt configures the tools needed to build and export your code. \nLearn more: [Gradle Primer link]\n \nTo customize this file: \n1. Delete the line above that begins with '@processing-auto-generated'. \nThis will prevent Processing from overwriting this file in the future. \n2. Make your desired changes. + # --------------------------------------- # Toolbars diff --git a/java/gradle/build.gradle.kts b/java/gradle/build.gradle.kts index 3aa484cb5..f48dea8ef 100644 --- a/java/gradle/build.gradle.kts +++ b/java/gradle/build.gradle.kts @@ -22,7 +22,7 @@ dependencies{ gradlePlugin{ plugins{ create("processing"){ - id = "org.processing.gradle" + id = "org.processing.java" implementationClass = "org.processing.java.gradle.ProcessingPlugin" } } diff --git a/java/gradle/example/build.gradle.kts b/java/gradle/example/build.gradle.kts index 4d1d983e5..b476d51bb 100644 --- a/java/gradle/example/build.gradle.kts +++ b/java/gradle/example/build.gradle.kts @@ -1,3 +1,3 @@ plugins{ - id("org.processing.gradle") + id("org.processing.java") } \ No newline at end of file diff --git a/java/gradle/src/main/kotlin/ProcessingPlugin.kt b/java/gradle/src/main/kotlin/ProcessingPlugin.kt index b02d7f094..cc3be4860 100644 --- a/java/gradle/src/main/kotlin/ProcessingPlugin.kt +++ b/java/gradle/src/main/kotlin/ProcessingPlugin.kt @@ -27,7 +27,7 @@ class ProcessingPlugin @Inject constructor(private val objectFactory: ObjectFact val workingDir = project.findProperty("processing.workingDir") as String? val debugPort = project.findProperty("processing.debugPort") as String? - // TODO: Setup sketchbook when using as a standalone plugin + // TODO: Setup sketchbook when using as a standalone plugin, use the Java Preferences val sketchbook = project.findProperty("processing.sketchbook") as String? // Apply the Java plugin to the Project diff --git a/java/gradle/src/test/kotlin/ProcessingPluginTest.kt b/java/gradle/src/test/kotlin/ProcessingPluginTest.kt index 2be09fd89..7e43a2c39 100644 --- a/java/gradle/src/test/kotlin/ProcessingPluginTest.kt +++ b/java/gradle/src/test/kotlin/ProcessingPluginTest.kt @@ -11,7 +11,7 @@ class ProcessingPluginTest{ @Test fun testPluginAddsSketchTask(){ val project = ProjectBuilder.builder().build() - project.pluginManager.apply("org.processing.gradle") + project.pluginManager.apply("org.processing.java") assert(project.tasks.getByName("sketch") is Task) }