forked from MCPHackers/RetroMCP-Java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskParameter.java
More file actions
73 lines (64 loc) · 2.82 KB
/
TaskParameter.java
File metadata and controls
73 lines (64 loc) · 2.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package org.mcphackers.mcp.tasks.mode;
import java.util.HashMap;
import java.util.Map;
import de.fernflower.main.extern.IFernflowerPreferences;
import org.mcphackers.mcp.MCP;
import org.mcphackers.mcp.Options;
import org.mcphackers.mcp.tasks.Task.Side;
/**
* Any optional parameters which can be accessed from tasks
*
* @see Options#getParameter(TaskParameter)
*/
public enum TaskParameter {
SIDE("side", Integer.class, Side.ANY.index),
PATCHES("patch", Boolean.class, true),
IGNORED_PACKAGES("ignore", String[].class, new String[]{"paulscode", "com/jcraft", "de/jarnbjo", "isom", "ibxm", "de/matthiasmann/twl", "javax/xml", "javax/ws", "argo", "org/bouncycastle", "org/apache/commons", "com/google/gson", "com/google/common"}),
FERNFLOWER_OPTIONS("ff_options", String.class, getDefaultFFOptions()),
OBFUSCATION("obf", Boolean.class, false),
SRG_OBFUSCATION("srgobf", Boolean.class, false),
FULL_BUILD("fullbuild", Boolean.class, false),
RUN_BUILD("runbuild", Boolean.class, false),
RUN_ARGS("runargs", String[].class, new String[]{"-Xms1024M", "-Xmx1024M"}),
GAME_ARGS("gameargs", String.class, ""),
SETUP_VERSION("setup", String.class, null),
SOURCE_VERSION("source", Integer.class, -1),
TARGET_VERSION("target", Integer.class, -1),
JAVA_HOME("javahome", String.class, ""),
JAVAC_ARGS("javacargs", String.class, ""),
EXCLUDED_CLASSES("excludedclasses", String.class, ""),
DECOMPILE_RESOURCES("resources", Boolean.class, false),
GUESS_GENERICS("generics", Boolean.class, false),
STRIP_GENERICS("stripgenerics", Boolean.class, false),
OUTPUT_SRC("outputsrc", Boolean.class, true),
STRIP_SOURCE_FILE("stripsourcefile", Boolean.class, true),
STRING_REMAP_PACKAGES("stringremap", String[].class, new String[0]);
public static final TaskParameter[] VALUES = TaskParameter.values();
public final String name;
public final Class<?> type;
public final Object defaultValue;
<T> TaskParameter(String name, Class<T> c, T value) {
TaskParameterMap.nameToParamMap.put(name, this);
this.name = name;
this.type = c;
this.defaultValue = value;
}
private static String getDefaultFFOptions() {
Map<String, Object> ffOptions = new HashMap<>(IFernflowerPreferences.DEFAULTS);
ffOptions.put(IFernflowerPreferences.NO_COMMENT_OUTPUT, "1");
ffOptions.put(IFernflowerPreferences.REMOVE_BRIDGE, "0");
ffOptions.put(IFernflowerPreferences.ASCII_STRING_CHARACTERS, "1");
ffOptions.put(IFernflowerPreferences.OVERRIDE_ANNOTATION, "0");
ffOptions.put(IFernflowerPreferences.DECOMPILE_GENERIC_SIGNATURES, "1");
ffOptions.put(IFernflowerPreferences.INDENT_STRING, "\t");
ffOptions.remove(IFernflowerPreferences.BANNER);
return ffOptions.toString();
}
public String getDesc() {
String s = "task.param." + name;
if (MCP.TRANSLATOR.hasKey(s)) {
return MCP.TRANSLATOR.translateKey(s);
}
return MCP.TRANSLATOR.translateKey("task.noDesc");
}
}