From e67e6c3ec5e77ee21765855f6fabb5d6b3e69437 Mon Sep 17 00:00:00 2001 From: glitch Date: Sun, 31 Mar 2024 17:23:51 -0500 Subject: [PATCH] Initial Loom 1.6 Support Normally I wait until modmuss puts out on the fabric announcements that the new version is stable, but several people have asked me to put this one out early. --- fabric-loom | 2 +- patches/0001-Initial-Quiltification.patch | 30 +++---- patches/0003-Support-QMJ.patch | 85 ++++++++++--------- ...tants-dependency-being-added-even-if.patch | 2 +- 4 files changed, 63 insertions(+), 56 deletions(-) diff --git a/fabric-loom b/fabric-loom index 3085bcf..4b5f62e 160000 --- a/fabric-loom +++ b/fabric-loom @@ -1 +1 @@ -Subproject commit 3085bcfb568f8aee42fbb06e61c5c572b01f5cb3 +Subproject commit 4b5f62e6b174fecf54b21f04bb633e9df0498a77 diff --git a/patches/0001-Initial-Quiltification.patch b/patches/0001-Initial-Quiltification.patch index 8c51cfe..d52b6b3 100644 --- a/patches/0001-Initial-Quiltification.patch +++ b/patches/0001-Initial-Quiltification.patch @@ -13,7 +13,7 @@ This includes: - Adding Vineflower and using it by default diff --git a/build.gradle b/build.gradle -index de84c29fa40819a31c2e55389d201f86456eda67..eaabc2b3ce2ef925e7deb635dc18894b73dbcc4d 100644 +index 8c426029a312fc3da0b7c9093263f0fc24ceb0e6..c6156d8d70a96fa0c5a1ea23ceb9d908974fd43d 100644 --- a/build.gradle +++ b/build.gradle @@ -49,7 +49,7 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { @@ -22,10 +22,10 @@ index de84c29fa40819a31c2e55389d201f86456eda67..eaabc2b3ce2ef925e7deb635dc18894b -group = 'net.fabricmc' +group = 'org.quiltmc' - def baseVersion = '1.5' + def baseVersion = '1.6' def ENV = System.getenv() -@@ -252,10 +252,16 @@ codenarc { +@@ -260,10 +260,16 @@ codenarc { gradlePlugin { plugins { @@ -44,7 +44,7 @@ index de84c29fa40819a31c2e55389d201f86456eda67..eaabc2b3ce2ef925e7deb635dc18894b } } -@@ -312,8 +318,8 @@ publishing { +@@ -320,8 +326,8 @@ publishing { // Manually crate the plugin marker for snapshot versions snapshotPlugin(MavenPublication) { publication -> @@ -55,7 +55,7 @@ index de84c29fa40819a31c2e55389d201f86456eda67..eaabc2b3ce2ef925e7deb635dc18894b version baseVersion + '-SNAPSHOT' pom.withXml({ -@@ -323,9 +329,9 @@ publishing { +@@ -331,9 +337,9 @@ publishing { Node dependencies = root.appendChild(document.createElement('dependencies')) Node dependency = dependencies.appendChild(document.createElement('dependency')) Node groupId = dependency.appendChild(document.createElement('groupId')) @@ -67,7 +67,7 @@ index de84c29fa40819a31c2e55389d201f86456eda67..eaabc2b3ce2ef925e7deb635dc18894b Node version = dependency.appendChild(document.createElement('version')) version.setTextContent(baseVersion + '-SNAPSHOT') }) -@@ -333,6 +339,7 @@ publishing { +@@ -341,6 +347,7 @@ publishing { } repositories { maven { @@ -75,7 +75,7 @@ index de84c29fa40819a31c2e55389d201f86456eda67..eaabc2b3ce2ef925e7deb635dc18894b if (ENV.MAVEN_URL) { url ENV.MAVEN_URL credentials { -@@ -341,6 +348,26 @@ publishing { +@@ -349,6 +356,26 @@ publishing { } } } @@ -130,7 +130,7 @@ index 71248d2d72437815aecbee42d01ee4ec62589a65..76a88fc552f9324bb9d56c57a68fd504 // Apply default plugins diff --git a/src/main/java/net/fabricmc/loom/LoomRepositoryPlugin.java b/src/main/java/net/fabricmc/loom/LoomRepositoryPlugin.java -index 29b4a526050a69cb5ccaa2d067fa5ecaa0347bf0..dc4895d24e908cf5d041ae71ef17dac40e6c86bf 100644 +index ef9bd58ef74cc149e7010220c966bb6df2ed475c..4e57a69eacd71f9b6df5dd6566fb14d3066e9760 100644 --- a/src/main/java/net/fabricmc/loom/LoomRepositoryPlugin.java +++ b/src/main/java/net/fabricmc/loom/LoomRepositoryPlugin.java @@ -67,7 +67,10 @@ public class LoomRepositoryPlugin implements Plugin { @@ -159,7 +159,7 @@ index b41b39bf86c6bfcd8c600eb70d160d801e66f510..d9599c24f9b47d678277f0300b6b6f54 } } diff --git a/src/main/java/net/fabricmc/loom/configuration/decompile/SingleJarDecompileConfiguration.java b/src/main/java/net/fabricmc/loom/configuration/decompile/SingleJarDecompileConfiguration.java -index 6965a0bf521d30bf581819f5ceb07a025238abe1..8d2f1807003ada50dce5cbca57005e14bbb343fe 100644 +index e7ffd658d47ac81d677a4eaafc6ce93e467c3bbf..7de9900bab37124728539853c73976d5fa24ec92 100644 --- a/src/main/java/net/fabricmc/loom/configuration/decompile/SingleJarDecompileConfiguration.java +++ b/src/main/java/net/fabricmc/loom/configuration/decompile/SingleJarDecompileConfiguration.java @@ -75,7 +75,7 @@ public class SingleJarDecompileConfiguration extends DecompileConfiguration classifierToFile = new HashMap<>(); -@@ -97,31 +93,28 @@ public class FileDependencyInfo extends DependencyInfo { +@@ -102,31 +98,28 @@ public class FileDependencyInfo extends DependencyInfo { } else { group = "net.fabricmc.synthetic"; File root = classifierToFile.get(""); //We've built the classifierToFile map, now to try find a name and version for our dependency @@ -470,10 +471,10 @@ index 4731422ca79b2b0032090034d71305749a579675..b23f0e55b906b06d6df4561e4006565c for (Map.Entry entry : modJson.getClassTweakers().entrySet()) { diff --git a/src/main/java/net/fabricmc/loom/configuration/ifaceinject/InterfaceInjectionProcessor.java b/src/main/java/net/fabricmc/loom/configuration/ifaceinject/InterfaceInjectionProcessor.java -index 98a4a79811dd43e5818bf618d47a67bfec9f3080..5c48e46f39d4868a4cef34f8bf17e0c1841301fe 100644 +index 1ced9ba3a019f2cfab727bbe720edfe40f875d7b..46a798725545a96534bad43edc56f090a9db7c56 100644 --- a/src/main/java/net/fabricmc/loom/configuration/ifaceinject/InterfaceInjectionProcessor.java +++ b/src/main/java/net/fabricmc/loom/configuration/ifaceinject/InterfaceInjectionProcessor.java -@@ -50,13 +50,13 @@ import org.slf4j.Logger; +@@ -53,6 +53,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import net.fabricmc.loom.api.mappings.layered.MappingsNamespace; @@ -481,17 +482,18 @@ index 98a4a79811dd43e5818bf618d47a67bfec9f3080..5c48e46f39d4868a4cef34f8bf17e0c1 import net.fabricmc.loom.api.processor.MinecraftJarProcessor; import net.fabricmc.loom.api.processor.ProcessorContext; import net.fabricmc.loom.api.processor.SpecContext; - import net.fabricmc.loom.util.Constants; +@@ -60,7 +61,6 @@ import net.fabricmc.loom.util.Constants; + import net.fabricmc.loom.util.LazyCloseable; import net.fabricmc.loom.util.Pair; import net.fabricmc.loom.util.ZipUtils; -import net.fabricmc.loom.util.fmj.FabricModJson; import net.fabricmc.mappingio.tree.MappingTree; import net.fabricmc.mappingio.tree.MemoryMappingTree; - -@@ -197,9 +197,9 @@ public abstract class InterfaceInjectionProcessor implements MinecraftJarProcess + import net.fabricmc.tinyremapper.TinyRemapper; +@@ -217,9 +217,9 @@ public abstract class InterfaceInjectionProcessor implements MinecraftJarProcess } - private record InjectedInterface(String modId, String className, String ifaceName) { + private record InjectedInterface(String modId, String className, String ifaceName, @Nullable String generics) { - public static List fromMod(FabricModJson fabricModJson) { - final String modId = fabricModJson.getId(); - final JsonElement jsonElement = fabricModJson.getCustom(Constants.CustomModJsonKeys.INJECTED_INTERFACE); @@ -501,7 +503,7 @@ index 98a4a79811dd43e5818bf618d47a67bfec9f3080..5c48e46f39d4868a4cef34f8bf17e0c1 if (jsonElement == null) { return Collections.emptyList(); -@@ -220,8 +220,8 @@ public abstract class InterfaceInjectionProcessor implements MinecraftJarProcess +@@ -255,8 +255,8 @@ public abstract class InterfaceInjectionProcessor implements MinecraftJarProcess return result; } @@ -959,7 +961,7 @@ index 0000000000000000000000000000000000000000..8f4b450f1e715f7636fcce176cda61fb +package net.fabricmc.loom.extension;public class ModVersionParser { +} diff --git a/src/main/java/net/fabricmc/loom/task/RemapJarTask.java b/src/main/java/net/fabricmc/loom/task/RemapJarTask.java -index 0948b353e3907f4b4113a5fe8005786aa197805b..2c2a35c41e01da6c4a5d9bd4e13a8d2aeaf944ed 100644 +index 54dd46bba803235aaa2a2fe7b71d449ed169f8df..40435dc9722c030c91d8cf70b5e1f0ad1601ab63 100644 --- a/src/main/java/net/fabricmc/loom/task/RemapJarTask.java +++ b/src/main/java/net/fabricmc/loom/task/RemapJarTask.java @@ -62,6 +62,7 @@ import net.fabricmc.accesswidener.AccessWidenerReader; @@ -977,10 +979,10 @@ index 0948b353e3907f4b4113a5fe8005786aa197805b..2c2a35c41e01da6c4a5d9bd4e13a8d2a -import net.fabricmc.loom.util.fmj.FabricModJson; -import net.fabricmc.loom.util.fmj.FabricModJsonFactory; +import net.fabricmc.loom.util.metadata.ModJsonFactory; + import net.fabricmc.loom.util.fmj.FabricModJsonUtils; import net.fabricmc.loom.util.service.BuildSharedServiceManager; import net.fabricmc.loom.util.service.UnsafeWorkQueueHelper; - import net.fabricmc.tinyremapper.OutputConsumerPath; -@@ -163,13 +163,14 @@ public abstract class RemapJarTask extends AbstractRemapJarTask { +@@ -175,13 +175,14 @@ public abstract class RemapJarTask extends AbstractRemapJarTask { final LoomGradleExtension extension = LoomGradleExtension.get(getProject()); final MixinExtension mixinExtension = extension.getMixin(); @@ -998,7 +1000,7 @@ index 0948b353e3907f4b4113a5fe8005786aa197805b..2c2a35c41e01da6c4a5d9bd4e13a8d2a for (SourceSet sourceSet : mixinExtension.getMixinSourceSets()) { MixinExtension.MixinInformationContainer container = Objects.requireNonNull( -@@ -291,16 +292,18 @@ public abstract class RemapJarTask extends AbstractRemapJarTask { +@@ -308,16 +309,18 @@ public abstract class RemapJarTask extends AbstractRemapJarTask { return; } @@ -1143,7 +1145,7 @@ index 617019cb93a5722de3be614322f4143bb98f1efd..fbb6ce1a89ab0b54cc6c120515b3a698 + } } diff --git a/src/main/java/net/fabricmc/loom/util/fmj/FabricModJsonFactory.java b/src/main/java/net/fabricmc/loom/util/fmj/FabricModJsonFactory.java -index bbd229164587a7a291b480cd75226e4e23bdda6f..c2d039dbb1312f05f60fd0a9c2f8215d11a8e8a0 100644 +index b672aa6d406bdb71ea20a4155926578e389a83b5..08008316ac675a76cf3e692359b9639317da6b84 100644 --- a/src/main/java/net/fabricmc/loom/util/fmj/FabricModJsonFactory.java +++ b/src/main/java/net/fabricmc/loom/util/fmj/FabricModJsonFactory.java @@ -24,7 +24,7 @@ @@ -1155,8 +1157,8 @@ index bbd229164587a7a291b480cd75226e4e23bdda6f..c2d039dbb1312f05f60fd0a9c2f8215d import java.io.File; import java.io.IOException; -@@ -41,9 +41,9 @@ import org.jetbrains.annotations.Nullable; - import org.jetbrains.annotations.VisibleForTesting; +@@ -44,9 +44,9 @@ import org.slf4j.Logger; + import org.slf4j.LoggerFactory; import net.fabricmc.loom.LoomGradlePlugin; -import net.fabricmc.loom.util.FileSystemUtil; @@ -1165,8 +1167,8 @@ index bbd229164587a7a291b480cd75226e4e23bdda6f..c2d039dbb1312f05f60fd0a9c2f8215d +import net.fabricmc.loom.util.metadata.ModJsonSource; public final class FabricModJsonFactory { - private static final String FABRIC_MOD_JSON = "fabric.mod.json"; -@@ -52,7 +52,7 @@ public final class FabricModJsonFactory { + public static final String FABRIC_MOD_JSON = "fabric.mod.json"; +@@ -57,7 +57,7 @@ public final class FabricModJsonFactory { } @VisibleForTesting @@ -1175,7 +1177,7 @@ index bbd229164587a7a291b480cd75226e4e23bdda6f..c2d039dbb1312f05f60fd0a9c2f8215d int schemaVersion = 0; if (jsonObject.has("schemaVersion")) { -@@ -64,13 +64,13 @@ public final class FabricModJsonFactory { +@@ -69,13 +69,13 @@ public final class FabricModJsonFactory { case 0 -> new FabricModJsonV0(jsonObject, source); case 1 -> new FabricModJsonV1(jsonObject, source); case 2 -> new FabricModJsonV2(jsonObject, source); @@ -1191,7 +1193,7 @@ index bbd229164587a7a291b480cd75226e4e23bdda6f..c2d039dbb1312f05f60fd0a9c2f8215d } catch (IOException e) { throw new UncheckedIOException("Failed to read fabric.mod.json file in zip: " + zipPath, e); } -@@ -90,7 +90,7 @@ public final class FabricModJsonFactory { +@@ -95,7 +95,7 @@ public final class FabricModJsonFactory { return null; } @@ -1200,7 +1202,7 @@ index bbd229164587a7a291b480cd75226e4e23bdda6f..c2d039dbb1312f05f60fd0a9c2f8215d } public static Optional createFromZipOptional(Path zipPath) { -@@ -101,7 +101,7 @@ public final class FabricModJsonFactory { +@@ -106,7 +106,7 @@ public final class FabricModJsonFactory { final Path path = directory.resolve(FABRIC_MOD_JSON); try (Reader reader = Files.newBufferedReader(path, StandardCharsets.UTF_8)) { @@ -1209,12 +1211,17 @@ index bbd229164587a7a291b480cd75226e4e23bdda6f..c2d039dbb1312f05f60fd0a9c2f8215d } } -@@ -114,19 +114,7 @@ public final class FabricModJsonFactory { +@@ -119,7 +119,7 @@ public final class FabricModJsonFactory { } try (Reader reader = Files.newBufferedReader(file.toPath(), StandardCharsets.UTF_8)) { - return create(LoomGradlePlugin.GSON.fromJson(reader, JsonObject.class), new FabricModJsonSource.SourceSetSource(sourceSets)); + return create(LoomGradlePlugin.GSON.fromJson(reader, JsonObject.class), new ModJsonSource.SourceSetSource(sourceSets)); + } catch (JsonSyntaxException e) { + LOGGER.warn("Failed to parse fabric.mod.json: {}", file.getAbsolutePath()); + return null; +@@ -127,16 +127,4 @@ public final class FabricModJsonFactory { + throw new UncheckedIOException("Failed to read " + file.getAbsolutePath(), e); } } - @@ -1535,10 +1542,10 @@ index 9ff5a7d6a485619b887d5e39079327cc66a4d603..7953be6c2588fbab6169a05bed2cca56 } diff --git a/src/main/java/net/fabricmc/loom/util/fmj/FabricModJsonUtils.java b/src/main/java/net/fabricmc/loom/util/metadata/ModMetadataUtils.java -similarity index 83% +similarity index 87% rename from src/main/java/net/fabricmc/loom/util/fmj/FabricModJsonUtils.java rename to src/main/java/net/fabricmc/loom/util/metadata/ModMetadataUtils.java -index 78b94032d504867351f99a4db77c146d4884dcda..0ba04381a8d010cdbdc0dac63b444db5e774444e 100644 +index 5559551bbe823ddaa1a3e6163f0733ad8b9ae1e4..c1640fa2f38c0008b43529a19463830163e4ce02 100644 --- a/src/main/java/net/fabricmc/loom/util/fmj/FabricModJsonUtils.java +++ b/src/main/java/net/fabricmc/loom/util/metadata/ModMetadataUtils.java @@ -22,7 +22,7 @@ @@ -1549,21 +1556,21 @@ index 78b94032d504867351f99a4db77c146d4884dcda..0ba04381a8d010cdbdc0dac63b444db5 +package net.fabricmc.loom.util.metadata; import java.util.Locale; - import java.util.function.Predicate; -@@ -30,9 +30,10 @@ import java.util.function.Predicate; + import java.util.Map; +@@ -31,9 +31,10 @@ import java.util.function.Predicate; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; +import org.jetbrains.annotations.Nullable; --final class FabricModJsonUtils { +-public final class FabricModJsonUtils { - private FabricModJsonUtils() { +public final class ModMetadataUtils { + private ModMetadataUtils() { } public static String readString(JsonObject jsonObject, String key) { -@@ -42,6 +43,15 @@ final class FabricModJsonUtils { +@@ -43,6 +44,15 @@ public final class FabricModJsonUtils { return element.getAsString(); } @@ -1579,7 +1586,7 @@ index 78b94032d504867351f99a4db77c146d4884dcda..0ba04381a8d010cdbdc0dac63b444db5 public static int readInt(JsonObject jsonObject, String key) { final JsonElement element = getElement(jsonObject, key); ensurePrimitive(element, JsonPrimitive::isNumber, key); -@@ -65,8 +75,8 @@ final class FabricModJsonUtils { +@@ -90,8 +100,8 @@ public final class FabricModJsonUtils { } } diff --git a/patches/0005-Fix-mappingsConstants-dependency-being-added-even-if.patch b/patches/0005-Fix-mappingsConstants-dependency-being-added-even-if.patch index 62964dd..c48c842 100644 --- a/patches/0005-Fix-mappingsConstants-dependency-being-added-even-if.patch +++ b/patches/0005-Fix-mappingsConstants-dependency-being-added-even-if.patch @@ -7,7 +7,7 @@ Subject: [PATCH] Fix mappingsConstants dependency being added even if already Implements https://github.com/FabricMC/fabric-loom/pull/605 diff --git a/src/main/java/net/fabricmc/loom/configuration/providers/mappings/MappingConfiguration.java b/src/main/java/net/fabricmc/loom/configuration/providers/mappings/MappingConfiguration.java -index bce9d5d0765342968d0ebd96f0c9584f823981f0..faa3f6ce28fd4dc33211553015d4d102d8b09e8f 100644 +index e57cb9d47e4701eec4639fc92090ee6662b1349d..15ed540357079ccc0332caf87ee011203dd68dd2 100644 --- a/src/main/java/net/fabricmc/loom/configuration/providers/mappings/MappingConfiguration.java +++ b/src/main/java/net/fabricmc/loom/configuration/providers/mappings/MappingConfiguration.java @@ -141,13 +141,19 @@ public class MappingConfiguration {