mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-03-28 04:07:01 -05:00
Fix crash.
More small fixes.
This commit is contained in:
@@ -258,7 +258,13 @@ public class InterfaceInjectionProcessor implements JarProcessor, GenerateSource
|
||||
* Reads the injected interfaces contained in a mod jar, or returns empty if there is none.
|
||||
*/
|
||||
public static List<InjectedInterface> fromModJar(Path modJarPath) {
|
||||
return fromFabricModJson(FabricModJsonFactory.createFromZip(modJarPath));
|
||||
FabricModJson fabricModJson = FabricModJsonFactory.createFromZipNullable(modJarPath);
|
||||
|
||||
if (fabricModJson == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return fromFabricModJson(fabricModJson);
|
||||
}
|
||||
|
||||
public static List<InjectedInterface> fromFabricModJson(FabricModJson fabricModJson) {
|
||||
|
||||
@@ -32,6 +32,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.xpath.XPath;
|
||||
|
||||
@@ -57,6 +57,10 @@ public abstract class BuildSharedServiceManager implements BuildService<BuildSer
|
||||
return provider;
|
||||
}
|
||||
|
||||
public BuildSharedServiceManager() {
|
||||
LOGGER.debug("New BuildSharedServiceManager instance");
|
||||
}
|
||||
|
||||
public SharedServiceManager get() {
|
||||
LOGGER.debug("Shared build service get");
|
||||
return Objects.requireNonNull(sharedServiceManager);
|
||||
|
||||
@@ -26,9 +26,9 @@ package net.fabricmc.loom.util.service;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
@@ -40,7 +40,7 @@ import org.slf4j.LoggerFactory;
|
||||
*/
|
||||
public abstract class SharedServiceManager {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(BuildSharedServiceManager.class);
|
||||
private final Map<String, SharedService> sharedServiceMap = new ConcurrentHashMap<>();
|
||||
private final Map<String, SharedService> sharedServiceMap = new HashMap<>();
|
||||
|
||||
private boolean shutdown = false;
|
||||
|
||||
@@ -58,6 +58,7 @@ public abstract class SharedServiceManager {
|
||||
S sharedService = (S) sharedServiceMap.get(id);
|
||||
|
||||
if (sharedService == null) {
|
||||
LOGGER.debug("Creating service for {}", id);
|
||||
sharedService = function.get();
|
||||
sharedServiceMap.put(id, sharedService);
|
||||
}
|
||||
@@ -85,14 +86,14 @@ public abstract class SharedServiceManager {
|
||||
|
||||
sharedServiceMap.clear();
|
||||
|
||||
// This is required to ensure that mercury releases all of the file handles.
|
||||
System.gc();
|
||||
|
||||
if (!exceptionList.isEmpty()) {
|
||||
// Done to try and close all the services.
|
||||
RuntimeException exception = new RuntimeException("Failed to close all shared services");
|
||||
exceptionList.forEach(exception::addSuppressed);
|
||||
throw exception;
|
||||
}
|
||||
|
||||
// This is required to ensure that mercury releases all of the file handles.
|
||||
System.gc();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ class FabricAPIBenchmark implements GradleProjectTestTrait {
|
||||
allowExistingRepo: true,
|
||||
|
||||
repo: "https://github.com/FabricMC/fabric.git",
|
||||
commit: "71b634e5b7845296b11be3fa6545f4fbfacc017f",
|
||||
commit: "5f243a8b7849eac4b30cd876a22a127797a1c406",
|
||||
patch: "fabric_api"
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user