use more reliable renamer, update Stitch - fix #46

dev/0.11
asie 2018-12-23 19:18:40 +01:00
parent 4700788ead
commit 0b38f3ecc5
4 changed files with 18 additions and 9 deletions

View File

@ -34,7 +34,7 @@ dependencies {
implementation ('org.zeroturnaround:zt-zip:1.13')
implementation ('com.google.code.gson:gson:2.8.5')
implementation ('com.google.guava:guava:27.0.1-jre')
implementation ('net.fabricmc:stitch:0.1.1.32')
implementation ('net.fabricmc:stitch:0.1.1.36')
implementation ('net.fabricmc:tiny-remapper:0.1.0.22') {
transitive = false
}

View File

@ -25,6 +25,7 @@
package net.fabricmc.loom.task;
import com.google.common.io.ByteStreams;
import com.google.common.io.Files;
import net.fabricmc.loom.LoomGradleExtension;
import net.fabricmc.loom.providers.MappingsProvider;
import net.fabricmc.loom.providers.MinecraftLibraryProvider;
@ -92,7 +93,7 @@ public class GenSourcesTask extends DefaultLoomTask {
project.getLogger().lifecycle(":readjusting line numbers");
File tmpJar = new File(mappedJar.getAbsolutePath() + ".tmp");
mappedJar.renameTo(tmpJar);
Files.move(mappedJar, tmpJar);
try (
FileInputStream fis = new FileInputStream(tmpJar);
JarInputStream jis = new JarInputStream(fis);

View File

@ -24,6 +24,7 @@
package net.fabricmc.loom.util;
import com.google.common.io.Files;
import net.fabricmc.loom.LoomGradleExtension;
import net.fabricmc.loom.providers.MappingsProvider;
import net.fabricmc.loom.task.RemapJar;
@ -34,6 +35,7 @@ import org.gradle.api.Project;
import org.gradle.api.artifacts.Dependency;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
@ -106,12 +108,16 @@ public class ModRemapper {
}
}
if (modJar.exists()) {
modJar.renameTo(modJarUnmappedCopy);
extension.addUnmappedMod(modJarUnmappedCopy);
}
try {
if (modJar.exists()) {
Files.move(modJar, modJarUnmappedCopy);
extension.addUnmappedMod(modJarUnmappedCopy);
}
modJarOutput.renameTo(modJar);
Files.move(modJarOutput, modJar);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}

View File

@ -91,8 +91,10 @@ public class SourceRemapper {
}
source = new File(destination.getAbsolutePath().substring(0, destination.getAbsolutePath().lastIndexOf('.')) + "-dev.jar");
if (!destination.renameTo(source)) {
throw new RuntimeException("Could not rename " + destination.getName() + "!");
try {
com.google.common.io.Files.move(destination, source);
} catch (IOException e) {
throw new RuntimeException("Could not rename " + destination.getName() + "!", e);
}
}