From 9cc1c4985425f43d0d6de1a2fda7c753cd647fb5 Mon Sep 17 00:00:00 2001 From: Bjarne Koll Date: Wed, 9 Mar 2022 18:13:48 +0100 Subject: [PATCH] Switch from in- to excludes for resource inclusion As nearly all resources found in the vanilla jar are desired to be included in paper, an include list is not ideal. Instead, this commit changes the copy resource tasks to an exclude-based filter. --- paperweight-core/src/main/kotlin/taskcontainers/AllTasks.kt | 2 +- paperweight-lib/src/main/kotlin/tasks/CopyResources.kt | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/paperweight-core/src/main/kotlin/taskcontainers/AllTasks.kt b/paperweight-core/src/main/kotlin/taskcontainers/AllTasks.kt index 0a7415cf9..3201c9b84 100644 --- a/paperweight-core/src/main/kotlin/taskcontainers/AllTasks.kt +++ b/paperweight-core/src/main/kotlin/taskcontainers/AllTasks.kt @@ -57,7 +57,7 @@ open class AllTasks( val copyResources by tasks.registering { inputJar.set(applyMergedAt.flatMap { it.outputJar }) vanillaJar.set(extractFromBundler.flatMap { it.serverJar }) - includes.set(listOf("/data/**", "/assets/**", "version.json", "yggdrasil_session_pubkey.der", "pack.mcmeta", "flightrecorder-config.jfc")) + excludes.convention(listOf("**/*.class", "/META-INF/**")) outputJar.set(cache.resolve(FINAL_REMAPPED_JAR)) } diff --git a/paperweight-lib/src/main/kotlin/tasks/CopyResources.kt b/paperweight-lib/src/main/kotlin/tasks/CopyResources.kt index 41a871b97..19b4cae59 100644 --- a/paperweight-lib/src/main/kotlin/tasks/CopyResources.kt +++ b/paperweight-lib/src/main/kotlin/tasks/CopyResources.kt @@ -42,7 +42,7 @@ abstract class CopyResources : BaseTask() { abstract val vanillaJar: RegularFileProperty @get:Input - abstract val includes: ListProperty + abstract val excludes: ListProperty @get:OutputFile abstract val outputJar: RegularFileProperty @@ -55,8 +55,8 @@ abstract class CopyResources : BaseTask() { fs.copy { from(archives.zipTree(vanillaJar)) { - for (inc in this@CopyResources.includes.get()) { - include(inc) + for (inc in this@CopyResources.excludes.get()) { + exclude(inc) } } from(archives.zipTree(inputJar))