Rename `runs` -> `runConfigs`
parent
409f5f8e93
commit
4daec03a0f
|
@ -80,7 +80,7 @@ public class LoomGradleExtension {
|
||||||
private Mercury[] srcMercuryCache = new Mercury[2];
|
private Mercury[] srcMercuryCache = new Mercury[2];
|
||||||
private Set<File> mixinMappings = Collections.synchronizedSet(new HashSet<>());
|
private Set<File> mixinMappings = Collections.synchronizedSet(new HashSet<>());
|
||||||
|
|
||||||
private NamedDomainObjectContainer<RunConfigSettings> runs;
|
private NamedDomainObjectContainer<RunConfigSettings> runConfigs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loom will generate a new genSources task (with a new name, based off of {@link LoomDecompiler#name()})
|
* Loom will generate a new genSources task (with a new name, based off of {@link LoomDecompiler#name()})
|
||||||
|
@ -117,7 +117,7 @@ public class LoomGradleExtension {
|
||||||
this.project = project;
|
this.project = project;
|
||||||
this.autoGenIDERuns = isRootProject();
|
this.autoGenIDERuns = isRootProject();
|
||||||
this.unmappedMods = project.files();
|
this.unmappedMods = project.files();
|
||||||
this.runs = project.container(RunConfigSettings.class,
|
this.runConfigs = project.container(RunConfigSettings.class,
|
||||||
baseName -> new RunConfigSettings(project, baseName));
|
baseName -> new RunConfigSettings(project, baseName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,12 +351,12 @@ public class LoomGradleExtension {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiStatus.Experimental
|
@ApiStatus.Experimental
|
||||||
public void runs(Action<NamedDomainObjectContainer<RunConfigSettings>> action) {
|
public void runConfigs(Action<NamedDomainObjectContainer<RunConfigSettings>> action) {
|
||||||
action.execute(runs);
|
action.execute(runConfigs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiStatus.Experimental
|
@ApiStatus.Experimental
|
||||||
public NamedDomainObjectContainer<RunConfigSettings> getRuns() {
|
public NamedDomainObjectContainer<RunConfigSettings> getRunConfigs() {
|
||||||
return runs;
|
return runConfigs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ public class SetupIntelijRunConfigs {
|
||||||
runConfigsDir.mkdirs();
|
runConfigsDir.mkdirs();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (RunConfigSettings settings : extension.getRuns()) {
|
for (RunConfigSettings settings : extension.getRunConfigs()) {
|
||||||
RunConfig config = RunConfig.runConfig(project, settings);
|
RunConfig config = RunConfig.runConfig(project, settings);
|
||||||
String name = config.configName.replaceAll("[^a-zA-Z0-9$_]", "_");
|
String name = config.configName.replaceAll("[^a-zA-Z0-9$_]", "_");
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class GenEclipseRunsTask extends AbstractLoomTask {
|
||||||
EclipseModel eclipseModel = getProject().getExtensions().getByType(EclipseModel.class);
|
EclipseModel eclipseModel = getProject().getExtensions().getByType(EclipseModel.class);
|
||||||
LoomGradleExtension extension = getExtension();
|
LoomGradleExtension extension = getExtension();
|
||||||
|
|
||||||
for (RunConfigSettings settings : extension.getRuns()) {
|
for (RunConfigSettings settings : extension.getRunConfigs()) {
|
||||||
String name = settings.getName();
|
String name = settings.getName();
|
||||||
|
|
||||||
File configs = new File(getProject().getRootDir(), eclipseModel.getProject().getName() + "_" + name + ".launch");
|
File configs = new File(getProject().getRootDir(), eclipseModel.getProject().getName() + "_" + name + ".launch");
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class GenIdeaProjectTask extends AbstractLoomTask {
|
||||||
throw new RuntimeException("Failed to generate IntelliJ run configurations (runManager was not found)");
|
throw new RuntimeException("Failed to generate IntelliJ run configurations (runManager was not found)");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (RunConfigSettings settings : getExtension().getRuns()) {
|
for (RunConfigSettings settings : getExtension().getRunConfigs()) {
|
||||||
runManager.appendChild(RunConfig.runConfig(project, settings).genRuns(runManager));
|
runManager.appendChild(RunConfig.runConfig(project, settings).genRuns(runManager));
|
||||||
settings.makeRunDir();
|
settings.makeRunDir();
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ public class GenVsCodeProjectTask extends AbstractLoomTask {
|
||||||
|
|
||||||
VsCodeLaunch launch = new VsCodeLaunch();
|
VsCodeLaunch launch = new VsCodeLaunch();
|
||||||
|
|
||||||
for (RunConfigSettings settings : getExtension().getRuns()) {
|
for (RunConfigSettings settings : getExtension().getRunConfigs()) {
|
||||||
launch.add(RunConfig.runConfig(project, settings));
|
launch.add(RunConfig.runConfig(project, settings));
|
||||||
settings.makeRunDir();
|
settings.makeRunDir();
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,9 +86,9 @@ public final class LoomTasks {
|
||||||
private static void registerRunTasks(TaskContainer tasks, Project project) {
|
private static void registerRunTasks(TaskContainer tasks, Project project) {
|
||||||
LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class);
|
LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class);
|
||||||
|
|
||||||
Preconditions.checkArgument(extension.getRuns().size() == 0, "Run configurations must not be registered before loom");
|
Preconditions.checkArgument(extension.getRunConfigs().size() == 0, "Run configurations must not be registered before loom");
|
||||||
|
|
||||||
extension.getRuns().whenObjectAdded(config -> {
|
extension.getRunConfigs().whenObjectAdded(config -> {
|
||||||
String configName = config.getName();
|
String configName = config.getName();
|
||||||
String taskName = "run" + configName.substring(0, 1).toUpperCase() + configName.substring(1);
|
String taskName = "run" + configName.substring(0, 1).toUpperCase() + configName.substring(1);
|
||||||
|
|
||||||
|
@ -102,8 +102,8 @@ public final class LoomTasks {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
extension.getRuns().create("client", RunConfigSettings::client);
|
extension.getRunConfigs().create("client", RunConfigSettings::client);
|
||||||
extension.getRuns().create("server", RunConfigSettings::server);
|
extension.getRunConfigs().create("server", RunConfigSettings::server);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void registerDecompileTasks(TaskContainer tasks, Project project) {
|
private static void registerDecompileTasks(TaskContainer tasks, Project project) {
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class RunClientTask extends AbstractRunTask {
|
||||||
public RunClientTask() {
|
public RunClientTask() {
|
||||||
super(project -> {
|
super(project -> {
|
||||||
LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class);
|
LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class);
|
||||||
return RunConfig.runConfig(project, extension.getRuns().getByName("client"));
|
return RunConfig.runConfig(project, extension.getRunConfigs().getByName("client"));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class RunServerTask extends AbstractRunTask {
|
||||||
public RunServerTask() {
|
public RunServerTask() {
|
||||||
super(project -> {
|
super(project -> {
|
||||||
LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class);
|
LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class);
|
||||||
return RunConfig.runConfig(project, extension.getRuns().getByName("client"));
|
return RunConfig.runConfig(project, extension.getRunConfigs().getByName("client"));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue