mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-03-28 04:07:01 -05:00
broken
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.13'
|
||||
version = baseVersion + '-forge.20'
|
||||
}
|
||||
|
||||
repositories {
|
||||
|
||||
@@ -225,15 +225,15 @@ public class MappingsProvider extends DependencyProvider {
|
||||
extractMappings(unmergedYarnJarFs, unmergedYarn);
|
||||
}
|
||||
|
||||
Path invertedIntermediary = Paths.get(mappingsStepsDir.toString(), "inverted-intermediary.tiny");
|
||||
reorderMappings(unmergedIntermediary, invertedIntermediary, "intermediary", "official");
|
||||
//Path invertedIntermediary = Paths.get(mappingsStepsDir.toString(), "inverted-intermediary.tiny");
|
||||
//reorderMappings(unmergedIntermediary, invertedIntermediary, "intermediary", "official");
|
||||
Path unorderedMergedMappings = Paths.get(mappingsStepsDir.toString(), "unordered-merged.tiny");
|
||||
Path intermediaryToSrg = Paths.get(mappingsStepsDir.toString(), "intermediary-to-srg.tiny");
|
||||
Path srgToIntermediary = Paths.get(mappingsStepsDir.toString(), "srg-to-intermediary.tiny");
|
||||
Path srgToYarn = Paths.get(mappingsStepsDir.toString(), "srg-to-yarn.tiny");
|
||||
composeMappings(invertedIntermediary, getExtension().getMcpConfigProvider().getSrgTiny().toPath(), "tinyv2:intermediary:srg", intermediaryToSrg);
|
||||
composeMappings(getExtension().getMcpConfigProvider().getInvertedSrgTiny().toPath(), unmergedYarn, "tinyv2:srg:named", srgToYarn);
|
||||
composeMappings(getExtension().getMcpConfigProvider().getSrgTiny().toPath(), unmergedIntermediary, "tinyv2:srg:intermediary", srgToIntermediary);
|
||||
composeMappings(srgToIntermediary, unmergedYarn, "tinyv2:srg:named", srgToYarn);
|
||||
project.getLogger().info(":merging");
|
||||
mergeMappings(intermediaryToSrg, srgToYarn, unorderedMergedMappings);
|
||||
mergeMappings(srgToIntermediary, srgToYarn, unorderedMergedMappings);
|
||||
reorderMappings(unorderedMergedMappings, tinyMappings.toPath(), "srg", "intermediary", "named");
|
||||
}
|
||||
|
||||
|
||||
@@ -31,18 +31,34 @@ import java.nio.file.FileSystem;
|
||||
import java.nio.file.FileSystems;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import cuchaz.enigma.command.ConvertMappingsCommand;
|
||||
import cuchaz.enigma.command.InvertMappingsCommand;
|
||||
import org.cadixdev.lorenz.MappingSet;
|
||||
import org.cadixdev.lorenz.io.enigma.EnigmaWriter;
|
||||
import org.cadixdev.lorenz.io.srg.tsrg.TSrgReader;
|
||||
import org.cadixdev.lorenz.model.ClassMapping;
|
||||
import org.cadixdev.lorenz.model.FieldMapping;
|
||||
import org.cadixdev.lorenz.model.MethodMapping;
|
||||
import org.cadixdev.lorenz.model.TopLevelClassMapping;
|
||||
import org.gradle.api.Project;
|
||||
|
||||
import net.fabricmc.loom.util.Constants;
|
||||
import net.fabricmc.loom.util.DependencyProvider;
|
||||
import net.fabricmc.mapping.tree.ClassDef;
|
||||
import net.fabricmc.stitch.commands.CommandReorderTiny;
|
||||
import net.fabricmc.stitch.commands.tinyv2.CommandReorderTinyV2;
|
||||
import net.fabricmc.stitch.commands.tinyv2.TinyClass;
|
||||
import net.fabricmc.stitch.commands.tinyv2.TinyField;
|
||||
import net.fabricmc.stitch.commands.tinyv2.TinyMethod;
|
||||
|
||||
public class McpConfigProvider extends DependencyProvider {
|
||||
private File mcp;
|
||||
@@ -75,21 +91,36 @@ public class McpConfigProvider extends DependencyProvider {
|
||||
}
|
||||
|
||||
if (!srgTiny.exists()) {
|
||||
Path enigma = Files.createTempFile(null, "-srg.enigma");
|
||||
List<TinyClass> classes = new ArrayList<>();
|
||||
|
||||
try (TSrgReader reader = new TSrgReader(new FileReader(srg))) {
|
||||
MappingSet mappings = reader.read();
|
||||
|
||||
try (EnigmaWriter writer = new EnigmaWriter(Files.newBufferedWriter(enigma))) {
|
||||
writer.write(mappings);
|
||||
}
|
||||
}
|
||||
|
||||
new ConvertMappingsCommand().run("enigma_file", enigma.toString(), "tinyv2:official:srg", srgTiny.getAbsolutePath());
|
||||
new InvertMappingsCommand().run("tinyv2", srgTiny.getAbsolutePath(), "tinyv2:srg:official", invertedSrgTiny.getAbsolutePath());
|
||||
new CommandReorderTinyV2().run(new String[]{srgTiny.getAbsolutePath(), invertedSrgTiny.getAbsolutePath(), "srg", "official"});
|
||||
}
|
||||
}
|
||||
|
||||
private <M extends ClassMapping<M, ?>> TinyClass toTinyClass(M mapping) {
|
||||
List<String> names = ImmutableList.of(mapping.getFullObfuscatedName(), mapping.getFullDeobfuscatedName());
|
||||
List<TinyMethod> methods = new ArrayList<>();
|
||||
List<TinyField> fields = new ArrayList<>();
|
||||
|
||||
for (MethodMapping method : mapping.getMethodMappings()) {
|
||||
List<String> methodNames = ImmutableList.of(method.getObfuscatedName(), method.getDeobfuscatedName());
|
||||
methods.add(new TinyMethod(method.getObfuscatedDescriptor(), methodNames, Collections.emptySet(), Collections.emptySet(), Collections.emptySet()));
|
||||
}
|
||||
|
||||
for (FieldMapping field : mapping.getFieldMappings()) {
|
||||
List<String> fieldNames = ImmutableList.of(field.getObfuscatedName(), field.getDeobfuscatedName());
|
||||
fields.add(new TinyField(field.get))
|
||||
}
|
||||
|
||||
return new TinyClass(names, methods, fields, Collections.emptySet());
|
||||
}
|
||||
|
||||
private void init(String version) {
|
||||
mcp = new File(getExtension().getUserCache(), "mcp-" + version + ".zip");
|
||||
srg = new File(getExtension().getUserCache(), "srg-" + version + ".tsrg");
|
||||
|
||||
@@ -34,8 +34,11 @@ import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.FileSystem;
|
||||
import java.nio.file.FileSystemNotFoundException;
|
||||
import java.nio.file.FileSystems;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.nio.file.StandardOpenOption;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.UnaryOperator;
|
||||
@@ -328,7 +331,14 @@ public class MinecraftProvider extends DependencyProvider {
|
||||
.filter(it -> !it.toString().endsWith(".class"))
|
||||
.forEach(it -> {
|
||||
try {
|
||||
java.nio.file.Files.copy(it, targetFs.getPath(it.toString()));
|
||||
Path targetFile = targetFs.getPath(it.toString());
|
||||
Path parent = targetFile.getParent();
|
||||
|
||||
if (parent != null) {
|
||||
java.nio.file.Files.createDirectories(parent);
|
||||
}
|
||||
|
||||
java.nio.file.Files.copy(it, targetFile, StandardCopyOption.REPLACE_EXISTING);
|
||||
} catch (IOException e) {
|
||||
throw new UncheckedIOException(e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user