Revert some of the changes to genSource's.
More work is needed to fix all the issues with it but its not really something I want to get into right now.dev/0.11
parent
c02f436123
commit
43a6b0f65f
|
@ -24,10 +24,14 @@
|
||||||
|
|
||||||
package net.fabricmc.loom.decompilers.fernflower;
|
package net.fabricmc.loom.decompilers.fernflower;
|
||||||
|
|
||||||
|
import java.net.URL;
|
||||||
import java.net.URLClassLoader;
|
import java.net.URLClassLoader;
|
||||||
|
|
||||||
import org.gradle.api.Action;
|
import org.gradle.api.Action;
|
||||||
import org.gradle.api.Project;
|
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.process.ExecResult;
|
import org.gradle.process.ExecResult;
|
||||||
import org.gradle.process.JavaExecSpec;
|
import org.gradle.process.JavaExecSpec;
|
||||||
|
|
||||||
|
@ -40,8 +44,27 @@ import org.gradle.process.JavaExecSpec;
|
||||||
public class ForkingJavaExec {
|
public class ForkingJavaExec {
|
||||||
public static ExecResult javaexec(Project project, Action<? super JavaExecSpec> action) {
|
public static ExecResult javaexec(Project project, Action<? super JavaExecSpec> action) {
|
||||||
return project.javaexec(spec -> {
|
return project.javaexec(spec -> {
|
||||||
spec.classpath((Object[]) ((URLClassLoader) ForkingJavaExec.class.getClassLoader()).getURLs());
|
spec.classpath(getClasspath(project));
|
||||||
action.execute(spec);
|
action.execute(spec);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Object getClasspath(Project project) {
|
||||||
|
if (System.getProperty("fabric.loom.test") != null) {
|
||||||
|
return getTestClasspath();
|
||||||
|
}
|
||||||
|
|
||||||
|
return getRuntimeClasspath(project.getRootProject().getPlugins().hasPlugin("fabric-loom") ? project.getRootProject() : project);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static FileCollection getRuntimeClasspath(Project project) {
|
||||||
|
ConfigurationContainer configurations = project.getBuildscript().getConfigurations();
|
||||||
|
DependencyHandler handler = project.getDependencies();
|
||||||
|
return configurations.getByName("classpath")
|
||||||
|
.plus(configurations.detachedConfiguration(handler.localGroovy()));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static URL[] getTestClasspath() {
|
||||||
|
return ((URLClassLoader) ForkingJavaExec.class.getClassLoader()).getURLs();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,6 +72,8 @@ trait ProjectTestTrait {
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildResult create(String task, String gradleVersion = "6.8.3") {
|
BuildResult create(String task, String gradleVersion = "6.8.3") {
|
||||||
|
System.setProperty("fabric.loom.test", "true")
|
||||||
|
|
||||||
GradleRunner.create()
|
GradleRunner.create()
|
||||||
.withProjectDir(testProjectDir)
|
.withProjectDir(testProjectDir)
|
||||||
.withArguments(task, "--stacktrace", "--warning-mode", warningMode(gradleVersion), "--gradle-user-home", gradleHomeDirectory(gradleVersion))
|
.withArguments(task, "--stacktrace", "--warning-mode", warningMode(gradleVersion), "--gradle-user-home", gradleHomeDirectory(gradleVersion))
|
||||||
|
|
Loading…
Reference in New Issue