fix: assorted bugfixes

This commit is contained in:
zaaarf 2024-05-31 19:41:42 +02:00
parent 81ec0e4140
commit c220472d5a
No known key found for this signature in database
GPG key ID: 102E445F4C3F829B
3 changed files with 7 additions and 20 deletions

View file

@ -25,8 +25,8 @@ repositories {
} }
dependencies { dependencies {
implementation 'commons-cli:commons-cli:1.5.0' shadow(implementation 'commons-cli:commons-cli:1.5.0')
implementation 'ftbsc.lll:mapper:0.4.0' shadow(implementation 'ftbsc.lll:mapper:0.4.1')
implementation 'com.google.auto.service:auto-service-annotations:1.1.0' implementation 'com.google.auto.service:auto-service-annotations:1.1.0'
annotationProcessor 'com.google.auto.service:auto-service:1.1.0' annotationProcessor 'com.google.auto.service:auto-service:1.1.0'
} }
@ -38,6 +38,7 @@ jar {
} }
shadowJar { shadowJar {
archiveClassifier = ''
dependencies { dependencies {
exclude(dependency('com.google.auto.service:auto-service-annotations:1.1.0')) exclude(dependency('com.google.auto.service:auto-service-annotations:1.1.0'))
} }

View file

@ -30,23 +30,9 @@ public class MappingWriter {
args = cmdLine.getArgs(); args = cmdLine.getArgs();
//separate normal args from custom args //separate normal args from custom args
int cursor;
for(cursor = 0; cursor < args.length; cursor++)
if(args[cursor].equals("-a"))
break;
String[] customArgs;
if(cursor != args.length) {
int len = args.length - cursor - 1;
customArgs = new String[len];
System.arraycopy(args, cursor + 1, customArgs, 0, len);
String[] newArgs = new String[cursor];
System.arraycopy(args, 0, newArgs, 0, cursor);
args = newArgs;
} else customArgs = new String[0];
if(args.length < 3) { if(args.length < 3) {
System.err.println("Bad argument count!"); System.err.println("Bad argument count!");
System.err.println("java -jar mapping-writer.jar [-r] [-o] <location> <format> <output> [-a <custom args>]"); System.err.println("java -jar mapping-writer.jar [-r] [-o] <location> <format> <output> [[custom args]]");
return; return;
} }
@ -85,7 +71,7 @@ public class MappingWriter {
//call the writer //call the writer
PrintWriter printWriter = new PrintWriter(new FileWriter(targetFile)); PrintWriter printWriter = new PrintWriter(new FileWriter(targetFile));
writer.write(mapper, printWriter, customArgs); writer.write(mapper, printWriter, Arrays.copyOfRange(args, 3, args.length));
printWriter.close(); printWriter.close();
} }
} }

View file

@ -20,8 +20,8 @@ public class TinyV2Writer implements IWriter {
@Override @Override
public void write(Mapper mapper, PrintWriter writer, String... args) { public void write(Mapper mapper, PrintWriter writer, String... args) {
if(args.length < 2) if(args.length < 2)
throw new RuntimeException("Please provide the namespaces for the tiny format after the -a flag!"); throw new RuntimeException("Please provide the namespaces for the tiny format as additional arguments!");
writer.printf("tiny\t2\t0\t%s\t%s", args[0], args[1]); writer.printf("tiny\t2\t0\t%s\t%s\n", args[0], args[1]);
mapper.getRawMappings().forEach((name, data) -> { mapper.getRawMappings().forEach((name, data) -> {
writer.printf("c\t%s\t%s\n", name, data.nameMapped); writer.printf("c\t%s\t%s\n", name, data.nameMapped);
data.getFields().forEach((fieldName, fieldData) -> data.getFields().forEach((fieldName, fieldData) ->