From 143fe830678c95518bafedfca6ea1cc01958eb73 Mon Sep 17 00:00:00 2001 From: Toffikk Date: Mon, 18 Aug 2025 15:48:18 +0200 Subject: [PATCH 1/5] feat(update): update diffpatch to 2.0.1.40 This commit updates diffpatch to the *currently* latest version and migrates previous inputs and outputs to use the Multi/Single Input/Output interfaces Everything was tested locally and using a dev bundle and no regressions nor changes in patch output have been noticed. The reasoning for this update is to keep up-to-date with the latest improvements in the library (such as fixing ghost patches) --- gradle/libs.versions.toml | 2 +- .../taskcontainers/UpstreamConfigTasks.kt | 2 +- .../core/tasks/SetupMinecraftSources.kt | 22 +++++++------ .../core/tasks/patching/ApplyFilePatches.kt | 32 ++++++++++--------- .../tasks/patching/ApplyFilePatchesFuzzy.kt | 2 +- .../tasks/patching/ApplySingleFilePatches.kt | 16 ++++++---- .../core/tasks/patching/RebuildFilePatches.kt | 20 ++++++------ .../patching/RebuildSingleFilePatches.kt | 12 ++++--- .../paperweight/tasks/GenerateDevBundle.kt | 12 ++++--- .../action/ApplyDevBundlePatchesAction.kt | 14 ++++---- .../setup/action/SetupMacheSourcesAction.kt | 14 ++++---- 11 files changed, 82 insertions(+), 66 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 906b89818..9f8e82061 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -32,7 +32,7 @@ hypo-mappings = { module = "dev.denwav.hypo:hypo-mappings", version.ref = "hypo" lorenzTiny = "net.fabricmc:lorenz-tiny:3.0.0" jbsdiff = "io.sigpipe:jbsdiff:1.0" -diffpatch = "codechicken:DiffPatch:1.5.0.30" +diffpatch = "io.codechicken:DiffPatch:2.0.1.40" serialize-core = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version.ref = "serialize" } serialize-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "serialize" } diff --git a/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/taskcontainers/UpstreamConfigTasks.kt b/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/taskcontainers/UpstreamConfigTasks.kt index 3b95ba560..8e052eff6 100644 --- a/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/taskcontainers/UpstreamConfigTasks.kt +++ b/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/taskcontainers/UpstreamConfigTasks.kt @@ -22,7 +22,7 @@ package io.papermc.paperweight.core.taskcontainers -import codechicken.diffpatch.util.PatchMode +import io.codechicken.diffpatch.util.PatchMode import io.papermc.paperweight.core.extension.UpstreamConfig import io.papermc.paperweight.core.tasks.FilterRepo import io.papermc.paperweight.core.tasks.RunNestedBuild diff --git a/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/SetupMinecraftSources.kt b/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/SetupMinecraftSources.kt index 6f3e2c826..074384092 100644 --- a/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/SetupMinecraftSources.kt +++ b/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/SetupMinecraftSources.kt @@ -22,9 +22,11 @@ package io.papermc.paperweight.core.tasks -import codechicken.diffpatch.cli.PatchOperation -import codechicken.diffpatch.util.LoggingOutputStream -import codechicken.diffpatch.util.archiver.ArchiveFormat +import io.codechicken.diffpatch.cli.PatchOperation +import io.codechicken.diffpatch.util.ConsumingOutputStream +import io.codechicken.diffpatch.util.Input as DiffInput +import io.codechicken.diffpatch.util.Output as DiffOutput +import io.codechicken.diffpatch.util.archiver.ArchiveFormat import io.papermc.paperweight.PaperweightException import io.papermc.paperweight.core.util.ApplySourceATs import io.papermc.paperweight.tasks.* @@ -145,12 +147,12 @@ abstract class SetupMinecraftSources : JavaLauncherZippedTask() { println("Applying mache patches...") val result = PatchOperation.builder() - .logTo(LoggingOutputStream(logger, LogLevel.LIFECYCLE)) - .basePath(outputPath.convertToPath()) - .outputPath(outputPath.convertToPath()) - .patchesPath(mache.singleFile.toPath(), ArchiveFormat.ZIP) + .logTo(ConsumingOutputStream { s -> logger.log(LogLevel.LIFECYCLE, s) }) + .baseInput(DiffInput.MultiInput.folder(outputPath.convertToPath())) + .patchedOutput(DiffOutput.MultiOutput.folder(outputPath.convertToPath())) + .patchesInput(DiffInput.MultiInput.archive(ArchiveFormat.ZIP, mache.singleFile.toPath())) .patchesPrefix("patches") - .level(codechicken.diffpatch.util.LogLevel.INFO) + .level(io.codechicken.diffpatch.util.LogLevel.INFO) .ignorePrefix(".git") .build() .operate() @@ -160,10 +162,10 @@ abstract class SetupMinecraftSources : JavaLauncherZippedTask() { } if (result.exit != 0) { - throw Exception("Failed to apply ${result.summary.failedMatches} mache patches") + throw Exception("Failed to apply ${result.summary?.failedMatches} mache patches") } - logger.lifecycle("Applied ${result.summary.changedFiles} mache patches") + logger.lifecycle("Applied ${result.summary?.changedFiles} mache patches") } if (atFile.isPresent) { diff --git a/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/patching/ApplyFilePatches.kt b/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/patching/ApplyFilePatches.kt index 43d953242..b9e234f5e 100644 --- a/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/patching/ApplyFilePatches.kt +++ b/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/patching/ApplyFilePatches.kt @@ -22,10 +22,12 @@ package io.papermc.paperweight.core.tasks.patching -import codechicken.diffpatch.cli.PatchOperation -import codechicken.diffpatch.match.FuzzyLineMatcher -import codechicken.diffpatch.util.LoggingOutputStream -import codechicken.diffpatch.util.PatchMode +import io.codechicken.diffpatch.cli.PatchOperation +import io.codechicken.diffpatch.match.FuzzyLineMatcher +import io.codechicken.diffpatch.util.ConsumingOutputStream +import io.codechicken.diffpatch.util.Input as DiffInput +import io.codechicken.diffpatch.util.Output as DiffOutput +import io.codechicken.diffpatch.util.PatchMode import io.papermc.paperweight.PaperweightException import io.papermc.paperweight.tasks.* import io.papermc.paperweight.util.* @@ -210,21 +212,21 @@ abstract class ApplyFilePatches : BaseTask() { return patchFiles.size } - private fun applyWithDiffPatch(): Int { - val printStream = PrintStream(LoggingOutputStream(logger, LogLevel.LIFECYCLE)) + private fun applyWithDiffPatch(): Int? { + val printStream = PrintStream(ConsumingOutputStream { s -> logger.log(LogLevel.LIFECYCLE, s) }) val builder = PatchOperation.builder() .logTo(printStream) - .basePath(output.path) - .patchesPath(patches.path) - .outputPath(output.path) - .level(if (verbose.get()) codechicken.diffpatch.util.LogLevel.ALL else codechicken.diffpatch.util.LogLevel.INFO) + .baseInput(DiffInput.MultiInput.folder(output.path)) + .patchesInput(DiffInput.MultiInput.folder(patches.path)) + .patchedOutput(DiffOutput.MultiOutput.folder(output.path)) + .level(if (verbose.get()) io.codechicken.diffpatch.util.LogLevel.ALL else io.codechicken.diffpatch.util.LogLevel.INFO) .mode(mode()) .minFuzz(minFuzz()) .summary(verbose.get()) .lineEnding("\n") .ignorePrefix(".git") if (rejectsDir.isPresent && emitRejects.get()) { - builder.rejectsPath(rejectsDir.path) + builder.rejectsOutput(DiffOutput.MultiOutput.folder(rejectsDir.path)) } val result = builder.build().operate() @@ -232,12 +234,12 @@ abstract class ApplyFilePatches : BaseTask() { commit() if (result.exit != 0) { - val total = result.summary.failedMatches + result.summary.exactMatches + - result.summary.accessMatches + result.summary.offsetMatches + result.summary.fuzzyMatches - throw Exception("Failed to apply ${result.summary.failedMatches}/$total hunks") + val total = (result.summary?.failedMatches ?: 0) + (result.summary?.exactMatches ?: 0) + + (result.summary?.accessMatches ?: 0) + (result.summary?.offsetMatches ?: 0) + (result.summary?.fuzzyMatches ?: 0) + throw Exception("Failed to apply ${result.summary?.failedMatches}/$total hunks") } - return result.summary.changedFiles + return result.summary?.changedFiles } private fun setupGitHook(outputPath: Path) { diff --git a/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/patching/ApplyFilePatchesFuzzy.kt b/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/patching/ApplyFilePatchesFuzzy.kt index 091d8b7fe..df34318b9 100644 --- a/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/patching/ApplyFilePatchesFuzzy.kt +++ b/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/patching/ApplyFilePatchesFuzzy.kt @@ -22,7 +22,7 @@ package io.papermc.paperweight.core.tasks.patching -import codechicken.diffpatch.util.PatchMode +import io.codechicken.diffpatch.util.PatchMode import io.papermc.paperweight.core.util.defaultMinFuzz import javax.inject.Inject import org.gradle.api.provider.Property diff --git a/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/patching/ApplySingleFilePatches.kt b/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/patching/ApplySingleFilePatches.kt index 4c8bd44e8..b481f9e72 100644 --- a/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/patching/ApplySingleFilePatches.kt +++ b/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/patching/ApplySingleFilePatches.kt @@ -22,9 +22,11 @@ package io.papermc.paperweight.core.tasks.patching -import codechicken.diffpatch.cli.PatchOperation -import codechicken.diffpatch.util.LogLevel -import codechicken.diffpatch.util.PatchMode +import io.codechicken.diffpatch.cli.PatchOperation +import io.codechicken.diffpatch.util.Input as DiffInput +import io.codechicken.diffpatch.util.LogLevel +import io.codechicken.diffpatch.util.Output as DiffOutput +import io.codechicken.diffpatch.util.PatchMode import io.papermc.paperweight.PaperweightException import io.papermc.paperweight.core.util.defaultMinFuzz import io.papermc.paperweight.tasks.* @@ -129,10 +131,10 @@ abstract class ApplySingleFilePatches : BaseTask() { .mode(mode.get()) .minFuzz(minFuzz.get().toFloat()) .summary(false) - .basePath(tmpWork) - .patchesPath(tmpPatch) - .outputPath(tmpWork) - .rejectsPath(tmpRej) + .baseInput(DiffInput.MultiInput.folder(tmpWork)) + .patchesInput(DiffInput.MultiInput.folder(tmpPatch)) + .patchedOutput(DiffOutput.MultiOutput.folder(tmpWork)) + .rejectsOutput(DiffOutput.MultiOutput.folder(tmpRej)) .build() op.operate() diff --git a/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/patching/RebuildFilePatches.kt b/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/patching/RebuildFilePatches.kt index 68c016b1d..523d8b4db 100644 --- a/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/patching/RebuildFilePatches.kt +++ b/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/patching/RebuildFilePatches.kt @@ -22,9 +22,11 @@ package io.papermc.paperweight.core.tasks.patching -import codechicken.diffpatch.cli.DiffOperation -import codechicken.diffpatch.util.LogLevel -import codechicken.diffpatch.util.LoggingOutputStream +import io.codechicken.diffpatch.cli.DiffOperation +import io.codechicken.diffpatch.util.ConsumingOutputStream +import io.codechicken.diffpatch.util.Input as DiffInput +import io.codechicken.diffpatch.util.LogLevel +import io.codechicken.diffpatch.util.Output as DiffOutput import io.papermc.paperweight.PaperweightException import io.papermc.paperweight.core.util.ApplySourceATs import io.papermc.paperweight.tasks.* @@ -182,13 +184,13 @@ abstract class RebuildFilePatches : JavaLauncherTask() { baseDir: Path, inputDir: Path, patchDir: Path - ): Int { - val printStream = PrintStream(LoggingOutputStream(logger, org.gradle.api.logging.LogLevel.LIFECYCLE)) + ): Int? { + val printStream = PrintStream(ConsumingOutputStream { s -> logger.log(org.gradle.api.logging.LogLevel.LIFECYCLE, s) }) val result = DiffOperation.builder() .logTo(printStream) - .aPath(baseDir) - .bPath(inputDir) - .outputPath(patchDir) + .baseInput(DiffInput.MultiInput.folder(baseDir)) + .changedInput(DiffInput.MultiInput.folder(inputDir)) + .patchesOutput(DiffOutput.MultiOutput.folder(patchDir)) .autoHeader(true) .level(if (verbose.get()) LogLevel.ALL else LogLevel.INFO) .lineEnding("\n") @@ -200,7 +202,7 @@ abstract class RebuildFilePatches : JavaLauncherTask() { .summary(verbose.get()) .build() .operate() - return result.summary.changedFiles + return result.summary?.changedFiles } private fun handleAts( diff --git a/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/patching/RebuildSingleFilePatches.kt b/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/patching/RebuildSingleFilePatches.kt index 45cd14d5b..73b579b20 100644 --- a/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/patching/RebuildSingleFilePatches.kt +++ b/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/patching/RebuildSingleFilePatches.kt @@ -22,8 +22,10 @@ package io.papermc.paperweight.core.tasks.patching -import codechicken.diffpatch.cli.DiffOperation -import codechicken.diffpatch.util.LogLevel +import io.codechicken.diffpatch.cli.DiffOperation +import io.codechicken.diffpatch.util.Input as DiffInput +import io.codechicken.diffpatch.util.LogLevel +import io.codechicken.diffpatch.util.Output as DiffOutput import io.papermc.paperweight.tasks.* import io.papermc.paperweight.util.* import java.io.PrintStream @@ -80,9 +82,9 @@ abstract class RebuildSingleFilePatches : BaseTask() { val result = DiffOperation.builder() .logTo(logOut) - .aPath(tmpA) - .bPath(tmpB) - .outputPath(tmpPatch) + .baseInput(DiffInput.MultiInput.folder(tmpA)) + .changedInput(DiffInput.MultiInput.folder(tmpB)) + .patchesOutput(DiffOutput.MultiOutput.folder(tmpPatch)) .autoHeader(true) .level(LogLevel.ALL) .lineEnding("\n") diff --git a/paperweight-lib/src/main/kotlin/io/papermc/paperweight/tasks/GenerateDevBundle.kt b/paperweight-lib/src/main/kotlin/io/papermc/paperweight/tasks/GenerateDevBundle.kt index 37266e025..897a993ca 100644 --- a/paperweight-lib/src/main/kotlin/io/papermc/paperweight/tasks/GenerateDevBundle.kt +++ b/paperweight-lib/src/main/kotlin/io/papermc/paperweight/tasks/GenerateDevBundle.kt @@ -22,8 +22,10 @@ package io.papermc.paperweight.tasks -import codechicken.diffpatch.cli.DiffOperation -import codechicken.diffpatch.util.LogLevel +import io.codechicken.diffpatch.cli.DiffOperation +import io.codechicken.diffpatch.util.Input as DiffInput +import io.codechicken.diffpatch.util.LogLevel +import io.codechicken.diffpatch.util.Output as DiffOutput import io.papermc.paperweight.util.* import io.papermc.paperweight.util.constants.* import java.io.PrintStream @@ -168,9 +170,9 @@ abstract class GenerateDevBundle : BaseTask() { PrintStream(logFile.toFile(), Charsets.UTF_8).use { logOut -> DiffOperation.builder() .logTo(logOut) - .aPath(a) - .bPath(b) - .outputPath(patchOut, null) + .baseInput(DiffInput.MultiInput.folder(a)) + .changedInput(DiffInput.MultiInput.folder(b)) + .patchesOutput(DiffOutput.MultiOutput.folder(patchOut)) .autoHeader(true) .level(LogLevel.ALL) .lineEnding("\n") diff --git a/paperweight-userdev/src/main/kotlin/io/papermc/paperweight/userdev/internal/setup/action/ApplyDevBundlePatchesAction.kt b/paperweight-userdev/src/main/kotlin/io/papermc/paperweight/userdev/internal/setup/action/ApplyDevBundlePatchesAction.kt index ee72c6b61..7c20d009a 100644 --- a/paperweight-userdev/src/main/kotlin/io/papermc/paperweight/userdev/internal/setup/action/ApplyDevBundlePatchesAction.kt +++ b/paperweight-userdev/src/main/kotlin/io/papermc/paperweight/userdev/internal/setup/action/ApplyDevBundlePatchesAction.kt @@ -22,9 +22,11 @@ package io.papermc.paperweight.userdev.internal.setup.action -import codechicken.diffpatch.cli.PatchOperation -import codechicken.diffpatch.util.LogLevel -import codechicken.diffpatch.util.archiver.ArchiveFormat +import io.codechicken.diffpatch.cli.PatchOperation +import io.codechicken.diffpatch.util.Input as DiffInput +import io.codechicken.diffpatch.util.LogLevel +import io.codechicken.diffpatch.util.Output as DiffOutput +import io.codechicken.diffpatch.util.archiver.ArchiveFormat import io.papermc.paperweight.PaperweightException import io.papermc.paperweight.userdev.internal.action.FileValue import io.papermc.paperweight.userdev.internal.action.Input @@ -68,9 +70,9 @@ class ApplyDevBundlePatchesAction( .logTo(logOut) .level(LogLevel.ALL) .summary(true) - .basePath(decompiledJar.get(), ArchiveFormat.ZIP) - .patchesPath(tempPatchDir) - .outputPath(outputDir) + .baseInput(DiffInput.MultiInput.archive(ArchiveFormat.ZIP, decompiledJar.get())) + .patchesInput(DiffInput.MultiInput.folder(tempPatchDir)) + .patchedOutput(DiffOutput.MultiOutput.folder(outputDir)) .build() try { op.operate().throwOnError() diff --git a/paperweight-userdev/src/main/kotlin/io/papermc/paperweight/userdev/internal/setup/action/SetupMacheSourcesAction.kt b/paperweight-userdev/src/main/kotlin/io/papermc/paperweight/userdev/internal/setup/action/SetupMacheSourcesAction.kt index 018029e77..c9e98d33b 100644 --- a/paperweight-userdev/src/main/kotlin/io/papermc/paperweight/userdev/internal/setup/action/SetupMacheSourcesAction.kt +++ b/paperweight-userdev/src/main/kotlin/io/papermc/paperweight/userdev/internal/setup/action/SetupMacheSourcesAction.kt @@ -22,9 +22,11 @@ package io.papermc.paperweight.userdev.internal.setup.action -import codechicken.diffpatch.cli.PatchOperation -import codechicken.diffpatch.util.LogLevel -import codechicken.diffpatch.util.archiver.ArchiveFormat +import io.codechicken.diffpatch.cli.PatchOperation +import io.codechicken.diffpatch.util.Input as DiffInput +import io.codechicken.diffpatch.util.LogLevel +import io.codechicken.diffpatch.util.Output as DiffOutput +import io.codechicken.diffpatch.util.archiver.ArchiveFormat import io.papermc.paperweight.PaperweightException import io.papermc.paperweight.tasks.mache.macheDecompileJar import io.papermc.paperweight.userdev.internal.action.DirectoryValue @@ -72,9 +74,9 @@ class SetupMacheSourcesAction( val result = PrintStream(log.toFile(), Charsets.UTF_8).use { logOut -> PatchOperation.builder() .logTo(logOut) - .basePath(tempOut, ArchiveFormat.ZIP) - .outputPath(outputJar.get(), ArchiveFormat.ZIP) - .patchesPath(mache.get().singleFile.toPath(), ArchiveFormat.ZIP) + .baseInput(DiffInput.MultiInput.archive(ArchiveFormat.ZIP, tempOut)) + .patchedOutput(DiffOutput.MultiOutput.archive(ArchiveFormat.ZIP, outputJar.get())) + .patchesInput(DiffInput.MultiInput.archive(ArchiveFormat.ZIP, mache.get().singleFile.toPath())) .patchesPrefix("patches") .level(LogLevel.ALL) .summary(true) From 241b0571fdc9c11a62abba58a4dac967a1b63c4a Mon Sep 17 00:00:00 2001 From: Toffikk Date: Mon, 18 Aug 2025 17:33:26 +0200 Subject: [PATCH 2/5] fix: update the group id for diffpatch in buildsrc --- buildSrc/src/main/kotlin/config-kotlin.gradle.kts | 2 +- buildSrc/src/main/kotlin/config-publish.gradle.kts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/buildSrc/src/main/kotlin/config-kotlin.gradle.kts b/buildSrc/src/main/kotlin/config-kotlin.gradle.kts index a2fd84903..b08ab4dd8 100644 --- a/buildSrc/src/main/kotlin/config-kotlin.gradle.kts +++ b/buildSrc/src/main/kotlin/config-kotlin.gradle.kts @@ -35,7 +35,7 @@ repositories { } maven("https://repo.papermc.io/repository/maven-public/") { mavenContent { - includeGroup("codechicken") + includeGroup("io.codechicken") includeGroup("net.fabricmc") includeGroupAndSubgroups("io.papermc") } diff --git a/buildSrc/src/main/kotlin/config-publish.gradle.kts b/buildSrc/src/main/kotlin/config-publish.gradle.kts index 7cd47e1cb..9fbf9b695 100644 --- a/buildSrc/src/main/kotlin/config-publish.gradle.kts +++ b/buildSrc/src/main/kotlin/config-publish.gradle.kts @@ -64,8 +64,8 @@ val shadowJar by tasks.existing(ShadowJar::class) { val prefix = "paper.libs" listOf( - "codechicken.diffpatch", - /* -> */ "codechicken.repack", + "io.codechicken.diffpatch", + /* -> */ "io.codechicken.repack", "com.github.salomonbrys.kotson", "com.google.gson", "dev.denwav.hypo", From 9b2dc60702ae95ef21e54be5992494366aa95f08 Mon Sep 17 00:00:00 2001 From: Toffikk Date: Tue, 19 Aug 2025 00:15:02 +0200 Subject: [PATCH 3/5] chore: cleanup after diff library update --- .../papermc/paperweight/core/tasks/SetupMinecraftSources.kt | 3 +-- .../paperweight/core/tasks/patching/ApplyFilePatches.kt | 5 +---- .../paperweight/core/tasks/patching/RebuildFilePatches.kt | 5 +---- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/SetupMinecraftSources.kt b/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/SetupMinecraftSources.kt index 074384092..5ed73903f 100644 --- a/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/SetupMinecraftSources.kt +++ b/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/SetupMinecraftSources.kt @@ -23,7 +23,6 @@ package io.papermc.paperweight.core.tasks import io.codechicken.diffpatch.cli.PatchOperation -import io.codechicken.diffpatch.util.ConsumingOutputStream import io.codechicken.diffpatch.util.Input as DiffInput import io.codechicken.diffpatch.util.Output as DiffOutput import io.codechicken.diffpatch.util.archiver.ArchiveFormat @@ -147,7 +146,7 @@ abstract class SetupMinecraftSources : JavaLauncherZippedTask() { println("Applying mache patches...") val result = PatchOperation.builder() - .logTo(ConsumingOutputStream { s -> logger.log(LogLevel.LIFECYCLE, s) }) + .logTo(logger::lifecycle) .baseInput(DiffInput.MultiInput.folder(outputPath.convertToPath())) .patchedOutput(DiffOutput.MultiOutput.folder(outputPath.convertToPath())) .patchesInput(DiffInput.MultiInput.archive(ArchiveFormat.ZIP, mache.singleFile.toPath())) diff --git a/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/patching/ApplyFilePatches.kt b/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/patching/ApplyFilePatches.kt index b9e234f5e..f78431a2b 100644 --- a/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/patching/ApplyFilePatches.kt +++ b/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/patching/ApplyFilePatches.kt @@ -24,14 +24,12 @@ package io.papermc.paperweight.core.tasks.patching import io.codechicken.diffpatch.cli.PatchOperation import io.codechicken.diffpatch.match.FuzzyLineMatcher -import io.codechicken.diffpatch.util.ConsumingOutputStream import io.codechicken.diffpatch.util.Input as DiffInput import io.codechicken.diffpatch.util.Output as DiffOutput import io.codechicken.diffpatch.util.PatchMode import io.papermc.paperweight.PaperweightException import io.papermc.paperweight.tasks.* import io.papermc.paperweight.util.* -import java.io.PrintStream import java.nio.file.Path import java.time.Instant import kotlin.io.path.* @@ -213,9 +211,8 @@ abstract class ApplyFilePatches : BaseTask() { } private fun applyWithDiffPatch(): Int? { - val printStream = PrintStream(ConsumingOutputStream { s -> logger.log(LogLevel.LIFECYCLE, s) }) val builder = PatchOperation.builder() - .logTo(printStream) + .logTo(logger::lifecycle) .baseInput(DiffInput.MultiInput.folder(output.path)) .patchesInput(DiffInput.MultiInput.folder(patches.path)) .patchedOutput(DiffOutput.MultiOutput.folder(output.path)) diff --git a/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/patching/RebuildFilePatches.kt b/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/patching/RebuildFilePatches.kt index 523d8b4db..ca4bdbe12 100644 --- a/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/patching/RebuildFilePatches.kt +++ b/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/patching/RebuildFilePatches.kt @@ -23,7 +23,6 @@ package io.papermc.paperweight.core.tasks.patching import io.codechicken.diffpatch.cli.DiffOperation -import io.codechicken.diffpatch.util.ConsumingOutputStream import io.codechicken.diffpatch.util.Input as DiffInput import io.codechicken.diffpatch.util.LogLevel import io.codechicken.diffpatch.util.Output as DiffOutput @@ -31,7 +30,6 @@ import io.papermc.paperweight.PaperweightException import io.papermc.paperweight.core.util.ApplySourceATs import io.papermc.paperweight.tasks.* import io.papermc.paperweight.util.* -import java.io.PrintStream import java.nio.file.Path import kotlin.io.path.* import org.cadixdev.at.AccessTransformSet @@ -185,9 +183,8 @@ abstract class RebuildFilePatches : JavaLauncherTask() { inputDir: Path, patchDir: Path ): Int? { - val printStream = PrintStream(ConsumingOutputStream { s -> logger.log(org.gradle.api.logging.LogLevel.LIFECYCLE, s) }) val result = DiffOperation.builder() - .logTo(printStream) + .logTo(logger::lifecycle) .baseInput(DiffInput.MultiInput.folder(baseDir)) .changedInput(DiffInput.MultiInput.folder(inputDir)) .patchesOutput(DiffOutput.MultiOutput.folder(patchDir)) From 304c61428bcc0f1e8d65359203b2f91a4fb34a5e Mon Sep 17 00:00:00 2001 From: "tofik.07" <62406295+Toffikk@users.noreply.github.com> Date: Sat, 8 Nov 2025 20:29:12 +0100 Subject: [PATCH 4/5] fix(deps): update diffpatch to v2.1.0.42 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 9f8e82061..b75880ea2 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -32,7 +32,7 @@ hypo-mappings = { module = "dev.denwav.hypo:hypo-mappings", version.ref = "hypo" lorenzTiny = "net.fabricmc:lorenz-tiny:3.0.0" jbsdiff = "io.sigpipe:jbsdiff:1.0" -diffpatch = "io.codechicken:DiffPatch:2.0.1.40" +diffpatch = "io.codechicken:DiffPatch:2.1.0.42" serialize-core = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version.ref = "serialize" } serialize-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "serialize" } From 69b89933a85618bc2b12dfe9205e617510410c88 Mon Sep 17 00:00:00 2001 From: Toffikk Date: Sun, 22 Mar 2026 15:41:41 +0100 Subject: [PATCH 5/5] chore: bump diffpatch again --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 45d10c846..56e363235 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -34,7 +34,7 @@ hypo-mappings = { module = "dev.denwav.hypo:hypo-mappings", version.ref = "hypo" lorenzTiny = "net.fabricmc:lorenz-tiny:3.0.0" jbsdiff = "io.sigpipe:jbsdiff:1.0" -diffpatch = "io.codechicken:DiffPatch:2.1.0.42" +diffpatch = "io.codechicken:DiffPatch:2.1.0.43" serialize-core = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version.ref = "serialize" } serialize-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "serialize" }