use compileClasspath to remap JARs

dev/0.11
asie 2019-05-18 11:51:34 +02:00
parent 3d21ce811b
commit 4be5fe010f
1 changed files with 10 additions and 5 deletions

View File

@ -44,8 +44,7 @@ import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.ArrayList; import java.util.*;
import java.util.List;
public class RemapJarTask extends AbstractLoomTask { public class RemapJarTask extends AbstractLoomTask {
private Object input; private Object input;
@ -68,9 +67,9 @@ public class RemapJarTask extends AbstractLoomTask {
String fromM = "named"; String fromM = "named";
String toM = "intermediary"; String toM = "intermediary";
List<File> classpathFiles = new ArrayList<>(); Set<File> classpathFiles = new LinkedHashSet<>();
classpathFiles.addAll(project.getConfigurations().getByName(Constants.COMPILE_MODS_MAPPED).getFiles()); //noinspection CollectionAddAllCanBeReplacedWithConstructor
classpathFiles.addAll(project.getConfigurations().getByName(Constants.MINECRAFT_NAMED).getFiles()); classpathFiles.addAll(project.getConfigurations().getByName("compileClasspath").getFiles());
Path[] classpath = classpathFiles.stream().map(File::toPath).filter((p) -> !input.equals(p)).toArray(Path[]::new); Path[] classpath = classpathFiles.stream().map(File::toPath).filter((p) -> !input.equals(p)).toArray(Path[]::new);
File mixinMapFile = mappingsProvider.MAPPINGS_MIXIN_EXPORT; File mixinMapFile = mappingsProvider.MAPPINGS_MIXIN_EXPORT;
@ -85,6 +84,12 @@ public class RemapJarTask extends AbstractLoomTask {
project.getLogger().lifecycle(":remapping " + input.getFileName()); project.getLogger().lifecycle(":remapping " + input.getFileName());
StringBuilder rc = new StringBuilder("Remap classpath: ");
for (Path p : classpath) {
rc.append("\n - ").append(p.toString());
}
project.getLogger().debug(rc.toString());
TinyRemapper remapper = remapperBuilder.build(); TinyRemapper remapper = remapperBuilder.build();
try (OutputConsumerPath outputConsumer = new OutputConsumerPath(output)) { try (OutputConsumerPath outputConsumer = new OutputConsumerPath(output)) {