Merge remote-tracking branch 'FabricMC/dev/1.6' into dev/1.6

This commit is contained in:
shedaniel
2024-04-28 20:22:49 +09:00
13 changed files with 301 additions and 51 deletions

View File

@@ -25,6 +25,7 @@
package net.fabricmc.loom.task;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
@@ -204,6 +205,9 @@ public abstract class GenerateSourcesTask extends AbstractLoomTask {
if (!getUseCache().get()) {
try (var timer = new Timer("Decompiled sources")) {
runWithoutCache();
} catch (Exception e) {
ExceptionUtil.printFileLocks(e, getProject());
throw ExceptionUtil.createDescriptiveWrapper(RuntimeException::new, "Failed to decompile", e);
}
return;
@@ -221,6 +225,9 @@ public abstract class GenerateSourcesTask extends AbstractLoomTask {
try (FileSystemUtil.Delegate fs = FileSystemUtil.getJarFileSystem(cacheFile, true)) {
runWithCache(fs.getRoot());
}
} catch (Exception e) {
ExceptionUtil.printFileLocks(e, getProject());
throw ExceptionUtil.createDescriptiveWrapper(RuntimeException::new, "Failed to decompile", e);
}
}
@@ -492,7 +499,6 @@ public abstract class GenerateSourcesTask extends AbstractLoomTask {
final var provideContext = new AbstractMappedMinecraftProvider.ProvideContext(false, true, configContext);
minecraftJars = getExtension().getNamedMinecraftProvider().provide(provideContext);
} catch (Exception e) {
ExceptionUtil.printFileLocks(e, getProject());
throw ExceptionUtil.createDescriptiveWrapper(RuntimeException::new, "Failed to rebuild input jars", e);
}
@@ -567,6 +573,14 @@ public abstract class GenerateSourcesTask extends AbstractLoomTask {
Objects.requireNonNull(lineNumbers, "lineNumbers");
final var remapper = new LineNumberRemapper(lineNumbers);
remapper.process(inputJar, outputJar);
final Path lineMap = inputJar.resolveSibling(inputJar.getFileName() + ".linemap.txt");
try (BufferedWriter writer = Files.newBufferedWriter(lineMap)) {
lineNumbers.write(writer);
}
LOGGER.info("Wrote linemap to {}", lineMap);
}
private void doWork(@Nullable IPCServer ipcServer, Path inputJar, Path outputJar, Path linemapFile, @Nullable Path existingJar) {