Revert previous attempt at fixing genSources when loom is applied via buildSrc

dev/0.11
modmuss50 2021-01-21 21:46:07 +00:00
parent 34a9d2316c
commit f7efac5d18
2 changed files with 10 additions and 17 deletions

View File

@ -100,7 +100,7 @@ public abstract class AbstractFernFlowerDecompiler implements LoomDecompiler {
progressGroup.started();
ExecResult result = ForkingJavaExec.javaexec(
project,
project.getRootProject().getPlugins().hasPlugin("fabric-loom") ? project.getRootProject() : project,
spec -> {
spec.setMain(fernFlowerExecutor().getName());
spec.jvmArgs("-Xms200m", "-Xmx3G");

View File

@ -24,12 +24,11 @@
package net.fabricmc.loom.decompilers.fernflower;
import java.util.HashSet;
import java.util.Set;
import org.gradle.api.Action;
import org.gradle.api.Project;
import org.gradle.api.artifacts.Configuration;
import org.gradle.api.artifacts.ConfigurationContainer;
import org.gradle.api.artifacts.dsl.DependencyHandler;
import org.gradle.api.file.FileCollection;
import org.gradle.process.ExecResult;
import org.gradle.process.JavaExecSpec;
@ -41,20 +40,14 @@ import org.gradle.process.JavaExecSpec;
*/
public class ForkingJavaExec {
public static ExecResult javaexec(Project project, Action<? super JavaExecSpec> action) {
ConfigurationContainer configurations = project.getBuildscript().getConfigurations();
DependencyHandler handler = project.getDependencies();
FileCollection classpath = configurations.getByName("classpath")//
.plus(configurations.detachedConfiguration(handler.localGroovy()));
return project.javaexec(spec -> {
spec.classpath(getForkedFernflowerClasspath(project));
spec.classpath(classpath);
action.execute(spec);
});
}
private static Configuration[] getForkedFernflowerClasspath(Project project) {
Set<Configuration> allConfigurations = new HashSet<>();
allConfigurations.addAll(project.getBuildscript().getConfigurations());
if (project.getRootProject() != project) {
allConfigurations.addAll(project.getRootProject().getBuildscript().getConfigurations());
}
return allConfigurations.toArray(new Configuration[0]);
}
}