This repository has been archived by the owner on Jan 23, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
92715f4
commit ea16f28
Showing
35 changed files
with
143 additions
and
34 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
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
2 changes: 1 addition & 1 deletion
2
src/main/java/net/fabricmc/stitch/commands/CommandAsmTrace.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
2 changes: 1 addition & 1 deletion
2
src/main/java/net/fabricmc/stitch/commands/CommandGenerateIntermediary.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
2 changes: 1 addition & 1 deletion
2
src/main/java/net/fabricmc/stitch/commands/CommandGeneratePrefixRemapper.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
2 changes: 1 addition & 1 deletion
2
src/main/java/net/fabricmc/stitch/commands/CommandMatcherToTiny.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
2 changes: 1 addition & 1 deletion
2
src/main/java/net/fabricmc/stitch/commands/CommandMergeJar.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
2 changes: 1 addition & 1 deletion
2
src/main/java/net/fabricmc/stitch/commands/CommandMergeTiny.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
2 changes: 1 addition & 1 deletion
2
src/main/java/net/fabricmc/stitch/commands/CommandProposeFieldNames.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
108 changes: 108 additions & 0 deletions
108
src/main/java/net/fabricmc/stitch/commands/CommandReorderTiny.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,108 @@ | ||
/* | ||
* Copyright (c) 2016, 2017, 2018, 2019 Adrian Siekierka | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package net.fabricmc.stitch.commands; | ||
|
||
import com.google.common.base.Joiner; | ||
import net.fabricmc.mappings.ClassEntry; | ||
import net.fabricmc.mappings.EntryTriple; | ||
import net.fabricmc.mappings.FieldEntry; | ||
import net.fabricmc.mappings.Mappings; | ||
import net.fabricmc.mappings.MappingsProvider; | ||
import net.fabricmc.mappings.MethodEntry; | ||
import net.fabricmc.stitch.Command; | ||
import net.fabricmc.stitch.representation.JarReader; | ||
import net.fabricmc.stitch.representation.JarRootEntry; | ||
|
||
import java.io.BufferedWriter; | ||
import java.io.File; | ||
import java.io.FileInputStream; | ||
import java.io.FileOutputStream; | ||
import java.io.IOException; | ||
import java.io.OutputStreamWriter; | ||
import java.util.Locale; | ||
|
||
public class CommandReorderTiny extends Command { | ||
public CommandReorderTiny() { | ||
super("reorderTiny"); | ||
} | ||
|
||
@Override | ||
public String getHelpString() { | ||
return "<old-mapping-file> <new-mapping-file> [name order...]"; | ||
} | ||
|
||
@Override | ||
public boolean isArgumentCountValid(int count) { | ||
return count >= 4; | ||
} | ||
|
||
@Override | ||
public void run(String[] args) throws Exception { | ||
File fileOld = new File(args[0]); | ||
File fileNew = new File(args[1]); | ||
String[] names = new String[args.length - 2]; | ||
System.arraycopy(args, 2, names, 0, names.length); | ||
|
||
System.err.println("Loading mapping file..."); | ||
|
||
Mappings input; | ||
try (FileInputStream stream = new FileInputStream(fileOld)) { | ||
input = MappingsProvider.readTinyMappings(stream, false); | ||
} | ||
|
||
System.err.println("Rewriting mappings..."); | ||
|
||
try (FileOutputStream stream = new FileOutputStream(fileNew); | ||
OutputStreamWriter osw = new OutputStreamWriter(stream); | ||
BufferedWriter writer = new BufferedWriter(osw)) { | ||
|
||
StringBuilder firstLineBuilder = new StringBuilder("v1"); | ||
for (String name : names) { | ||
firstLineBuilder.append('\t').append(name); | ||
} | ||
writer.write(firstLineBuilder.append('\n').toString()); | ||
for (ClassEntry entry : input.getClassEntries()) { | ||
StringBuilder s = new StringBuilder("CLASS"); | ||
for (String name : names) { | ||
s.append('\t').append(entry.get(name)); | ||
} | ||
writer.write(s.append('\n').toString()); | ||
} | ||
for (FieldEntry entry : input.getFieldEntries()) { | ||
StringBuilder s = new StringBuilder("FIELD"); | ||
EntryTriple first = entry.get(names[0]); | ||
s.append('\t').append(first.getOwner()).append('\t').append(first.getDesc()); | ||
for (String name : names) { | ||
s.append('\t').append(entry.get(name).getName()); | ||
} | ||
writer.write(s.append('\n').toString()); | ||
} | ||
for (MethodEntry entry : input.getMethodEntries()) { | ||
StringBuilder s = new StringBuilder("METHOD"); | ||
EntryTriple first = entry.get(names[0]); | ||
s.append('\t').append(first.getOwner()).append('\t').append(first.getDesc()); | ||
for (String name : names) { | ||
s.append('\t').append(entry.get(name).getName()); | ||
} | ||
writer.write(s.append('\n').toString()); | ||
} | ||
} | ||
|
||
System.err.println("Done!"); | ||
} | ||
|
||
} |
2 changes: 1 addition & 1 deletion
2
src/main/java/net/fabricmc/stitch/commands/CommandRewriteIntermediary.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
2 changes: 1 addition & 1 deletion
2
src/main/java/net/fabricmc/stitch/commands/CommandUpdateIntermediary.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
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
2 changes: 1 addition & 1 deletion
2
src/main/java/net/fabricmc/stitch/enigma/StitchEnigmaPlugin.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
2 changes: 1 addition & 1 deletion
2
src/main/java/net/fabricmc/stitch/enigma/StitchIntermediaryObfuscationTestService.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
2 changes: 1 addition & 1 deletion
2
src/main/java/net/fabricmc/stitch/enigma/StitchNameProposalService.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
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
2 changes: 1 addition & 1 deletion
2
src/main/java/net/fabricmc/stitch/representation/AbstractJarEntry.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
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
2 changes: 1 addition & 1 deletion
2
src/main/java/net/fabricmc/stitch/representation/ClassPropagationTree.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
2 changes: 1 addition & 1 deletion
2
src/main/java/net/fabricmc/stitch/representation/ClassStorage.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
2 changes: 1 addition & 1 deletion
2
src/main/java/net/fabricmc/stitch/representation/JarClassEntry.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
2 changes: 1 addition & 1 deletion
2
src/main/java/net/fabricmc/stitch/representation/JarFieldEntry.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
2 changes: 1 addition & 1 deletion
2
src/main/java/net/fabricmc/stitch/representation/JarMethodEntry.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
2 changes: 1 addition & 1 deletion
2
src/main/java/net/fabricmc/stitch/representation/JarReader.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
2 changes: 1 addition & 1 deletion
2
src/main/java/net/fabricmc/stitch/representation/JarRootEntry.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
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
2 changes: 1 addition & 1 deletion
2
src/main/java/net/fabricmc/stitch/util/SnowmanClassVisitor.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
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
2 changes: 1 addition & 1 deletion
2
src/main/java/net/fabricmc/stitch/util/SyntheticParameterClassVisitor.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