mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-04-02 05:27:43 -05:00
Performance optimisation when including nested jars
This commit is contained in:
@@ -59,13 +59,15 @@ public class NestedJars {
|
||||
private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create();
|
||||
|
||||
public static boolean addNestedJars(Project project, Path modJarPath) {
|
||||
if (getContainedJars(project).isEmpty()) {
|
||||
List<File> containedJars = getContainedJars(project);
|
||||
|
||||
if (containedJars.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
File modJar = modJarPath.toFile();
|
||||
|
||||
ZipUtil.addOrReplaceEntries(modJar, getContainedJars(project).stream().map(file -> new FileSource("META-INF/jars/" + file.getName(), file)).toArray(ZipEntrySource[]::new));
|
||||
ZipUtil.addOrReplaceEntries(modJar, containedJars.stream().map(file -> new FileSource("META-INF/jars/" + file.getName(), file)).toArray(ZipEntrySource[]::new));
|
||||
|
||||
return ZipUtil.transformEntries(modJar, single(new ZipEntryTransformerEntry("fabric.mod.json", new StringZipEntryTransformer() {
|
||||
@Override
|
||||
@@ -77,7 +79,7 @@ public class NestedJars {
|
||||
nestedJars = new JsonArray();
|
||||
}
|
||||
|
||||
for (File file : getContainedJars(project)) {
|
||||
for (File file : containedJars) {
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
jsonObject.addProperty("file", "META-INF/jars/" + file.getName());
|
||||
nestedJars.add(jsonObject);
|
||||
|
||||
Reference in New Issue
Block a user