Skip to content

Commit

Permalink
Add the ability to load mappings from multiple files (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
Matyrobbrt authored Sep 7, 2024
1 parent fd03365 commit b85e4e6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 89 deletions.
85 changes: 0 additions & 85 deletions Jenkinsfile

This file was deleted.

3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ The following are the core command-line options (options are optional unless oth
- `--output <path>` - Path to the output JAR file; if not present, then the input JAR file is _overwritten_ with the
output
- `--map <path>`/`--names <path>` - Path to the mappings file, which may be of any format supported
by [SrgUtils][srgutils]
by [SrgUtils][srgutils]. Can be specified multiple times. If more than one mappings file is specified, the rest will
be merged with the first one sequentially, only using the first entry for any duplicates across all files.
- `--reverse` - When present, any provided mappings are first reversed (`A -> B` becomes `B -> A`) before its
application
- `--log <path>` - Path to an output file for logging; if not present, then logging is directed to the
Expand Down
10 changes: 7 additions & 3 deletions src/main/java/net/neoforged/art/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import java.util.Arrays;
import java.util.List;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import joptsimple.OptionException;
import joptsimple.OptionParser;
Expand Down Expand Up @@ -100,9 +101,12 @@ public static void main(String[] args) throws IOException {
// Map is optional so that we can run other fixes without renaming.
// This does mean that it's not strictly a 'renaming' tool but screw it I like the name.
if (options.has(mapO)) {
File mapF = options.valueOf(mapO);
log.accept("Names: " + mapF.getAbsolutePath() + "(reversed: " + options.has(reverseO) + ")");
IMappingFile mappings = IMappingFile.load(mapF);
List<File> mapF = options.valuesOf(mapO);
log.accept("Names: " + mapF.stream().map(File::getAbsolutePath).collect(Collectors.joining(", ")) + "(reversed: " + options.has(reverseO) + ")");
IMappingFile mappings = IMappingFile.load(mapF.get(0));
for (int i = 1; i < mapF.size(); i++) {
mappings = mappings.merge(IMappingFile.load(mapF.get(i)));
}
if (options.has(reverseO)) {
mappings = mappings.reverse();
}
Expand Down

0 comments on commit b85e4e6

Please sign in to comment.