-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a new merge mappings command that works with partial parameter ma…
…ppings. (#13)
- Loading branch information
Showing
6 changed files
with
119 additions
and
30 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
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
35 changes: 35 additions & 0 deletions
35
src/test/java/net/neoforged/installertools/MergeMappingsTest.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,35 @@ | ||
package net.neoforged.installertools; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.io.TempDir; | ||
|
||
import java.nio.file.Path; | ||
import java.nio.file.Paths; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
class MergeMappingsTest { | ||
@TempDir | ||
Path tempDir; | ||
|
||
@Test | ||
void testMergeMappings() throws Exception { | ||
Path neoFormMappings = Paths.get(getClass().getResource("/neoform_mappings.tsrg").toURI()); | ||
Path officialMappings = Paths.get(getClass().getResource("/official.txt").toURI()); | ||
Path expectedMappings = Paths.get(getClass().getResource("/expected_merged_mappings.tsrg").toURI()); | ||
Path outputPath = tempDir.resolve("output.txt"); | ||
|
||
// This is what NeoForm calls | ||
new MergeMappings().process(new String[]{ | ||
"--base", | ||
officialMappings.toAbsolutePath().toString(), | ||
"--reverse-base", | ||
"--merge", | ||
neoFormMappings.toAbsolutePath().toString(), | ||
"--output", | ||
outputPath.toString() | ||
}); | ||
|
||
assertThat(outputPath).hasSameTextualContentAs(expectedMappings); | ||
} | ||
} |
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,10 @@ | ||
tsrg2 left right | ||
a pkg/CoolName | ||
a F NOT_MENTIONED_FIELD | ||
a (FF)V coolMethod | ||
0 o p_254025_ | ||
1 o p_254401_ | ||
b ()D noParams | ||
b pkg/NotMentionedClass | ||
a F NOT_MENTIONED_FIELD | ||
b ()V notMentionedMethod |
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,5 @@ | ||
tsrg2 obf srg | ||
a - | ||
a (FF)V - | ||
0 o p_254025_ | ||
1 o p_254401_ |
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,10 @@ | ||
# This emulates the format used by mojang mappings | ||
pkg.CoolName -> a: | ||
# {"fileName":"CoolName.java","id":"sourceFile"} | ||
float NOT_MENTIONED_FIELD -> a | ||
9:10:void coolMethod(float,float) -> a | ||
13:13:double noParams() -> b | ||
pkg.NotMentionedClass -> b: | ||
# {"fileName":"NotMentionedClass.java","id":"sourceFile"} | ||
float NOT_MENTIONED_FIELD -> a | ||
6:8:void notMentionedMethod() -> b |