mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-04-02 13:37:45 -05:00
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.
This commit is contained in:
@@ -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<? 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(classpath);
|
||||
spec.classpath(getForkedFernflowerClasspath(project));
|
||||
action.execute(spec);
|
||||
});
|
||||
}
|
||||
|
||||
private static Set<Configuration> getForkedFernflowerClasspath(Project project) {
|
||||
Set<Configuration> allConfigurations = new HashSet<>();
|
||||
Project p = project;
|
||||
|
||||
do {
|
||||
allConfigurations.addAll(p.getBuildscript().getConfigurations());
|
||||
p = p.getRootProject();
|
||||
} while (p != p.getRootProject());
|
||||
|
||||
return allConfigurations;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user