Cleanup potentially corrupt files on mappings error
parent
e5a6551609
commit
75f08fc4c5
|
@ -55,6 +55,7 @@ import net.fabricmc.stitch.commands.tinyv2.CommandMergeTinyV2;
|
|||
import net.fabricmc.stitch.commands.tinyv2.CommandReorderTinyV2;
|
||||
import net.fabricmc.loom.processors.JarProcessorManager;
|
||||
import net.fabricmc.loom.processors.MinecraftProcessedProvider;
|
||||
import net.fabricmc.loom.util.DeletingFileVisitor;
|
||||
|
||||
public class MappingsProvider extends DependencyProvider {
|
||||
public MinecraftMappedProvider mappedProvider;
|
||||
|
@ -260,6 +261,18 @@ public class MappingsProvider extends DependencyProvider {
|
|||
mappingsMixinExport = new File(getExtension().getProjectBuildCache(), "mixin-map-" + minecraftVersion + "-" + mappingsVersion + ".tiny");
|
||||
}
|
||||
|
||||
public void cleanFiles() {
|
||||
try {
|
||||
Files.walkFileTree(mappingsStepsDir, new DeletingFileVisitor());
|
||||
Files.deleteIfExists(baseTinyMappings);
|
||||
mappingsMixinExport.delete();
|
||||
tinyMappings.delete();
|
||||
tinyMappingsJar.delete();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTargetConfig() {
|
||||
return Constants.MAPPINGS;
|
||||
|
|
|
@ -65,7 +65,15 @@ public class MinecraftMappedProvider extends DependencyProvider {
|
|||
minecraftIntermediaryJar.delete();
|
||||
}
|
||||
|
||||
try {
|
||||
new MapJarsTiny().mapJars(minecraftProvider, this, this.minecraftMappedJar, this.minecraftIntermediaryJar, getProject());
|
||||
} catch (Throwable t) {
|
||||
//Cleanup some some things that may be in a bad state now
|
||||
minecraftMappedJar.delete();
|
||||
minecraftIntermediaryJar.delete();
|
||||
getExtension().getMappingsProvider().cleanFiles();
|
||||
throw new RuntimeException("Failed to remap minecraft", t);
|
||||
}
|
||||
}
|
||||
|
||||
if (!minecraftMappedJar.exists()) {
|
||||
|
|
|
@ -41,6 +41,7 @@ public class CleanLoomMappings extends AbstractLoomTask {
|
|||
extension.getMinecraftMappedProvider().getIntermediaryJar().delete();
|
||||
extension.getMinecraftMappedProvider().getMappedJar().delete();
|
||||
Files.walkFileTree(extension.getRootProjectBuildCache().toPath(), new DeletingFileVisitor());
|
||||
getExtension().getMappingsProvider().cleanFiles();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue