mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-03-28 04:07:01 -05:00
Small cleanup + Use MappingsUtils for reordering
Signed-off-by: shedaniel <daniel@shedaniel.me>
This commit is contained in:
@@ -77,7 +77,7 @@ dependencies {
|
||||
|
||||
// tinyfile management
|
||||
implementation ('dev.architectury:tiny-remapper:1.0.0')
|
||||
implementation ('dev.architectury:mappings-layers-core:1.1.3')
|
||||
implementation ('dev.architectury:mappings-layers-core:1.1.6')
|
||||
implementation ('net.fabricmc:tiny-mappings-parser:0.3.0+build.17')
|
||||
|
||||
implementation 'net.fabricmc:access-widener:1.0.0'
|
||||
|
||||
@@ -57,7 +57,7 @@ public class LoomGradlePlugin implements Plugin<Project> {
|
||||
project.getLogger().lifecycle("Architectury Loom: " + loomVersion);
|
||||
}
|
||||
|
||||
refreshDeps = project.getGradle().getStartParameter().isRefreshDependencies();
|
||||
refreshDeps = project.getGradle().getStartParameter().isRefreshDependencies() || "true".equals(System.getProperty("loom.refresh"));
|
||||
|
||||
if (refreshDeps) {
|
||||
MappingsCache.INSTANCE.invalidate();
|
||||
|
||||
@@ -42,8 +42,11 @@ import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.base.Stopwatch;
|
||||
import com.google.common.net.UrlEscapers;
|
||||
import com.google.gson.JsonObject;
|
||||
import dev.architectury.mappingslayers.api.utils.MappingsModificationUtils;
|
||||
import dev.architectury.mappingslayers.api.utils.MappingsUtils;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.tools.ant.util.StringUtils;
|
||||
import org.gradle.api.Project;
|
||||
@@ -417,21 +420,21 @@ public class MappingsProvider extends DependencyProvider {
|
||||
extractMappings(unmergedYarnJarFs, unmergedYarn);
|
||||
}
|
||||
|
||||
Stopwatch stopwatch = Stopwatch.createStarted();
|
||||
project.getLogger().info(":merging mappings");
|
||||
Path invertedIntermediary = Paths.get(mappingsStepsDir.toString(), "inverted-intermediary.tiny");
|
||||
reorderMappings(getIntermediaryTiny(), invertedIntermediary, "intermediary", "official");
|
||||
Path unorderedMergedMappings = Paths.get(mappingsStepsDir.toString(), "unordered-merged.tiny");
|
||||
project.getLogger().info(":merging");
|
||||
mergeMappings(invertedIntermediary, unmergedYarn, unorderedMergedMappings);
|
||||
reorderMappings(unorderedMergedMappings, tinyMappings.toPath(), "official", "intermediary", "named");
|
||||
Files.deleteIfExists(invertedIntermediary);
|
||||
Files.deleteIfExists(unorderedMergedMappings);
|
||||
project.getLogger().info(":merged mappings in " + stopwatch.stop());
|
||||
}
|
||||
|
||||
private void reorderMappings(Path oldMappings, Path newMappings, String... newOrder) {
|
||||
Command command = new CommandReorderTinyV2();
|
||||
String[] args = new String[2 + newOrder.length];
|
||||
args[0] = oldMappings.toAbsolutePath().toString();
|
||||
args[1] = newMappings.toAbsolutePath().toString();
|
||||
System.arraycopy(newOrder, 0, args, 2, newOrder.length);
|
||||
runCommand(command, args);
|
||||
private void reorderMappings(Path oldMappings, Path newMappings, String... newOrder) throws IOException {
|
||||
MappingsModificationUtils.modify(oldMappings, newMappings, tree ->
|
||||
MappingsUtils.reorderNamespaces(tree, Arrays.asList(newOrder)));
|
||||
}
|
||||
|
||||
private void mergeMappings(Path intermediaryMappings, Path yarnMappings, Path newMergedMappings) {
|
||||
|
||||
@@ -112,7 +112,7 @@ public final class LoomTasks {
|
||||
|
||||
private static void registerLaunchSettings(Project project) {
|
||||
LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class);
|
||||
Preconditions.checkArgument(extension.getRunConfigs().size() == 0, "Launch configurations must not be registered before loom");
|
||||
Preconditions.checkArgument(extension.getLaunchConfigs().size() == 0, "Launch configurations must not be registered before loom");
|
||||
extension.getLaunchConfigs().create("client");
|
||||
extension.getLaunchConfigs().create("server");
|
||||
|
||||
|
||||
@@ -40,7 +40,6 @@ import org.gradle.api.Project;
|
||||
import org.zeroturnaround.zip.ZipUtil;
|
||||
|
||||
import net.fabricmc.loom.LoomGradleExtension;
|
||||
import net.fabricmc.loom.configuration.providers.mappings.MappingsProvider;
|
||||
|
||||
public class SpecialSourceExecutor {
|
||||
public static Path produceSrgJar(Project project, String side, File specialSourceJar, Path officialJar, Path srgPath)
|
||||
|
||||
Reference in New Issue
Block a user