Skip to content

Commit c397481

Browse files
committed
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. Additionally, this commit now allows consumers of paperweight-core to configure the exclude list instead of directly defining it in the task definition. The configurable exclude list is merged with all source files, defined through the vanillaJarIncludes property, and the `META-INF/MANIFEST.MF` file, which breaks decompilation of remapped jars.
1 parent 9496216 commit c397481

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

paperweight-core/src/main/kotlin/taskcontainers/AllTasks.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ open class AllTasks(
5757
val copyResources by tasks.registering<CopyResources> {
5858
inputJar.set(applyMergedAt.flatMap { it.outputJar })
5959
vanillaJar.set(extractFromBundler.flatMap { it.serverJar })
60-
includes.set(listOf("/data/**", "/assets/**", "version.json", "yggdrasil_session_pubkey.der", "pack.mcmeta", "flightrecorder-config.jfc"))
60+
excludes.convention(listOf("**/*.class", "/META-INF/**"))
6161

6262
outputJar.set(cache.resolve(FINAL_REMAPPED_JAR))
6363
}

paperweight-lib/src/main/kotlin/tasks/CopyResources.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ abstract class CopyResources : BaseTask() {
4242
abstract val vanillaJar: RegularFileProperty
4343

4444
@get:Input
45-
abstract val includes: ListProperty<String>
45+
abstract val excludes: ListProperty<String>
4646

4747
@get:OutputFile
4848
abstract val outputJar: RegularFileProperty
@@ -55,8 +55,8 @@ abstract class CopyResources : BaseTask() {
5555

5656
fs.copy {
5757
from(archives.zipTree(vanillaJar)) {
58-
for (inc in this@CopyResources.includes.get()) {
59-
include(inc)
58+
for (inc in this@CopyResources.excludes.get()) {
59+
exclude(inc)
6060
}
6161
}
6262
from(archives.zipTree(inputJar))

0 commit comments

Comments
 (0)