From 7030213db37089d8ac77b600d8f8eea289335a75 Mon Sep 17 00:00:00 2001
From: Phillip Glanz
Date: Sun, 2 Apr 2023 21:36:16 +0200
Subject: [PATCH] Fix shading of folia adapters
---
worldedit-bukkit/build.gradle.kts | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/worldedit-bukkit/build.gradle.kts b/worldedit-bukkit/build.gradle.kts
index f92621967..9cfc36570 100644
--- a/worldedit-bukkit/build.gradle.kts
+++ b/worldedit-bukkit/build.gradle.kts
@@ -60,7 +60,15 @@ val adapters = configurations.create("adapters") {
)
}
}
-
+val foliaAdapters = configurations.create("foliaAdapters") {
+ description = "Adapters to include in the JAR"
+ isCanBeConsumed = false
+ isCanBeResolved = true
+ shouldResolveConsistentlyWith(configurations["runtimeClasspath"])
+ attributes {
+ attribute(Obfuscation.OBFUSCATION_ATTRIBUTE, objects.named(Obfuscation.OBFUSCATED))
+ }
+}
dependencies {
// Modules
api(projects.worldeditCore)
@@ -70,7 +78,7 @@ dependencies {
"adapters"(project(it.path))
}
project.project(":worldedit-bukkit:folia-adapters").subprojects.forEach {
- "adapters"(project(it.path))
+ "foliaAdapters"(project(it.path))
}
// Minecraft expectations
@@ -154,6 +162,14 @@ tasks.named("shadowJar") {
}
}
})
+ from(Callable {
+ foliaAdapters.resolve()
+ .map { f ->
+ zipTree(f).matching {
+ exclude("META-INF/")
+ }
+ }
+ })
archiveFileName.set("${rootProject.name}-Bukkit-${project.version}.${archiveExtension.getOrElse("jar")}")
dependencies {
// In tandem with not bundling log4j, we shouldn't relocate base package here.