feat: sync with upstream paperweight for Paper 26.1 support#4
feat: sync with upstream paperweight for Paper 26.1 support#4HyacinthHaru wants to merge 1 commit intoLeavesMC:mainfrom
Conversation
Upgrade leavesweight to align with PaperMC/paperweight main branch, which has dropped the Spigot mappings / reobf pipeline since Paper 26.1 (Mojang no longer ships obfuscated server jars starting from that version). - Remove 11 Spigot/reobf-related files (SpigotTasks, SpigotExtension, FixJarForReobf, Generate*ReobfMappings, GenerateSpigotMappings, IncludeMappings, PatchMappings, RelocateClassNameConstants, SpigotRemapJar, UnpackSpigotBuildData, old createBuildTasks). - Add 26 upstream new files: paper-checkstyle plugin, PatchRoulette tasks, DevBundle V7 (SetupHandlerImplV7, RunRemappingCodebookAction, VanillaServerJarDownload, etc.). - Rewrite LeavesclipTasks to the single-jar model (no more mojmap/reobf split), mirroring upstream's PaperclipTasks but keeping Leavesclip branding and the META-INF/build-info output from CreateLeavesclipJar. - Sync ~40 modified files (CoreTasks, DevBundleTasks, PaperweightCore, PaperweightCoreExtension with new filterPatches and updatingMinecraft fields, PaperweightPatcher, etc.). - Preserve Leaves branding: PAPERCLIP_CONFIG="leavesclip", plugin IDs under org.leavesmc.leavesweight.*, publish to repo.leavesmc.org, leavesweight-core / leavesweight-userdev module names.
There was a problem hiding this comment.
Pull request overview
This PR syncs Leavesweight with upstream PaperMC/paperweight to support Paper 26.1+, aligning with the upstream removal of Spigot mappings and the legacy reobf pipeline, and adopting the newer single-jar/devbundle workflows.
Changes:
- Removes Spigot/reobf-related tasks and wiring, shifting to the upstream single-jar model and newer dev bundle versions.
- Adds upstream features like PatchRoulette tasks and the
paper-checkstyleplugin (including tests and resources). - Updates multiple build/tooling components (Gradle wrapper, versions catalog, buildSrc conventions, and various core/userdev task implementations).
Reviewed changes
Copilot reviewed 79 out of 80 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| paperweight-lib/src/main/kotlin/io/papermc/paperweight/util/utils.kt | Updates utilities (provider helpers, default toolchain launcher version, etc.). |
| paperweight-lib/src/main/kotlin/io/papermc/paperweight/util/file.kt | Removes custom createParentDirectories helper and related imports. |
| paperweight-lib/src/main/kotlin/io/papermc/paperweight/util/data/mache/MacheMeta.kt | Makes Mache dependency injection tolerate missing optional deps. |
| paperweight-lib/src/main/kotlin/io/papermc/paperweight/util/data/mache/MacheDependencies.kt | Makes paramMappings/remapper nullable in the Mache model. |
| paperweight-lib/src/main/kotlin/io/papermc/paperweight/util/constants/constants.kt | Adds constants for checkstyle extension + patch roulette/old-paper paths. |
| paperweight-lib/src/main/kotlin/io/papermc/paperweight/tasks/mache/RunCodebook.kt | Refactors codebook task to a simplified/nullable-input model. |
| paperweight-lib/src/main/kotlin/io/papermc/paperweight/tasks/UnpackSpigotBuildData.kt | Removes Spigot build-data unpack task (Spigot pipeline removal). |
| paperweight-lib/src/main/kotlin/io/papermc/paperweight/tasks/SpigotRemapJar.kt | Removes Spigot remap task (Spigot pipeline removal). |
| paperweight-lib/src/main/kotlin/io/papermc/paperweight/tasks/RelocateClassNameConstants.kt | Removes constant relocation task (reobf/CB relocation removal). |
| paperweight-lib/src/main/kotlin/io/papermc/paperweight/tasks/RebuildGitPatches.kt | Adjusts git fetch flags for patch rebuilding. |
| paperweight-lib/src/main/kotlin/io/papermc/paperweight/tasks/PatchMappings.kt | Removes mapping patch task used by old Spigot mapping flow. |
| paperweight-lib/src/main/kotlin/io/papermc/paperweight/tasks/IncludeMappings.kt | Removes mappings-in-jar task used by old reobf flow. |
| paperweight-lib/src/main/kotlin/io/papermc/paperweight/tasks/GenerateSpigotMappings.kt | Removes Spigot mappings generation task. |
| paperweight-lib/src/main/kotlin/io/papermc/paperweight/tasks/GenerateReobfMappings.kt | Removes reobf mappings generation task. |
| paperweight-lib/src/main/kotlin/io/papermc/paperweight/tasks/GenerateRelocatedReobfMappings.kt | Removes relocated reobf mappings task. |
| paperweight-lib/src/main/kotlin/io/papermc/paperweight/tasks/GenerateMappings.kt | Refactors mapping generation worker/action structure. |
| paperweight-lib/src/main/kotlin/io/papermc/paperweight/tasks/GenerateDevBundle.kt | Bumps dev bundle data version and removes reobf mappings embedding. |
| paperweight-lib/src/main/kotlin/io/papermc/paperweight/tasks/FixJarForReobf.kt | Removes pre-reobf jar fixup task. |
| paperweight-lib/src/main/kotlin/io/papermc/paperweight/tasks/ExtractFromBundler.kt | Drops cacheability annotation (behavioral/CC compatibility change). |
| paperweight-lib/src/main/kotlin-templates/io/papermc/paperweight/util/LibraryVersions.kt.peb | Adds templated Checkstyle version constant. |
| paperweight-lib/build.gradle.kts | Updates blossom + adds checkstyle version templating. |
| leavesweight-userdev/src/test/kotlin/io/papermc/paperweight/userdev/PaperweightUserTest.kt | Adds a plugin-application smoke test. |
| leavesweight-userdev/src/main/kotlin/io/papermc/paperweight/userdev/internal/setup/v7/SetupHandlerImplV7.kt | Adds dev bundle v7 setup handler (upstream-aligned). |
| leavesweight-userdev/src/main/kotlin/io/papermc/paperweight/userdev/internal/setup/v7/DevBundleV7.kt | Adds dev bundle v7 config model. |
| leavesweight-userdev/src/main/kotlin/io/papermc/paperweight/userdev/internal/setup/v2/SetupHandlerImplV2.kt | Updates imports for refactored mapping action symbol. |
| leavesweight-userdev/src/main/kotlin/io/papermc/paperweight/userdev/internal/setup/action/VanillaServerJarDownload.kt | Adds server-jar-only downloader action. |
| leavesweight-userdev/src/main/kotlin/io/papermc/paperweight/userdev/internal/setup/action/RunRemappingCodebookAction.kt | Adds remapping codebook action for v7 workflow. |
| leavesweight-userdev/src/main/kotlin/io/papermc/paperweight/userdev/internal/setup/action/RunCodebookAction.kt | Updates codebook action to new nullable-input signature. |
| leavesweight-userdev/src/main/kotlin/io/papermc/paperweight/userdev/internal/setup/SetupHandlerImpl.kt | Switches setup to server-jar-only download + new codebook action. |
| leavesweight-userdev/src/main/kotlin/io/papermc/paperweight/userdev/internal/setup/SetupHandler.kt | Adds v7 bundle handling + keeps v5/v8 routing. |
| leavesweight-userdev/src/main/kotlin/io/papermc/paperweight/userdev/internal/setup/DevBundles.kt | Updates supported bundle version mapping (6/7=v7, 8=v8). |
| leavesweight-userdev/src/main/kotlin/io/papermc/paperweight/userdev/PaperweightUserDependenciesExtension.kt | Migrates dependency creation to DependencyFactory-based API. |
| leavesweight-userdev/src/main/kotlin/io/papermc/paperweight/userdev/PaperweightUser.kt | Wires new dependency extension args + target-platform inference for REOBF config. |
| leavesweight-core/src/test/resources/checkstyle/basicMerge/output/merged_checkstyle.xml | Adds expected output for checkstyle config merge test. |
| leavesweight-core/src/test/resources/checkstyle/basicMerge/input/project_checkstyle.xml | Adds override checkstyle input fixture. |
| leavesweight-core/src/test/resources/checkstyle/basicMerge/input/base_checkstyle.xml | Adds base checkstyle input fixture. |
| leavesweight-core/src/test/kotlin/io/papermc/paperweight/checkstyle/tasks/MergeCheckstyleConfigsTest.kt | Adds unit test coverage for config merging task. |
| leavesweight-core/src/test/kotlin/io/papermc/paperweight/checkstyle/PaperCheckstyleTest.kt | Adds plugin-application smoke test for paper-checkstyle. |
| leavesweight-core/src/main/resources/META-INF/gradle-plugins/io.papermc.paperweight.paper-checkstyle.properties | Registers the new Gradle plugin id implementation class. |
| leavesweight-core/src/main/kotlin/io/papermc/paperweight/patcher/extension/PaperweightPatcherExtension.kt | Adds gitFilePatches/filterPatches toggles to patcher extension. |
| leavesweight-core/src/main/kotlin/io/papermc/paperweight/patcher/PaperweightPatcher.kt | Plumbs new patcher toggles into task container creation. |
| leavesweight-core/src/main/kotlin/io/papermc/paperweight/core/util/project-util.kt | Removes old build task creation helpers tied to Spigot/reobf. |
| leavesweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/patchroulette/ShowPatchRouletteList.kt | Adds patch roulette list UI task. |
| leavesweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/patchroulette/PushPatchRouletteList.kt | Adds patch roulette push task to publish patch lists. |
| leavesweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/patchroulette/PatchRouletteTasks.kt | Registers patch roulette task suite and config locations. |
| leavesweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/patchroulette/PatchRouletteFinish.kt | Adds finish task for marking patches done and cleaning local patch files. |
| leavesweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/patchroulette/PatchRouletteCancel.kt | Adds cancel task for releasing patches back to roulette. |
| leavesweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/patchroulette/PatchRouletteApply.kt | Adds apply task for selecting/starting patches and applying them locally. |
| leavesweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/patchroulette/ClearPatchRouletteList.kt | Adds debug-only task to clear roulette list. |
| leavesweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/patchroulette/AbstractPatchRouletteTask.kt | Adds shared HTTP client/task base for roulette operations. |
| leavesweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/patching/ApplySingleFilePatches.kt | Changes default patch mode to OFFSET for improved resilience. |
| leavesweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/patching/ApplyFilePatches.kt | Extends patch application with optional extra remote + reject-moving behavior. |
| leavesweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/SetupMinecraftSources.kt | Reworks MC sources setup to use zipped outputs and optional old-paper baseline. |
| leavesweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/SetupForkMinecraftSources.kt | Aligns AT working-dir handling with new caching/zipped model. |
| leavesweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/ExtractMinecraftSources.kt | Adds unzip task to materialize cached zipped git repos. |
| leavesweight-core/src/main/kotlin/io/papermc/paperweight/core/taskcontainers/UpstreamConfigTasks.kt | Updates patch file provider wiring + threads new filterPatches setting through. |
| leavesweight-core/src/main/kotlin/io/papermc/paperweight/core/taskcontainers/SpigotTasks.kt | Removes Spigot task container entirely. |
| leavesweight-core/src/main/kotlin/io/papermc/paperweight/core/taskcontainers/PatchingTasks.kt | Updates patch dir providers + adds apply-or-move flow; threads filterPatches. |
| leavesweight-core/src/main/kotlin/io/papermc/paperweight/core/taskcontainers/MinecraftPatchingTasks.kt | Updates patch dir providers + adds apply-or-move flow; threads filterPatches. |
| leavesweight-core/src/main/kotlin/io/papermc/paperweight/core/taskcontainers/LeavesclipTasks.kt | Switches to single server jar model (no mojmap/reobf split). |
| leavesweight-core/src/main/kotlin/io/papermc/paperweight/core/taskcontainers/InitialTasks.kt | Removes mappings download + old mapping generation setup. |
| leavesweight-core/src/main/kotlin/io/papermc/paperweight/core/taskcontainers/DevBundleTasks.kt | Switches dev bundle source input to extracted zipped sources; removes reobf mappings. |
| leavesweight-core/src/main/kotlin/io/papermc/paperweight/core/taskcontainers/CoreTasks.kt | Updates codebook remap task wiring + introduces zipped/extract steps; threads filterPatches. |
| leavesweight-core/src/main/kotlin/io/papermc/paperweight/core/taskcontainers/AllTasks.kt | Drops Spigot inheritance and removes reobf mappings generation tasks. |
| leavesweight-core/src/main/kotlin/io/papermc/paperweight/core/extension/UpdatingMinecraftExtension.kt | Replaces Spigot extension with updating-minecraft extension (oldPaperCommit). |
| leavesweight-core/src/main/kotlin/io/papermc/paperweight/core/extension/PaperweightCoreExtension.kt | Removes Spigot fields; adds filterPatches + updatingMinecraft config block. |
| leavesweight-core/src/main/kotlin/io/papermc/paperweight/core/PaperweightCore.kt | Removes reobf build path; adds update-mode wiring + PatchRoulette integration. |
| leavesweight-core/src/main/kotlin/io/papermc/paperweight/checkstyle/tasks/PaperCheckstyleTask.kt | Adds custom Checkstyle task subclass with filtering + config override support. |
| leavesweight-core/src/main/kotlin/io/papermc/paperweight/checkstyle/tasks/MergeCheckstyleConfigs.kt | Adds task to merge base/project checkstyle configs. |
| leavesweight-core/src/main/kotlin/io/papermc/paperweight/checkstyle/PaperCheckstylePlugin.kt | Adds plugin class to override Checkstyle task type. |
| leavesweight-core/src/main/kotlin/io/papermc/paperweight/checkstyle/PaperCheckstyleExt.kt | Adds extension for checkstyle configuration files + custom tags. |
| leavesweight-core/src/main/kotlin/io/papermc/paperweight/checkstyle/PaperCheckstyle.kt | Adds paper-checkstyle plugin wiring and conventions. |
| leavesweight-core/src/main/kotlin/io/papermc/paperweight/checkstyle/JavadocTag.kt | Adds model for configurable custom Javadoc tags. |
| gradle/wrapper/gradle-wrapper.properties | Updates Gradle wrapper distribution URL. |
| gradle/libs.versions.toml | Updates dependency/plugin versions + adds checkstyle version entry. |
| gradle.properties | Enables Gradle configuration cache globally. |
| buildSrc/src/main/kotlin/utils.kt | Updates Gradle plugin API compatibility attribute and plugin tags ordering. |
| buildSrc/src/main/kotlin/config-publish.gradle.kts | Adjusts ShadowJar services file duplicates handling. |
| buildSrc/src/main/kotlin/config-kotlin.gradle.kts | Updates repos, JUnit deps, ktlint version/rules, and compiler args. |
| build.gradle.kts | Makes version printing configuration-cache friendly by capturing value. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| fun <T : FileSystemLocation> Provider<out T>.fileExists(): Provider<out T> { | ||
| return map { it.takeIf { f -> f.path.exists() } } | ||
| } |
There was a problem hiding this comment.
fileExists() can return null (via takeIf), but the signature advertises a non-null Provider<out T>. That hides the nullable contract and makes call sites easy to misuse (and can lead to runtime failures if .get() is called). Consider returning Provider<out T?> (or a dedicated Provider<out T>.orNullIfMissing() helper) so optional inputs remain explicit.
| responseCode > 1 -> throw PaperweightException("Failed to apply patch $patch: $responseCode") | ||
| responseCode == 1 -> { | ||
| val relativePatch = patches.path.relativize(patch) | ||
| val failedFile = relativePatch.parent.resolve(relativePatch.fileName.toString().substringBeforeLast(".patch")) |
There was a problem hiding this comment.
relativePatch.parent is nullable (patches can be at the root of the patch directory), so relativePatch.parent.resolve(...) will either fail to compile or throw at runtime. Handle the no-parent case (e.g., use relativePatch.fileName directly when parent == null).
| val failedFile = relativePatch.parent.resolve(relativePatch.fileName.toString().substringBeforeLast(".patch")) | |
| val failedFileName = relativePatch.fileName.toString().substringBeforeLast(".patch") | |
| val failedFile = relativePatch.parent?.resolve(failedFileName) ?: Path(failedFileName) |
| remapper.get(), | ||
| mappings.get(), | ||
| paramMappings.get().singleFile.toPath(), | ||
| constants.get().singleOrNull()?.toPath(), |
There was a problem hiding this comment.
paramMappings.get().singleFile will throw if the Mache metadata omits paramMappings (it is now nullable) or if the configuration resolves to 0/2+ files. Consider treating param mappings/remapper as optional here: pass null when the collection is empty and only require singleFile when the args actually contain {paramsFile} (and likewise for {remapperFile}).
| providers.fileContents(ext.directoriesToSkipFile).asText.map { | ||
| it.trim().lines().map { line -> line.trim() } |
There was a problem hiding this comment.
directoriesToSkip is configured from providers.fileContents(ext.directoriesToSkipFile) unconditionally. If the file is missing (common in consumers), this will error even though the property is marked optional on the task. Consider guarding with an existence check and defaulting to an empty set when the file doesn’t exist.
| providers.fileContents(ext.directoriesToSkipFile).asText.map { | |
| it.trim().lines().map { line -> line.trim() } | |
| ext.directoriesToSkipFile.flatMap { file -> | |
| if (file.asFile.exists()) { | |
| providers.fileContents(file).asText.map { | |
| it.trim().lines().map { line -> line.trim() } | |
| } | |
| } else { | |
| providers.provider { emptyList<String>() } | |
| } |
| import org.gradle.kotlin.dsl.* | ||
|
|
||
| abstract class SetupMinecraftSources : JavaLauncherTask() { | ||
| @CacheableTask |
There was a problem hiding this comment.
SetupMinecraftSources is marked @CacheableTask, but when oldPaperCommit is set it performs network/git fetches, writes to $OLD_PAPER_PATH/... and spawns an external Gradle process to run applyPatches. Those side effects aren’t declared as outputs and can make build cache results non-reproducible. Consider removing @CacheableTask (or disabling caching when oldPaperCommit is present), and/or declaring the old-paper working directory/log as task outputs/inputs.
| @CacheableTask |
| val macheRemapJar by tasks.registering(RunCodebook::class) { | ||
| serverJar.set(extractFromBundler.flatMap { it.serverJar }) | ||
| serverMappings.set(downloadMappings.flatMap { it.outputFile }) | ||
|
|
||
| remapperArgs.set(mache.map { it.remapperArgs }) | ||
| codebookArgs.set(mache.map { it.remapperArgs }) | ||
| codebookClasspath.from(project.configurations.named(MACHE_CODEBOOK_CONFIG)) | ||
| minecraftClasspath.from(project.configurations.named(MACHE_MINECRAFT_LIBRARIES_CONFIG)) | ||
| remapperClasspath.from(project.configurations.named(MACHE_REMAPPER_CONFIG)) | ||
| paramMappings.from(project.configurations.named(MACHE_PARAM_MAPPINGS_CONFIG)) | ||
| constants.from(project.configurations.named(MACHE_CONSTANTS_CONFIG)) |
There was a problem hiding this comment.
RunCodebook is now invoked without remapperClasspath/serverMappings/paramMappings, but mache.remapperArgs may still include placeholders like {remapperFile}, {mappingsFile}, {paramsFile} (see the repo’s fake_mache/mache.json). With the new runCodebook implementation this will hard-fail at runtime. Either ensure the new Mache metadata no longer emits these placeholders for this path, or plumb the required inputs back into the task when they are needed.
| val remap = dispatcher.register( | ||
| "remapMinecraft", | ||
| "runCodebook", | ||
| RunCodebookAction( | ||
| javaLauncher, | ||
| stringListValue(macheMeta().remapperArgs), | ||
| extract.vanillaServerJar, | ||
| extract.minecraftLibraryJars, | ||
| vanillaDownloads.serverMappings, | ||
| FileCollectionValue(context.macheParamMappingsConfig), | ||
| FileCollectionValue(context.macheConstantsConfig), | ||
| FileCollectionValue(context.macheCodebookConfig), | ||
| FileCollectionValue(context.macheRemapperConfig), | ||
| dispatcher.outputFile("output.jar"), |
There was a problem hiding this comment.
RunCodebookAction passes null for remapper/mappings/param mappings, but still uses macheMeta().remapperArgs. If those args contain {remapperFile}, {mappingsFile}, or {paramsFile}, runCodebook will now throw at execution time. Consider validating/rewriting args for the single-jar model (or wiring the needed inputs when placeholders are present).
| override fun run() { | ||
| if (undo.isPresent) { | ||
| TODO("Implement undo for accidental completion") | ||
| } |
There was a problem hiding this comment.
The --undo option is exposed on the task, but currently throws TODO(...) when used. Either implement undo, or remove the option / replace the TODO with a clear PaperweightException explaining it’s unsupported (so users don’t hit a Kotlin TODO crash).
| abstract val typeUseAnnotationsFile: RegularFileProperty | ||
|
|
||
| abstract val directoriesToSkipFile: RegularFileProperty | ||
|
|
||
| abstract val customJavadocTags: SetProperty<JavadocTag> |
There was a problem hiding this comment.
directoriesToSkipFile has no convention/default, but the plugin reads it via providers.fileContents(...) during task configuration. This will fail unless every consuming build explicitly sets the file. Consider providing a sensible default path (similar to typeUseAnnotationsFile) and/or making it truly optional.
| plugins.register("leavesweight-$prefix") { | ||
| id = "org.leavesmc.leavesweight." + prefix | ||
| displayName = "leavesweight $prefix" | ||
| tags.set(listOf("paper", "leaves", "minecraft")) |
将 leavesweight 升级到与 PaperMC/paperweight 主分支对齐。
该主分支自 Paper 26.1 起已移除 Spigot 映射 / reobf 流程。这是因为从该版本开始 Mojang 不再提供混淆后的服务端 jar
主要改动: