1- import buildlogic.ArtifactPriority
21import buildlogic.internalVersion
32import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
43import io.papermc.paperweight.userdev.attribute.Obfuscation
@@ -26,18 +25,25 @@ configurations.named("testImplementation") {
2625val adaptersScope = configurations.dependencyScope(" adaptersScope" ) {
2726 description = " Adapters to include in the JAR"
2827}
28+ val adaptersReobfScope = configurations.dependencyScope(" adaptersReobfScope" ) {
29+ description = " Reobfuscated adapters to include in the JAR"
30+ }
31+
2932val adapters = configurations.resolvable(" adapters" ) {
3033 extendsFrom(adaptersScope.get())
3134 description = " Adapters to include in the JAR (resolvable)"
3235 shouldResolveConsistentlyWith(configurations[" runtimeClasspath" ])
3336 attributes {
34- if ((project.findProperty(" enginehub.obf.none" ) as String? ).toBoolean()) {
35- // If we're configured to not output obfuscated, request none
36- attribute(Obfuscation .OBFUSCATION_ATTRIBUTE , objects.named(Obfuscation .NONE ))
37- } else {
38- // Otherwise, use the primary artifact, which may or may not be obfuscated
39- attribute(ArtifactPriority .ATTRIBUTE , objects.named(ArtifactPriority .PRIMARY ))
40- }
37+ attribute(Obfuscation .OBFUSCATION_ATTRIBUTE , objects.named(Obfuscation .NONE ))
38+ }
39+ }
40+
41+ val adaptersReobf = configurations.resolvable(" adaptersReobf" ) {
42+ extendsFrom(adaptersReobfScope.get())
43+ description = " Reobfuscated adapters to include in the JAR (resolvable)"
44+ shouldResolveConsistentlyWith(configurations[" runtimeClasspath" ])
45+ attributes {
46+ attribute(Obfuscation .OBFUSCATION_ATTRIBUTE , objects.named(Obfuscation .OBFUSCATED ))
4147 }
4248}
4349
@@ -67,6 +73,9 @@ dependencies {
6773 project.project(" :worldedit-bukkit:adapters" ).subprojects.forEach {
6874 " adaptersScope" (project(it.path))
6975 }
76+ listOf (" 1.21.3" , " 1.21.4" , " 1.21.5" , " 1.21.6" , " 1.21.9" , " 1.21.11" ).forEach {
77+ " adaptersReobfScope" (project(" :worldedit-bukkit:adapters:adapter-$it " ))
78+ }
7079}
7180
7281tasks.named<Copy >(" processResources" ) {
@@ -78,7 +87,15 @@ tasks.named<Copy>("processResources") {
7887 }
7988}
8089
90+ tasks.register<ShadowJar >(" shadeReobfAdapters" ) {
91+ archiveClassifier.set(" reobf-adapters" )
92+ configurations.add(adaptersReobf.get())
93+
94+ relocate(" com.sk89q.worldedit.bukkit.adapter.impl" , " com.sk89q.worldedit.bukkit.adapter.impl.reobf" )
95+ }
96+
8197tasks.named<ShadowJar >(" shadowJar" ) {
98+ from(tasks.named(" shadeReobfAdapters" ))
8299 configurations.add(adapters.get())
83100 dependencies {
84101 // In tandem with not bundling log4j, we shouldn't relocate base package here.
@@ -108,6 +125,9 @@ tasks.named<ShadowJar>("shadowJar") {
108125 exclude(dependency(" ${it.group} :${it.name} " ))
109126 }
110127 }
128+ manifest {
129+ attributes[" paperweight-mappings-namespace" ] = " mojang"
130+ }
111131}
112132
113133tasks.named(" assemble" ).configure {
0 commit comments