Perhaps let's not include javaexec helpers

Signed-off-by: shedaniel <daniel@shedaniel.me>
This commit is contained in:
shedaniel
2021-12-02 19:59:08 +08:00
parent ed331c87a6
commit 20b97a7326

View File

@@ -24,14 +24,7 @@
package net.fabricmc.loom.api.decompilers.architectury;
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.logging.Logger;
import org.gradle.process.ExecResult;
import org.gradle.process.JavaExecSpec;
import net.fabricmc.loom.task.GenerateSourcesTask;
@@ -39,23 +32,4 @@ public interface ArchitecturyLoomDecompiler {
String name();
void decompile(Logger logger, GenerateSourcesTask.DecompileParams params);
static ExecResult javaexec(Project project, Action<? super JavaExecSpec> action) {
return project.javaexec(spec -> {
spec.classpath(getClasspath(project));
action.execute(spec);
});
}
private static Object getClasspath(Project project) {
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(project.getRootProject().getBuildscript().getConfigurations().getByName("classpath"))
.plus(configurations.detachedConfiguration(handler.localGroovy()));
}
}