From 4a30993da750db7c2462d21dceb1e6132a21f46e Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Thu, 21 Jan 2021 19:40:59 +0000 Subject: [PATCH] Apply all buildscript configurations across all parent projects to try and fix fernflower classpath issues again. If you have any better suggestions please let me know. --- .../fernflower/ForkingJavaExec.java | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/main/java/net/fabricmc/loom/decompilers/fernflower/ForkingJavaExec.java b/src/main/java/net/fabricmc/loom/decompilers/fernflower/ForkingJavaExec.java index 8b5f5f6..4c0e21a 100644 --- a/src/main/java/net/fabricmc/loom/decompilers/fernflower/ForkingJavaExec.java +++ b/src/main/java/net/fabricmc/loom/decompilers/fernflower/ForkingJavaExec.java @@ -24,11 +24,12 @@ 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.ConfigurationContainer; -import org.gradle.api.artifacts.dsl.DependencyHandler; -import org.gradle.api.file.FileCollection; +import org.gradle.api.artifacts.Configuration; import org.gradle.process.ExecResult; import org.gradle.process.JavaExecSpec; @@ -40,14 +41,21 @@ import org.gradle.process.JavaExecSpec; */ public class ForkingJavaExec { public static ExecResult javaexec(Project project, Action 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(classpath); + spec.classpath(getForkedFernflowerClasspath(project)); action.execute(spec); }); } + + private static Set getForkedFernflowerClasspath(Project project) { + Set allConfigurations = new HashSet<>(); + Project p = project; + + do { + allConfigurations.addAll(p.getBuildscript().getConfigurations()); + p = p.getRootProject(); + } while (p != p.getRootProject()); + + return allConfigurations; + } }