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:
parent
b622544cbe
commit
4a30993da7
1 changed files with 17 additions and 9 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue