mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-04-02 13:37:45 -05:00
Revert "Use TR instead of Atlas for simple resource bundling and lambdas"
This reverts commit 2d0ba63f
This commit is contained in:
@@ -21,7 +21,7 @@ if (ENV.BUILD_NUMBER) {
|
||||
build = 'jenkins #${ENV.BUILD_NUMBER}'
|
||||
version = baseVersion + '.' + ENV.BUILD_NUMBER
|
||||
} else {
|
||||
version = baseVersion + '-forge.9'
|
||||
version = baseVersion + '-forge.8'
|
||||
}
|
||||
|
||||
repositories {
|
||||
@@ -72,8 +72,8 @@ dependencies {
|
||||
// Forge patches
|
||||
implementation ('net.minecraftforge:binarypatcher:1.1.1')
|
||||
implementation ('org.cadixdev:lorenz:0.5.3')
|
||||
implementation ('org.cadixdev:lorenz-io-enigma:0.5.3')
|
||||
implementation ('cuchaz:enigma-cli:0.21+build.213')
|
||||
implementation ('org.cadixdev:lorenz-asm:0.5.3')
|
||||
implementation ('org.cadixdev:atlas:0.2.0')
|
||||
implementation ('net.minecraftforge.gradle:ForgeGradle:3.0.179')
|
||||
|
||||
// Testing
|
||||
|
||||
@@ -26,27 +26,26 @@ package net.fabricmc.loom.providers;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.UnaryOperator;
|
||||
import java.util.zip.ZipError;
|
||||
|
||||
import com.google.common.io.Files;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import cuchaz.enigma.command.ConvertMappingsCommand;
|
||||
import cuchaz.enigma.translation.mapping.serde.MappingParseException;
|
||||
import net.minecraftforge.binarypatcher.ConsoleTool;
|
||||
import net.minecraftforge.gradle.mcp.util.MCPRuntime;
|
||||
import net.minecraftforge.gradle.mcp.util.MCPWrapper;
|
||||
import org.cadixdev.atlas.Atlas;
|
||||
import org.cadixdev.bombe.asm.jar.JarEntryRemappingTransformer;
|
||||
import org.cadixdev.lorenz.MappingSet;
|
||||
import org.cadixdev.lorenz.io.enigma.EnigmaWriter;
|
||||
import org.cadixdev.lorenz.asm.LorenzRemapper;
|
||||
import org.cadixdev.lorenz.io.srg.tsrg.TSrgReader;
|
||||
import org.gradle.api.GradleException;
|
||||
import org.gradle.api.Project;
|
||||
@@ -55,13 +54,11 @@ import org.gradle.api.logging.Logger;
|
||||
import net.fabricmc.loom.util.Constants;
|
||||
import net.fabricmc.loom.util.DependencyProvider;
|
||||
import net.fabricmc.loom.util.DownloadUtil;
|
||||
import net.fabricmc.loom.util.IoConsumer;
|
||||
import net.fabricmc.loom.util.ManifestVersion;
|
||||
import net.fabricmc.loom.util.MinecraftVersionInfo;
|
||||
import net.fabricmc.loom.util.StaticPathWatcher;
|
||||
import net.fabricmc.stitch.util.Pair;
|
||||
import net.fabricmc.tinyremapper.OutputConsumerPath;
|
||||
import net.fabricmc.tinyremapper.TinyRemapper;
|
||||
import net.fabricmc.tinyremapper.TinyUtils;
|
||||
import net.fabricmc.stitch.merge.JarMerger;
|
||||
|
||||
public class MinecraftProvider extends DependencyProvider {
|
||||
private String minecraftVersion;
|
||||
@@ -128,7 +125,7 @@ public class MinecraftProvider extends DependencyProvider {
|
||||
patchJars(getProject().getLogger());
|
||||
}
|
||||
|
||||
remapPatchedJars(getProject().getLogger());
|
||||
createPatchedJars(getProject().getLogger());
|
||||
}
|
||||
|
||||
if (!minecraftMergedJar.exists() || isRefreshDeps()) {
|
||||
@@ -249,40 +246,30 @@ public class MinecraftProvider extends DependencyProvider {
|
||||
}
|
||||
}
|
||||
|
||||
private void remapPatchedJars(Logger logger) throws IOException, MappingParseException {
|
||||
logger.lifecycle(":remapping minecraft (TinyRemapper, srg -> official)");
|
||||
private void createPatchedJars(Logger logger) throws IOException {
|
||||
logger.lifecycle(":remapping minecraft (Atlas, srg -> official)");
|
||||
|
||||
Path enigmaTemp = java.nio.file.Files.createTempFile(null, ".enigma");
|
||||
Path tinyTemp = java.nio.file.Files.createTempFile(null, ".tiny");
|
||||
useAtlas(MappingSet::reverse, atlas -> {
|
||||
atlas.run(minecraftClientPatchedSrgJar.toPath(), minecraftClientPatchedJar.toPath());
|
||||
atlas.run(minecraftServerPatchedSrgJar.toPath(), minecraftServerPatchedJar.toPath());
|
||||
});
|
||||
}
|
||||
|
||||
try (TSrgReader reader = new TSrgReader(new FileReader(getExtension().getMcpConfigProvider().getSrg()))) {
|
||||
MappingSet mappings = reader.read().reverse();
|
||||
private void useAtlas(UnaryOperator<MappingSet> mappingOp, IoConsumer<Atlas> action) throws IOException {
|
||||
try (Reader mappingReader = new FileReader(getExtension().getMcpConfigProvider().getSrg());
|
||||
TSrgReader reader = new TSrgReader(mappingReader);
|
||||
Atlas atlas = new Atlas()) {
|
||||
MappingSet mappings = mappingOp.apply(reader.read());
|
||||
|
||||
try (EnigmaWriter writer = new EnigmaWriter(new FileWriter(enigmaTemp.toFile()))) {
|
||||
writer.write(mappings);
|
||||
atlas.install(ctx -> new JarEntryRemappingTransformer(
|
||||
new LorenzRemapper(mappings, ctx.inheritanceProvider())
|
||||
));
|
||||
|
||||
for (File library : getLibraryProvider().getLibraries()) {
|
||||
atlas.use(library.toPath());
|
||||
}
|
||||
}
|
||||
|
||||
new ConvertMappingsCommand().run("enigma_file", enigmaTemp.toString(), "tinyv2:srg:official", tinyTemp.toString());
|
||||
|
||||
TinyRemapper remapper = TinyRemapper.newRemapper()
|
||||
.withMappings(TinyUtils.createTinyMappingProvider(tinyTemp, "srg", "official"))
|
||||
.build();
|
||||
|
||||
List<Pair<Path, Path>> jars = new ArrayList<>();
|
||||
jars.add(Pair.of(minecraftClientPatchedSrgJar.toPath(), minecraftClientPatchedJar.toPath()));
|
||||
jars.add(Pair.of(minecraftServerPatchedSrgJar.toPath(), minecraftServerPatchedJar.toPath()));
|
||||
|
||||
try {
|
||||
for (Pair<Path, Path> io : jars) {
|
||||
try (OutputConsumerPath consumer = new OutputConsumerPath.Builder(io.getRight()).build()) {
|
||||
consumer.addNonClassFiles(io.getLeft());
|
||||
remapper.readInputs(io.getLeft());
|
||||
remapper.apply(consumer);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
remapper.finish();
|
||||
action.accept(atlas);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user