Add canvas-plugin Gradle plugin module#239
Open
Copilot wants to merge 4 commits intoversion/1.21.11from
Open
Conversation
Co-authored-by: TheBjoRedCraft <143264463+TheBjoRedCraft@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add canvas plugin module to gradle configuration
Add Mar 10, 2026
canvas-plugin Gradle plugin module
Member
|
@copilot jedes canvas plugin soll foliaSupported(true) haben |
Co-authored-by: TheBjoRedCraft <143264463+TheBjoRedCraft@users.noreply.github.com>
Contributor
Author
Contributor
There was a problem hiding this comment.
Pull request overview
Adds first-class Gradle plugin support for Canvas server targets within the existing surf-api-gradle-plugin module, reusing the Paper plugin implementation while swapping the compile target to canvas-api and handling org.bukkit:bukkit capability conflicts.
Changes:
- Extracted shared Paper plugin behavior into
AbstractPaperPluginSurfPluginand madePaperPluginSurfPlugindelegate to it. - Introduced
canvas-pluginGradle plugin + DSL extension withfoliaSupported = trueby default. - Added Canvas repository helper + version-catalog/Constants wiring for
canvas-api.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| surf-api-gradle-plugin/src/main/kotlin/dev/slne/surf/surfapi/gradle/util/repo-extensions.kt | Adds canvasMaven() repository helper for Canvas snapshots. |
| surf-api-gradle-plugin/src/main/kotlin/dev/slne/surf/surfapi/gradle/platform/paper/plugin/PaperPluginSurfPlugin.kt | Refactors Paper plugin to extend the new shared abstract base. |
| surf-api-gradle-plugin/src/main/kotlin/dev/slne/surf/surfapi/gradle/platform/paper/plugin/AbstractPaperPluginSurfPlugin.kt | New shared implementation for Paper-style plugin.yml + runServer wiring. |
| surf-api-gradle-plugin/src/main/kotlin/dev/slne/surf/surfapi/gradle/platform/canvas/CanvasSurfExtension.kt | New Canvas DSL extension inheriting Paper DSL and defaulting foliaSupported to true. |
| surf-api-gradle-plugin/src/main/kotlin/dev/slne/surf/surfapi/gradle/platform/canvas/CanvasPluginSurfPlugin.kt | New Canvas plugin: adds Canvas repo, canvas-api dependency, and capability selection. |
| surf-api-gradle-plugin/build.gradle.kts | Registers the new Gradle plugin, bumps version, and exposes CANVAS_API in generated constants. |
| surf-api-gradle-plugin/README.md | Documents the new dev.slne.surf.surfapi.gradle.canvas-plugin ID. |
| gradle/libs.versions.toml | Adds canvas-api version + library alias. |
surf-api-gradle-plugin/src/main/kotlin/dev/slne/surf/surfapi/gradle/util/repo-extensions.kt
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a new
dev.slne.surf.surfapi.gradle.canvas-pluginGradle plugin for Canvas server targets, inheriting allpaper-pluginbehaviour (plugin.yml generation, runServer, surf-api wiring) while substitutingcanvas-apias the compile target and resolving theorg.bukkit:bukkitcapability conflict in favour of Canvas.Changes
AbstractPaperPluginSurfPlugin<E>— extracted paper-plugin logic fromPaperPluginSurfPlugininto a generic abstract base;PaperPluginSurfPluginnow delegates to it unchangedCanvasSurfExtension— extendsPaperPluginSurfExtension, inheriting all existing DSL methods; defaultsfoliaSupportedtotrue(can be overridden explicitly)CanvasPluginSurfPlugin— extendsAbstractPaperPluginSurfPlugin<CanvasSurfExtension>; overridesapplyRepositories0()to add the Canvas Maven snapshot repo andconfigure0()to addcanvas-api+ capability resolutioncanvasMaven()— newRepositoryHandlerextension inrepo-extensions.kt, mirrors the existingslnePublic()patternlibs.versions.toml/Constants.kt—canvas-apiversion managed via version catalog and exposed asConstants.CANVAS_APIbuild.gradle.kts— registersdev.slne.surf.surfapi.gradle.canvas-pluginUsage
plugins { id("dev.slne.surf.surfapi.gradle.canvas-plugin") } surfCanvasPluginApi { mainClass("com.example.MyPlugin") bootstrapper("com.example.MyBootstrap") authors.add("yourname") }Canvas plugins have
foliaSupportedenabled by default. The capability resolution ensures canvas-api wins when transitive dependencies pull in paper-api or plain bukkit:configurations.all { resolutionStrategy.capabilitiesResolution.withCapability("org.bukkit:bukkit") { select(Constants.CANVAS_API) } }✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.