Fix crash on Java 18 due to unpick using an outdated asm version.

Unpick will now get the same version of asm that loom is running with on its classpath.
dev/0.11
modmuss50 2021-11-26 23:10:35 +00:00
parent 60c908ea1b
commit 4b45783a54
1 changed files with 15 additions and 0 deletions

View File

@ -48,6 +48,7 @@ import com.google.gson.JsonObject;
import org.apache.tools.ant.util.StringUtils;
import org.gradle.api.Project;
import org.jetbrains.annotations.Nullable;
import org.objectweb.asm.Opcodes;
import net.fabricmc.loom.LoomGradleExtension;
import net.fabricmc.loom.LoomGradlePlugin;
@ -304,6 +305,20 @@ public class MappingsProviderImpl extends DependencyProvider implements Mappings
getProject().getDependencies().add(Constants.Configurations.UNPICK_CLASSPATH,
String.format("%s:%s:%s", unpickMetadata.unpickGroup, unpickCliName, unpickMetadata.unpickVersion)
);
// Unpick ships with a slightly older version of asm, ensure it runs with at least the same version as loom.
String[] asmDeps = new String[] {
"org.ow2.asm:asm:%s",
"org.ow2.asm:asm-tree:%s",
"org.ow2.asm:asm-commons:%s",
"org.ow2.asm:asm-util:%s"
};
for (String asm : asmDeps) {
getProject().getDependencies().add(Constants.Configurations.UNPICK_CLASSPATH,
asm.formatted(Opcodes.class.getPackage().getImplementationVersion())
);
}
}
private void mergeAndSaveMappings(Project project, Path from, Path out) throws IOException {