Skip to content

Conversation

@Stefterv
Copy link
Collaborator

This PR will add a Gradle Plugin for defining Processing/Java libraries, it reduces the necessary setup of creating a new Processing library to following in a build.gradle.kts file.

  plugins{
      id("org.processing.library")
  }
  
  processing {
      library {
          version = 1
          prettyVersion = "1.0.0"
  
          authors = mapOf(
              "The Processing Foundation" to "https://processing.org"
          )
          url = "https://processing.org/"
          categories = listOf("file", "exporter", "dxf")
  
          sentence = "DXF export library for Processing"
          paragraph =
              "This library allows you to export your Processing drawings as DXF files, which can be opened in CAD applications."
  
      }
  }

This will add the functionality of bundling a Processing library as a .zip and .pdex as well as functionality to install the new library directly into Processing to test.

I think we should create similar plugins for modes and tools!

TODO

After merging

  • Add Gradle Publishing logic
  • Migrate integrated libraries to new plugin
  • Find and test a way to connect the debugger connected to Gradle towards running sketches in Processing for easy debugging when writing libraries.
  • After publishing, update the gradle library template.

@tychedelia I've put the plugin in gradle/plugins rather than buildSrc as I'd like to avoid growing the top level folders in the repo, curious what you think about that or if I should rather stick to convention? So far functionality wise it seems the same.

Configured the ProcessingLibraryPlugin to use Java toolchain version 17 via JavaPluginExtension. Also marked the 'createLibrary' task in dxf library build script as deprecated, recommending use of the 'bundleLibrary' task from the plugin.

Add custom Gradle plugin for Processing libraries

Introduces a new Gradle plugin module for Processing libraries, including plugin implementation, extension, and configuration classes. Updates the DXF library to use the new plugin and configuration DSL, and adjusts project settings to include and manage the plugin build.

Add bundleLibrary task and update library plugin

Introduces BundleLibraryFilesTask to handle bundling of Processing library files, replacing the removed CollectLibraryFilesTask. Updates ProcessingLibraryPlugin to register the new bundleLibrary task, which collects the jar, runtime dependencies, examples, javadoc, and generates library.properties. Also adds a 'name' property to ProcessingLibraryConfiguration and comments out the old createLibrary Copy task in dxf's build script.

Refactor library bundling logic into task class

Moved the logic for bundling Processing library files from the plugin registration into the BundleLibraryFilesTask class. The task now takes a ProcessingLibraryConfiguration and handles copying jars, dependencies, examples, javadocs, and generating library.properties internally. Also made ProcessingLibraryConfiguration serializable for safer Gradle usage.

Update library version handling and add zip task

Changed ProcessingLibraryConfiguration.version from String to Int for stricter versioning. Added a zipLibrary Gradle task to package the library folder as .zip and .pdex archives. Updated dxf library build script to use new version format and incremented version to 1.

Add installLibrary task and update DXF build config

Introduces an installLibrary Gradle task to automate Processing library installation using user preferences. Also re-enables the createLibrary copy task in the DXF library build script and removes minRevision/maxRevision constraints from the library configuration.

Only run when actually running the task -.-

Refactor library author metadata handling

Changed the authors field in ProcessingLibraryConfiguration from a list of names to a map of author names to URLs, updating related code to format authors as markdown links. Updated the DXF library build configuration to use the new authors map structure. Added documentation comments to ProcessingLibraryConfiguration properties for clarity.
@Stefterv Stefterv requested a review from catilac November 27, 2025 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant