mirror of
https://github.com/LegacyModdingMC/UniMix.git
synced 2026-11-21 09:12:15 +00:00
Add option to disable decompiler when exporting, fixes #82
This commit is contained in:
1 parent
f70bdf927a
commit
ed6e358761
2 files changed
+19
-8
No files matched your search
@@ -262,6 +262,16 @@ public class MixinEnvironment implements ITokenProvider {
|
||||
*/
|
||||
DEBUG_EXPORT_FILTER(Option.DEBUG_EXPORT, "filter"),
|
||||
|
||||
/**
|
||||
* Allow fernflower to be disabled even if it is found on the classpath
|
||||
*/
|
||||
DEBUG_EXPORT_DECOMPILE(Option.DEBUG_EXPORT, "decompile") {
|
||||
@Override
|
||||
boolean getBooleanValue() {
|
||||
return Booleans.parseBoolean(System.getProperty(this.property), super.getBooleanValue());
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Run the CheckClassAdapter on all classes after mixins are applied
|
||||
*/
|
||||
@@ -624,13 +634,13 @@ public class MixinEnvironment implements ITokenProvider {
|
||||
if (this.getOption(Option.DEBUG_VERBOSE)) {
|
||||
PrettyPrinter printer = new PrettyPrinter(32);
|
||||
printer.add("SpongePowered MIXIN (Verbose debugging enabled)").centre().hr();
|
||||
printer.add("%25s : %s", "Code source", codeSource);
|
||||
printer.add("%25s : %s", "Internal Version", version);
|
||||
printer.add("%25s : %s", "Java 8 Supported", CompatibilityLevel.JAVA_8.isSupported()).hr();
|
||||
printer.add("%28s : %s", "Code source", codeSource);
|
||||
printer.add("%28s : %s", "Internal Version", version);
|
||||
printer.add("%28s : %s", "Java 8 Supported", CompatibilityLevel.JAVA_8.isSupported()).hr();
|
||||
for (Option option : Option.values()) {
|
||||
printer.add("%25s : %s%s", option.property, option.parent == null ? "" : " - ", this.getOption(option));
|
||||
printer.add("%28s : %s%s", option.property, option.parent == null ? "" : " - ", this.getOption(option));
|
||||
}
|
||||
printer.hr().add("%25s : %s", "Detected Side", side);
|
||||
printer.hr().add("%28s : %s", "Detected Side", side);
|
||||
printer.print(System.err);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -300,7 +300,6 @@ public class MixinTransformer extends TreeTransformer {
|
||||
TreeInfo.setLock(this.lock);
|
||||
|
||||
this.decompiler = this.initDecompiler(new File(MixinTransformer.DEBUG_OUTPUT, "java"));
|
||||
|
||||
this.hotSwapper = this.initHotSwapper();
|
||||
|
||||
try {
|
||||
@@ -311,7 +310,7 @@ public class MixinTransformer extends TreeTransformer {
|
||||
}
|
||||
|
||||
private IDecompiler initDecompiler(File outputPath) {
|
||||
if (!MixinEnvironment.getCurrentEnvironment().getOption(Option.DEBUG_EXPORT)) {
|
||||
if (!MixinEnvironment.getCurrentEnvironment().getOption(Option.DEBUG_EXPORT_DECOMPILE)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -321,7 +320,9 @@ public class MixinTransformer extends TreeTransformer {
|
||||
Class<? extends IDecompiler> clazz =
|
||||
(Class<? extends IDecompiler>)Class.forName("org.spongepowered.asm.mixin.transformer.debug.RuntimeDecompiler");
|
||||
Constructor<? extends IDecompiler> ctor = clazz.getDeclaredConstructor(File.class);
|
||||
return ctor.newInstance(outputPath);
|
||||
IDecompiler decompiler = ctor.newInstance(outputPath);
|
||||
this.logger.info("Fernflower decompiler was successfully initialised, exported classes will be decompiled");
|
||||
return decompiler;
|
||||
} catch (Throwable th) {
|
||||
this.logger.info("Fernflower could not be loaded, exported classes will not be decompiled. {}: {}",
|
||||
th.getClass().getSimpleName(), th.getMessage());
|
||||
|
||||
Reference in new issue
Block a user