mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-03-30 21:05:58 -05:00
Fix weird race condition
This commit is contained in:
@@ -270,11 +270,13 @@ public class MinecraftPatchedProvider extends MergedMinecraftProvider {
|
||||
Path tmpSrg = getToSrgMappings();
|
||||
Set<File> mcLibs = getProject().getConfigurations().getByName(Constants.Configurations.MINECRAFT_DEPENDENCIES).resolve();
|
||||
|
||||
ThreadingUtils.run(() -> {
|
||||
Files.copy(SpecialSourceExecutor.produceSrgJar(getExtension().getMcpConfigProvider().getRemapAction(), getProject(), "client", mcLibs, clientJar, tmpSrg), minecraftClientSrgJar.toPath());
|
||||
}, () -> {
|
||||
Files.copy(SpecialSourceExecutor.produceSrgJar(getExtension().getMcpConfigProvider().getRemapAction(), getProject(), "server", mcLibs, serverJar, tmpSrg), minecraftServerSrgJar.toPath());
|
||||
});
|
||||
// These can't be threaded because accessing getRemapAction().getMainClass() can cause a situation where
|
||||
// 1. thread A has an FS open
|
||||
// 2. thread B tries to open a new one, but fails
|
||||
// 3. thread A closes its FS
|
||||
// 4. thread B tries to get the already open one => crash
|
||||
Files.copy(SpecialSourceExecutor.produceSrgJar(getExtension().getMcpConfigProvider().getRemapAction(), getProject(), "client", mcLibs, clientJar, tmpSrg), minecraftClientSrgJar.toPath());
|
||||
Files.copy(SpecialSourceExecutor.produceSrgJar(getExtension().getMcpConfigProvider().getRemapAction(), getProject(), "server", mcLibs, serverJar, tmpSrg), minecraftServerSrgJar.toPath());
|
||||
}
|
||||
|
||||
private Path getToSrgMappings() throws IOException {
|
||||
|
||||
@@ -57,7 +57,7 @@ public class SpecialSourceExecutor {
|
||||
}
|
||||
|
||||
public static Path produceSrgJar(RemapAction remapAction, Project project, String side, Set<File> mcLibs, Path officialJar, Path mappings)
|
||||
throws Exception {
|
||||
throws IOException {
|
||||
Set<String> filter = Files.readAllLines(mappings, StandardCharsets.UTF_8).stream()
|
||||
.filter(s -> !s.startsWith("\t"))
|
||||
.map(s -> s.split(" ")[0] + ".class")
|
||||
|
||||
Reference in New Issue
Block a user