mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-03-28 04:07:01 -05:00
Supply the configuration to the run Exec directly (#232)
* Supply the configuration to the run Exec directly This allows the implicit task dependencies from project() dependencies to flow into the run tasks. * Make unmappedMods a CFC to track task information Deprecates the old methods, and they should probably be removed with 0.5.
This commit is contained in:
@@ -25,8 +25,6 @@
|
||||
package net.fabricmc.loom.task;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
@@ -37,8 +35,6 @@ import org.gradle.api.Project;
|
||||
import org.gradle.api.tasks.JavaExec;
|
||||
|
||||
import net.fabricmc.loom.LoomGradleExtension;
|
||||
import net.fabricmc.loom.providers.MappingsProvider;
|
||||
import net.fabricmc.loom.util.MinecraftVersionInfo;
|
||||
import net.fabricmc.loom.util.RunConfig;
|
||||
|
||||
public abstract class AbstractRunTask extends JavaExec {
|
||||
@@ -49,6 +45,9 @@ public abstract class AbstractRunTask extends JavaExec {
|
||||
super();
|
||||
setGroup("fabric");
|
||||
this.configProvider = config;
|
||||
|
||||
classpath(getProject().getConfigurations().getByName("runtimeClasspath"));
|
||||
classpath(this.getProject().getExtensions().getByType(LoomGradleExtension.class).getUnmappedModCollection());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -57,23 +56,6 @@ public abstract class AbstractRunTask extends JavaExec {
|
||||
config = configProvider.apply(getProject());
|
||||
}
|
||||
|
||||
LoomGradleExtension extension = this.getProject().getExtensions().getByType(LoomGradleExtension.class);
|
||||
MinecraftVersionInfo minecraftVersionInfo = extension.getMinecraftProvider().getVersionInfo();
|
||||
MappingsProvider mappingsProvider = extension.getMappingsProvider();
|
||||
|
||||
List<String> libs = new ArrayList<>();
|
||||
|
||||
for (File file : getProject().getConfigurations().getByName("runtimeClasspath").getFiles()) {
|
||||
libs.add(file.getAbsolutePath());
|
||||
}
|
||||
|
||||
for (Path file : extension.getUnmappedMods()) {
|
||||
if (Files.isRegularFile(file)) {
|
||||
libs.add(file.toFile().getAbsolutePath());
|
||||
}
|
||||
}
|
||||
|
||||
classpath(libs);
|
||||
List<String> argsSplit = new ArrayList<>();
|
||||
String[] args = config.programArgs.split(" ");
|
||||
int partPos = -1;
|
||||
@@ -103,6 +85,7 @@ public abstract class AbstractRunTask extends JavaExec {
|
||||
}
|
||||
|
||||
args(argsSplit);
|
||||
LoomGradleExtension extension = this.getProject().getExtensions().getByType(LoomGradleExtension.class);
|
||||
setWorkingDir(new File(getProject().getRootDir(), extension.runDir));
|
||||
|
||||
super.exec();
|
||||
@@ -136,7 +119,6 @@ public abstract class AbstractRunTask extends JavaExec {
|
||||
config = configProvider.apply(getProject());
|
||||
}
|
||||
|
||||
LoomGradleExtension extension = this.getProject().getExtensions().getByType(LoomGradleExtension.class);
|
||||
List<String> superArgs = super.getJvmArgs();
|
||||
List<String> args = new ArrayList<>(superArgs != null ? superArgs : Collections.emptyList());
|
||||
args.addAll(Arrays.asList(config.vmArgs.split(" ")));
|
||||
|
||||
Reference in New Issue
Block a user