Remove Minecraft libraries from the remap classpath. (#987)

This commit is contained in:
modmuss
2023-11-20 19:15:30 +00:00
committed by GitHub
parent 99380d98e5
commit 92da5adb48
4 changed files with 6 additions and 9 deletions

View File

@@ -42,7 +42,6 @@ public final class ContextImplHelper {
return new LazyCloseable<>(() -> {
try {
TinyRemapper tinyRemapper = TinyRemapperHelper.getTinyRemapper(configContext.project(), configContext.serviceManager(), from.toString(), to.toString());
tinyRemapper.readClassPath(TinyRemapperHelper.getMinecraftCompileLibraries(configContext.project()));
for (Path minecraftJar : configContext.extension().getMinecraftJars(MappingsNamespace.INTERMEDIARY)) {
tinyRemapper.readClassPath(minecraftJar);

View File

@@ -196,7 +196,6 @@ public abstract class AbstractMappedMinecraftProvider<M extends MinecraftProvide
try (OutputConsumerPath outputConsumer = new OutputConsumerPath.Builder(remappedJars.outputJarPath()).build()) {
outputConsumer.addNonClassFiles(remappedJars.inputJar());
remapper.readClassPath(TinyRemapperHelper.getMinecraftCompileLibraries(getProject()));
for (Path path : remappedJars.remapClasspath()) {
remapper.readClassPath(path);

View File

@@ -97,7 +97,12 @@ public abstract class RemapJarTask extends AbstractRemapJarTask {
super();
serviceManagerProvider = BuildSharedServiceManager.createForTask(this, getBuildEventsListenerRegistry());
getClasspath().from(getProject().getConfigurations().getByName(JavaPlugin.COMPILE_CLASSPATH_CONFIGURATION_NAME));
final Configuration compileClasspath = getProject().getConfigurations().getByName(JavaPlugin.COMPILE_CLASSPATH_CONFIGURATION_NAME);
final Configuration minecraftCompileLibraries = getProject().getConfigurations().getByName(Constants.Configurations.MINECRAFT_COMPILE_LIBRARIES);
// Filter out minecraft libraries from the classpath as we are 100% sure they don't play a part in the obfuscation
final FileCollection remapClasspath = compileClasspath.filter(file -> !minecraftCompileLibraries.getFiles().contains(file));
getClasspath().from(remapClasspath);
getAddNestedDependencies().convention(true).finalizeValueOnRead();
Configuration includeConfiguration = getProject().getConfigurations().getByName(Constants.Configurations.INCLUDE);

View File

@@ -24,7 +24,6 @@
package net.fabricmc.loom.util;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.util.Map;
@@ -95,11 +94,6 @@ public final class TinyRemapperHelper {
return builder.build();
}
public static Path[] getMinecraftCompileLibraries(Project project) {
return project.getConfigurations().getByName(Constants.Configurations.MINECRAFT_COMPILE_LIBRARIES).getFiles()
.stream().map(File::toPath).toArray(Path[]::new);
}
private static IMappingProvider.Member memberOf(String className, String memberName, String descriptor) {
return new IMappingProvider.Member(className, memberName, descriptor);
}