mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-03-28 04:07:01 -05:00
Fix MigrateMappingsTask
This commit is contained in:
@@ -57,6 +57,7 @@ import net.fabricmc.loom.configuration.providers.minecraft.mapped.NamedMinecraft
|
||||
import net.fabricmc.loom.configuration.providers.minecraft.mapped.SrgMinecraftProvider;
|
||||
import net.fabricmc.loom.extension.LoomFiles;
|
||||
import net.fabricmc.loom.extension.MixinExtension;
|
||||
import net.fabricmc.loom.util.ModPlatform;
|
||||
|
||||
public interface LoomGradleExtension extends LoomGradleExtensionAPI {
|
||||
static LoomGradleExtension get(Project project) {
|
||||
@@ -117,7 +118,10 @@ public interface LoomGradleExtension extends LoomGradleExtensionAPI {
|
||||
case NAMED -> getNamedMinecraftProvider().getMinecraftJars();
|
||||
case INTERMEDIARY -> getIntermediaryMinecraftProvider().getMinecraftJars();
|
||||
case OFFICIAL -> getMinecraftProvider().getMinecraftJars();
|
||||
case SRG -> getSrgMinecraftProvider().getMinecraftJars();
|
||||
case SRG -> {
|
||||
ModPlatform.assertPlatform(this, ModPlatform.FORGE, () -> "SRG jars are only available on Forge.");
|
||||
yield getSrgMinecraftProvider().getMinecraftJars();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -181,8 +181,10 @@ public class MigrateMappingsTask extends AbstractLoomTask {
|
||||
mercury.getClassPath().add(intermediaryJar);
|
||||
}
|
||||
|
||||
for (Path srgJar : extension.getMinecraftJars(MappingsNamespace.SRG)) {
|
||||
mercury.getClassPath().add(srgJar);
|
||||
if (extension.isForge()) {
|
||||
for (Path srgJar : extension.getMinecraftJars(MappingsNamespace.SRG)) {
|
||||
mercury.getClassPath().add(srgJar);
|
||||
}
|
||||
}
|
||||
|
||||
mercury.getProcessors().add(MercuryRemapper.create(mappingSet));
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This file is part of fabric-loom, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2021 FabricMC
|
||||
* Copyright (c) 2021-2022 FabricMC
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -25,6 +25,7 @@
|
||||
package net.fabricmc.loom.util;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.gradle.api.GradleException;
|
||||
import org.gradle.api.Project;
|
||||
@@ -41,10 +42,16 @@ public enum ModPlatform {
|
||||
}
|
||||
|
||||
public static void assertPlatform(LoomGradleExtensionAPI extension, ModPlatform platform) {
|
||||
if (extension.getPlatform().get() != platform) {
|
||||
assertPlatform(extension, platform, () -> {
|
||||
String msg = "Loom is not running on %s.%nYou can switch to it by adding 'loom.platform = %s' to your gradle.properties";
|
||||
String name = platform.name().toLowerCase(Locale.ROOT);
|
||||
throw new GradleException(String.format(msg, name, name));
|
||||
return msg.formatted(name, name);
|
||||
});
|
||||
}
|
||||
|
||||
public static void assertPlatform(LoomGradleExtensionAPI extension, ModPlatform platform, Supplier<String> message) {
|
||||
if (extension.getPlatform().get() != platform) {
|
||||
throw new GradleException(message.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user