From 0aa57099f14c63d72d8dcb01ca7e042ed2a2baa2 Mon Sep 17 00:00:00 2001 From: ah-OOG-ah <75745146+ah-OOG-ah@users.noreply.github.com> Date: Wed, 25 Jun 2025 17:30:14 -0400 Subject: [PATCH] Fix source shading --- .../src/main/kotlin/UniMixinsPlugin.kt | 10 +++++++--- all/build.gradle.kts | 16 +++++++++------- compat/build.gradle.kts | 4 +--- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/UniMixinsPlugin/src/main/kotlin/UniMixinsPlugin.kt b/UniMixinsPlugin/src/main/kotlin/UniMixinsPlugin.kt index 06fe325..018d0c6 100644 --- a/UniMixinsPlugin/src/main/kotlin/UniMixinsPlugin.kt +++ b/UniMixinsPlugin/src/main/kotlin/UniMixinsPlugin.kt @@ -6,6 +6,7 @@ import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.api.component.AdhocComponentWithVariants import org.gradle.api.component.ConfigurationVariantDetails +import org.gradle.api.file.DuplicatesStrategy import org.gradle.api.plugins.BasePluginExtension import org.gradle.api.plugins.JavaPluginExtension import org.gradle.api.tasks.SourceSetContainer @@ -100,8 +101,7 @@ class UniMixinsPlugin : Plugin { shadowImplementation.extendsFrom(shadowImplSources) for (config in listOf("compileClasspath", "runtimeClasspath", "testCompileClasspath", "testRuntimeClasspath")) { - cfgs.getByName(config) - .extendsFrom(shadowImplementation) + cfgs.getByName(config).extendsFrom(shadowImplementation) } // Add the sources from the dual set... @@ -112,7 +112,11 @@ class UniMixinsPlugin : Plugin { }) // ...and copy the files into the source jar - tasks.named("sourcesJar", Jar::class.java) { + val sourcesJar = tasks.named("sourcesJar", Jar::class.java) + sourcesJar.configure { + it.duplicatesStrategy = DuplicatesStrategy.EXCLUDE + + it.dependsOn(shadowSources) it.from(shadowSources.map { source -> project.zipTree(source) }) diff --git a/all/build.gradle.kts b/all/build.gradle.kts index dc9a47c..a4e6f57 100644 --- a/all/build.gradle.kts +++ b/all/build.gradle.kts @@ -5,14 +5,16 @@ plugins { } dependencies { + // TODO: make this work shadowImplementation(project(":mixin")) - shadowImplementation(project(":compat")) - shadowImplementation(project(":mixingasm")) - shadowImplementation(project(":spongemixins")) - shadowImplementation(project(":mixinbooterlegacy")) - shadowImplementation(project(":gasstation")) - shadowImplementation(project(":gtnhmixins")) - shadowImplementation(project(":mixinextras")) + // TODO: make this suck less + shadowImplementation(project(":compat")); shadowSources(project(":compat", "sourcesElements")) + shadowImplementation(project(":mixingasm")); shadowSources(project(":mixingasm", "sourcesElements")) + shadowImplementation(project(":spongemixins")); shadowSources(project(":spongemixins", "sourcesElements")) + shadowImplementation(project(":mixinbooterlegacy")); shadowSources(project(":mixinbooterlegacy", "sourcesElements")) + shadowImplementation(project(":gasstation")); shadowSources(project(":gasstation", "sourcesElements")) + shadowImplementation(project(":gtnhmixins")); shadowSources(project(":gtnhmixins", "sourcesElements")) + shadowImplementation(project(":mixinextras")); shadowSources(project(":mixinextras", "sourcesElements")) } val moduleList = diff --git a/compat/build.gradle.kts b/compat/build.gradle.kts index 4c21500..490239b 100644 --- a/compat/build.gradle.kts +++ b/compat/build.gradle.kts @@ -8,14 +8,12 @@ plugins { dependencies { compileOnly("org.spongepowered:mixin:0.8.5") - shadow(project(":common")) { + shadowImplementation(project(":common")) { isTransitive = false } } tasks.shadowJar { - configurations = listOf(project.configurations.shadow.get()) - relocate("io.github.legacymoddingmc.unimixins.common", "io.github.legacymoddingmc.unimixins.compat.repackage.common") manifest {