mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-04-02 05:27:43 -05:00
Revert "Fix some streams not being closed, clean up the mod reobfuscater, fix runClient task"
This reverts commit 30a71c1
This commit is contained in:
@@ -43,13 +43,25 @@ public class ModRemapper {
|
||||
LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class);
|
||||
// TODO: What's the proper way of doing this?
|
||||
File libsDir = new File(project.getBuildDir(), "libs");
|
||||
File deobfJar = new File(libsDir, project.getName() + "-" + project.getVersion() + "-deobf.jar");
|
||||
File modJar = new File(libsDir, project.getName() + "-" + project.getVersion() + ".jar");
|
||||
|
||||
if (!modJar.exists()) {
|
||||
project.getLogger().error("Could not find mod .JAR at" + deobfJar.getAbsolutePath());
|
||||
project.getLogger().error("This is can be fixed by adding a 'settings.gradle' file specifying 'rootProject.name'");
|
||||
return;
|
||||
}
|
||||
|
||||
if (deobfJar.exists()) {
|
||||
deobfJar.delete();
|
||||
}
|
||||
|
||||
FileUtils.touch(modJar); //Done to ensure that the file can be moved
|
||||
//Move the pre existing mod jar to the deobf jar
|
||||
if(!modJar.renameTo(deobfJar)){
|
||||
throw new RuntimeException("Failed to rename " + modJar);
|
||||
}
|
||||
|
||||
Path mappings = Constants.MAPPINGS_TINY.get(extension).toPath();
|
||||
|
||||
String fromM = "named";
|
||||
@@ -74,10 +86,10 @@ public class ModRemapper {
|
||||
|
||||
try {
|
||||
OutputConsumerPath outputConsumer = new OutputConsumerPath(modJar.toPath());
|
||||
outputConsumer.addNonClassFiles(modJar.toPath());
|
||||
remapper.read(modJar.toPath());
|
||||
outputConsumer.addNonClassFiles(deobfJar.toPath());
|
||||
remapper.read(deobfJar.toPath());
|
||||
remapper.read(classpath);
|
||||
remapper.apply(modJar.toPath(), outputConsumer);
|
||||
remapper.apply(deobfJar.toPath(), outputConsumer);
|
||||
outputConsumer.finish();
|
||||
remapper.finish();
|
||||
} catch (Exception e){
|
||||
@@ -85,9 +97,11 @@ public class ModRemapper {
|
||||
throw new RuntimeException("Failed to remap JAR", e);
|
||||
}
|
||||
|
||||
if(!modJar.exists()){
|
||||
if(!deobfJar.exists() || !modJar.exists()){
|
||||
throw new RuntimeException("Failed to reobfuscate JAR");
|
||||
}
|
||||
|
||||
deobfJar.delete();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user