diff --git a/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/extension/PaperweightCoreExtension.kt b/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/extension/PaperweightCoreExtension.kt index d386ee1e6..a725e68ef 100644 --- a/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/extension/PaperweightCoreExtension.kt +++ b/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/extension/PaperweightCoreExtension.kt @@ -79,4 +79,6 @@ abstract class PaperweightCoreExtension @Inject constructor(objects: ObjectFacto fun updatingMinecraft(action: Action) { action.execute(updatingMinecraft) } + + val validateATs: Property = objects.property().convention(false) } diff --git a/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/taskcontainers/CoreTasks.kt b/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/taskcontainers/CoreTasks.kt index 776db9975..6a30dd86d 100644 --- a/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/taskcontainers/CoreTasks.kt +++ b/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/taskcontainers/CoreTasks.kt @@ -112,6 +112,7 @@ class CoreTasks( atFile.set(mergePaperATs.flatMap { it.outputFile }) ats.jstClasspath.from(project.configurations.named(MACHE_MINECRAFT_LIBRARIES_CONFIG)) ats.jst.from(project.configurations.named(JST_CONFIG)) + validateATs.set(project.coreExt.validateATs) } val extractMacheSources by tasks.registering(ExtractMinecraftSources::class) { diff --git a/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/taskcontainers/MinecraftPatchingTasks.kt b/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/taskcontainers/MinecraftPatchingTasks.kt index 8de9acb5a..0bb22cfc0 100644 --- a/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/taskcontainers/MinecraftPatchingTasks.kt +++ b/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/taskcontainers/MinecraftPatchingTasks.kt @@ -30,6 +30,7 @@ import io.papermc.paperweight.core.tasks.patching.ApplyFilePatches import io.papermc.paperweight.core.tasks.patching.ApplyFilePatchesFuzzy import io.papermc.paperweight.core.tasks.patching.FixupFilePatches import io.papermc.paperweight.core.tasks.patching.RebuildFilePatches +import io.papermc.paperweight.core.util.coreExt import io.papermc.paperweight.tasks.* import io.papermc.paperweight.util.* import io.papermc.paperweight.util.constants.* @@ -171,6 +172,7 @@ class MinecraftPatchingTasks( atFile.set(mergeCollectedAts.flatMap { it.outputFile }) ats.jst.from(project.configurations.named(JST_CONFIG)) ats.jstClasspath.from(project.configurations.named(MACHE_MINECRAFT_LIBRARIES_CONFIG)) + validateATs.set(project.coreExt.validateATs) } applySourcePatches.configure { diff --git a/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/SetupForkMinecraftSources.kt b/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/SetupForkMinecraftSources.kt index 673a0b94d..362c32322 100644 --- a/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/SetupForkMinecraftSources.kt +++ b/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/tasks/SetupForkMinecraftSources.kt @@ -59,6 +59,9 @@ abstract class SetupForkMinecraftSources : JavaLauncherTask() { @get:Optional abstract val atFile: RegularFileProperty + @get:Input + abstract val validateATs: Property + @get:Optional @get:InputDirectory abstract val libraryImports: DirectoryProperty @@ -86,6 +89,7 @@ abstract class SetupForkMinecraftSources : JavaLauncherTask() { outputDir.path, atFile.path, atWorkingDir.path, + validate = validateATs.get(), ) commitAndTag(git, "ATs", "${identifier.get()} ATs") } 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 70110a9c3..3262c5da8 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 @@ -69,6 +69,10 @@ abstract class SetupMinecraftSources : JavaLauncherZippedTask() { @get:Input abstract val oldPaperCommit: Property + @get:Optional + @get:Input + abstract val validateATs: Property + @get:Nested val ats: ApplySourceATs = objects.newInstance() @@ -182,6 +186,7 @@ abstract class SetupMinecraftSources : JavaLauncherZippedTask() { outputPath, atFile.path, atWorkingDir.path, + validate = validateATs.get(), ) if (!oldPaperCommit.isPresent) { commitAndTag(git, "ATs", "paper ATs") 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..82cb14178 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 @@ -258,6 +258,7 @@ abstract class RebuildFilePatches : JavaLauncherTask() { at, temporaryDir.toPath().resolve("jst_work"), singleFile = true, + validate = false, ) println("NEW: " + decomp.readText()) } diff --git a/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/util/ApplySourceATs.kt b/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/util/ApplySourceATs.kt index b19114435..dc6cd8d89 100644 --- a/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/util/ApplySourceATs.kt +++ b/paperweight-core/src/main/kotlin/io/papermc/paperweight/core/util/ApplySourceATs.kt @@ -53,6 +53,7 @@ abstract class ApplySourceATs { atFile: Path, workDir: Path, singleFile: Boolean = false, + validate: Boolean, ) { workDir.deleteRecursive() workDir.createDirectories() @@ -61,7 +62,7 @@ abstract class ApplySourceATs { workDir, workDir.resolve("log.txt"), jvmArgs = listOf("-Xmx${memory.get()}"), - args = jstArgs(input, output, atFile, singleFile).toTypedArray() + args = jstArgs(input, output, atFile, singleFile, validate).toTypedArray() ) } @@ -70,8 +71,10 @@ abstract class ApplySourceATs { outputDir: Path, atFile: Path, singleFile: Boolean = false, + validate: Boolean, ): List { val format = if (singleFile) "FILE" else "FOLDER" + val validation = if (validate) "ERROR" else "LOG" return listOf( "--in-format=$format", "--out-format=$format", @@ -79,7 +82,7 @@ abstract class ApplySourceATs { "--access-transformer=$atFile", "--access-transformer-inherit-method=true", "--hidden-prefix=.git", - // "--access-transformer-validation=ERROR", + "--access-transformer-validation=$validation", *jstClasspath.files.map { "--classpath=${it.absolutePath}" }.toTypedArray(), inputDir.absolutePathString(), outputDir.absolutePathString(), diff --git a/paperweight-core/src/main/kotlin/io/papermc/paperweight/patcher/extension/PaperweightPatcherExtension.kt b/paperweight-core/src/main/kotlin/io/papermc/paperweight/patcher/extension/PaperweightPatcherExtension.kt index 18fbc9591..bf374a7bf 100644 --- a/paperweight-core/src/main/kotlin/io/papermc/paperweight/patcher/extension/PaperweightPatcherExtension.kt +++ b/paperweight-core/src/main/kotlin/io/papermc/paperweight/patcher/extension/PaperweightPatcherExtension.kt @@ -36,6 +36,7 @@ abstract class PaperweightPatcherExtension @Inject constructor(private val objec val gitFilePatches: Property = objects.property().convention(false) val filterPatches: Property = objects.property().convention(true) + val validateATs: Property = objects.property().convention(false) val upstreams: NamedDomainObjectContainer = objects.domainObjectContainer(UpstreamConfig::class) { objects.newInstance(it, true)