Fix genSources not working when root project doesnt have loom applied#308. (#309)

loom now runs genSources on root project if the plugin exists in the root project, else it will build in the current project.

Signed-off-by: solonovamax <solonovamax@12oclockpoint.com>
dev/0.11
solonovamax 2020-12-21 14:48:26 -05:00 committed by GitHub
parent 7e5053b0c5
commit c96396fb27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 39 additions and 37 deletions

View File

@ -99,46 +99,48 @@ public abstract class AbstractFernFlowerDecompiler implements LoomDecompiler {
Map<String, ProgressLogger> inUseLoggers = new HashMap<>(); Map<String, ProgressLogger> inUseLoggers = new HashMap<>();
progressGroup.started(); progressGroup.started();
ExecResult result = ForkingJavaExec.javaexec(project.getRootProject(), spec -> { ExecResult result = ForkingJavaExec.javaexec(
spec.setMain(fernFlowerExecutor().getName()); project.getRootProject().getPlugins().hasPlugin("fabric-loom") ? project.getRootProject() : project,
spec.jvmArgs("-Xms200m", "-Xmx3G"); spec -> {
spec.setArgs(args); spec.setMain(fernFlowerExecutor().getName());
spec.setErrorOutput(System.err); spec.jvmArgs("-Xms200m", "-Xmx3G");
spec.setStandardOutput(new ConsumingOutputStream(line -> { spec.setArgs(args);
if (line.startsWith("Listening for transport") || !line.contains("::")) { spec.setErrorOutput(System.err);
System.out.println(line); spec.setStandardOutput(new ConsumingOutputStream(line -> {
return; if (line.startsWith("Listening for transport") || !line.contains("::")) {
} System.out.println(line);
return;
int sepIdx = line.indexOf("::");
String id = line.substring(0, sepIdx).trim();
String data = line.substring(sepIdx + 2).trim();
ProgressLogger logger = inUseLoggers.get(id);
String[] segs = data.split(" ");
if (segs[0].equals("waiting")) {
if (logger != null) {
logger.progress("Idle..");
inUseLoggers.remove(id);
freeLoggers.push(logger);
}
} else {
if (logger == null) {
if (!freeLoggers.isEmpty()) {
logger = freeLoggers.pop();
} else {
logger = loggerFactory.get();
} }
inUseLoggers.put(id, logger); int sepIdx = line.indexOf("::");
} String id = line.substring(0, sepIdx).trim();
String data = line.substring(sepIdx + 2).trim();
logger.progress(data); ProgressLogger logger = inUseLoggers.get(id);
}
})); String[] segs = data.split(" ");
});
if (segs[0].equals("waiting")) {
if (logger != null) {
logger.progress("Idle..");
inUseLoggers.remove(id);
freeLoggers.push(logger);
}
} else {
if (logger == null) {
if (!freeLoggers.isEmpty()) {
logger = freeLoggers.pop();
} else {
logger = loggerFactory.get();
}
inUseLoggers.put(id, logger);
}
logger.progress(data);
}
}));
});
inUseLoggers.values().forEach(ProgressLogger::completed); inUseLoggers.values().forEach(ProgressLogger::completed);
freeLoggers.forEach(ProgressLogger::completed); freeLoggers.forEach(ProgressLogger::completed);
progressGroup.completed(); progressGroup.completed();