From 8a3b79a9e543d44657500e47bb58fb35728e86d4 Mon Sep 17 00:00:00 2001 From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Date: Sat, 30 Nov 2024 12:29:03 -0700 Subject: [PATCH] use asm fix from adventure-platform-mod --- build.gradle | 2 +- .../src/main/java/RemoveAsmConstraint.java | 24 +++++++++++++++++++ .../src/main/java/RemoveAsmDependency.java | 14 ----------- 3 files changed, 25 insertions(+), 15 deletions(-) create mode 100644 buildSrc/src/main/java/RemoveAsmConstraint.java delete mode 100644 buildSrc/src/main/java/RemoveAsmDependency.java diff --git a/build.gradle b/build.gradle index e8878d32..57e07cf7 100644 --- a/build.gradle +++ b/build.gradle @@ -34,7 +34,7 @@ dependencies { compileOnly "net.fabricmc:sponge-mixin:0.15.4+mixin.0.8.7" compileOnly "io.github.llamalad7:mixinextras-common:0.4.1" // work around minecraft (MDG) forcing ASM 9.3 which is incompatible with the above deps... - components.withModule("net.neoforged:minecraft-dependencies", RemoveAsmDependency.class) + components.withModule("net.neoforged:minecraft-dependencies", RemoveAsmConstraint.class) api("ca.spottedleaf:concurrentutil:${rootProject.concurrentutil_version}") api("ca.spottedleaf:yamlconfig:${rootProject.yamlconfig_version}") diff --git a/buildSrc/src/main/java/RemoveAsmConstraint.java b/buildSrc/src/main/java/RemoveAsmConstraint.java new file mode 100644 index 00000000..67437858 --- /dev/null +++ b/buildSrc/src/main/java/RemoveAsmConstraint.java @@ -0,0 +1,24 @@ +import java.util.Objects; +import org.gradle.api.artifacts.CacheableRule; +import org.gradle.api.artifacts.ComponentMetadataContext; +import org.gradle.api.artifacts.ComponentMetadataRule; + +@CacheableRule +public abstract class RemoveAsmConstraint implements ComponentMetadataRule { + @Override + public void execute(final ComponentMetadataContext ctx) { + ctx.getDetails().allVariants(variants -> { + variants.withDependencies(deps -> { + deps.forEach(dep -> { + if (Objects.equals(dep.getGroup(), "org.ow2.asm")) { + if (dep.getVersionConstraint().getStrictVersion() != null) { + dep.version(v -> { + v.require(v.getStrictVersion()); + }); + } + } + }); + }); + }); + } +} diff --git a/buildSrc/src/main/java/RemoveAsmDependency.java b/buildSrc/src/main/java/RemoveAsmDependency.java deleted file mode 100644 index 34a2346a..00000000 --- a/buildSrc/src/main/java/RemoveAsmDependency.java +++ /dev/null @@ -1,14 +0,0 @@ -import java.util.Objects; -import org.gradle.api.artifacts.ComponentMetadataContext; -import org.gradle.api.artifacts.ComponentMetadataRule; - -public abstract class RemoveAsmDependency implements ComponentMetadataRule { - @Override - public void execute(final ComponentMetadataContext ctx) { - ctx.getDetails().allVariants(variant -> { - variant.withDependencies(deps -> { - deps.removeIf(dep -> Objects.equals(dep.getGroup(), "org.ow2.asm")); - }); - }); - } -}