-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- NFRT needs the ability to supply a specific JDK home for recompilation and supplying the JRE libraries for Vineflower / Remapping. (It runs under 21 itself but the 1.20.1 decompiler crashes with J21 libs) - Patches in 1.20.1 had a different prefix (not a/, b/), so I added the required support for specifying the patch prefix. 1.12 specified the different prefixes in its "userdev" config, so support for that is just added. - Properly process the NeoForm/MCP java version in the recompile options (was harcoded to 21 before) - NFRT gains support to remap the sources from SRG->Mojang via the Regular Expression based remapper - Add a task that generates mappings in different formats and directions (named <-> intermediary, TSRG/SRG/CSV) for use in pre 1.20.1 toolchains - Support for a few nitpicky changes in the Userdev JSON --------- Co-authored-by: Matyrobbrt <matyrobbrt@gmail.com>
- Loading branch information
1 parent
bb4d9db
commit 77bfe1a
Showing
21 changed files
with
636 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
src/main/java/net/neoforged/neoform/runtime/actions/CreateLegacyMappingsAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package net.neoforged.neoform.runtime.actions; | ||
|
||
import net.neoforged.neoform.runtime.engine.ProcessingEnvironment; | ||
import net.neoforged.neoform.runtime.graph.ExecutionNodeAction; | ||
import net.neoforged.srgutils.IMappingFile; | ||
|
||
import java.io.IOException; | ||
import java.nio.charset.StandardCharsets; | ||
import java.nio.file.Files; | ||
import java.util.ArrayList; | ||
import java.util.stream.Collectors; | ||
import java.util.stream.Stream; | ||
import java.util.zip.ZipEntry; | ||
import java.util.zip.ZipOutputStream; | ||
|
||
/** | ||
* Creates different mapping files used by the legacy toolchain: | ||
* <ul> | ||
* <li>a {@code officialToSrg} TSRGv1 file that maps official names to SRG names</li> | ||
* <li>a {@code srgToOfficial} SRG file (to please Mixin) that maps SRG names to official names</li> | ||
* <li>a {@code csvMappings} zip file containing 2 csv files that map SRG names to official names</li> | ||
* </ul> | ||
*/ | ||
public class CreateLegacyMappingsAction implements ExecutionNodeAction { | ||
@Override | ||
public void run(ProcessingEnvironment environment) throws IOException, InterruptedException { | ||
var first = environment.getRequiredInputPath("officialToObf"); | ||
var second = environment.getRequiredInputPath("obfToSrg"); | ||
|
||
var firstMappings = IMappingFile.load(first.toFile()); | ||
var secondMappings = IMappingFile.load(second.toFile()); | ||
|
||
var officialToSrg = firstMappings.chain(secondMappings); | ||
officialToSrg.write(environment.getOutputPath("officialToSrg"), IMappingFile.Format.TSRG, false); | ||
|
||
var srgToOfficial = officialToSrg.reverse(); | ||
srgToOfficial.write(environment.getOutputPath("srgToOfficial"), IMappingFile.Format.SRG, false); | ||
|
||
try (var zipCsv = new ZipOutputStream(Files.newOutputStream(environment.getOutputPath("csvMappings")))) { | ||
writeCsv(zipCsv, "methods.csv", srgToOfficial.getClasses().stream() | ||
.flatMap(c -> c.getMethods().stream()).filter(c -> c.getOriginal().startsWith("m_"))); | ||
writeCsv(zipCsv, "fields.csv", srgToOfficial.getClasses().stream() | ||
.flatMap(c -> c.getFields().stream()).filter(c -> c.getOriginal().startsWith("f_"))); | ||
} | ||
} | ||
|
||
private static void writeCsv(ZipOutputStream stream, String name, Stream<? extends IMappingFile.INode> nodes) throws IOException { | ||
stream.putNextEntry(new ZipEntry(name)); | ||
stream.write(("searge,name,side,desc\n" + nodes.map(n -> n.getOriginal() + "," + n.getMapped() + ",0,").collect(Collectors.joining("\n"))).getBytes(StandardCharsets.UTF_8)); | ||
stream.closeEntry(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.