Publish Processing Gradle plugins (#1405)

* Publish Processing Gradle plugin

Add a publish-gradle job to the release workflow to publish Processing libraries to the Gradle Plugin Portal using gradle publish with required secrets and version/group env vars. Update gradle/plugins/library/build.gradle.kts to use the com.gradle.plugin-publish plugin, provide plugin metadata (website, vcsUrl, displayName, description, tags) and make the plugin id dynamic ("$group.library"). These changes enable automated publishing of the Gradle plugin with the metadata required by the portal.

* Publish plugins in release workflow

* Update build.gradle.kts

* Set project.group system property for tests

Expose the project's group to test JVMs by configuring tasks.withType<Test>() to set systemProperty("project.group", group ?: "org.processing"). Update ProcessingPluginTest to read the plugin id from System.getProperty("project.group") instead of hardcoding the group. Also close the publishing block in build.gradle.kts. This allows tests to adapt when the project group is overridden.

* Update build.gradle.kts
This commit is contained in:
Stef Tervelde
2026-02-17 16:46:38 +01:00
committed by GitHub
parent 05290b877e
commit 4f2644a9a2
4 changed files with 58 additions and 5 deletions
+13 -2
View File
@@ -21,15 +21,20 @@ dependencies{
testImplementation(libs.junit)
}
// TODO: CI/CD for publishing the plugin to the Gradle Plugin Portal
gradlePlugin{
website = "https://processing.org/"
vcsUrl = "https://github.com/processing/processing4"
plugins{
create("processing.java"){
id = "org.processing.java"
id = "$group.java"
displayName = "Processing Plugin"
description = "Gradle plugin for building Processing sketches"
tags = listOf("processing", "sketch", "dsl")
implementationClass = "org.processing.java.gradle.ProcessingPlugin"
}
}
}
publishing{
repositories{
mavenLocal()
@@ -39,6 +44,11 @@ publishing{
}
}
}
// Grab the group before running tests, since the group is used in the test configuration and may be modified by the publishing configuration
val testGroup = group.toString()
tasks.withType<Test>().configureEach {
systemProperty("project.group", testGroup)
}
tasks.register("writeVersion") {
// make the version available to the plugin at runtime by writing it to a properties file in the resources directory
@@ -48,6 +58,7 @@ tasks.register("writeVersion") {
file.writeText("version=${project.version}")
}
}
tasks.named("processResources") {
dependsOn("writeVersion")
}
@@ -20,7 +20,7 @@ class ProcessingPluginTest{
val sketchFolder = directory.newFolder("sketch")
directory.newFile("sketch/build.gradle.kts").writeText("""
plugins {
id("org.processing.java")
id("${System.getProperty("project.group")}.java")
}
""".trimIndent())
directory.newFile("sketch/settings.gradle.kts")