mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-03-28 04:07:01 -05:00
Allow disabling RunConfig appending project path (#1005)
* Fix data gen folder not being added to resources. Closes https://github.com/FabricMC/fabricmc.net/issues/69 * Allow disabling RunConfig appending project path Add a `appendConfigNameWithPath` property to `RunConfigSettings` controlling whether to append the path for non-root projects. Default behaviour is unchanged. --------- Co-authored-by: modmuss50 <modmuss50@gmail.com>
This commit is contained in:
@@ -111,8 +111,11 @@ public class RunConfig {
|
||||
return e;
|
||||
}
|
||||
|
||||
private static void populate(Project project, LoomGradleExtension extension, RunConfig runConfig, String environment) {
|
||||
runConfig.configName += extension.isRootProject() ? "" : " (" + project.getPath() + ")";
|
||||
private static void populate(Project project, LoomGradleExtension extension, RunConfig runConfig, String environment, boolean appendProjectPath) {
|
||||
if (appendProjectPath && !extension.isRootProject()) {
|
||||
runConfig.configName += " (" + project.getPath() + ")";
|
||||
}
|
||||
|
||||
runConfig.eclipseProjectName = project.getExtensions().getByType(EclipseModel.class).getProject().getName();
|
||||
|
||||
runConfig.mainClass = "net.fabricmc.devlaunchinjector.Main";
|
||||
@@ -167,9 +170,10 @@ public class RunConfig {
|
||||
runDir = "run";
|
||||
}
|
||||
|
||||
boolean appendProjectPath = settings.getAppendProjectPathToConfigName();
|
||||
RunConfig runConfig = new RunConfig();
|
||||
runConfig.configName = configName;
|
||||
populate(project, extension, runConfig, environment);
|
||||
populate(project, extension, runConfig, environment, appendProjectPath);
|
||||
runConfig.ideaModuleName = IdeaUtils.getIdeaModuleName(new SourceSetReference(sourceSet, project));
|
||||
runConfig.runDirIdeaUrl = "file://$PROJECT_DIR$/" + runDir;
|
||||
runConfig.runDir = runDir;
|
||||
|
||||
@@ -67,9 +67,20 @@ public class RunConfigSettings implements Named {
|
||||
* The full name of the run configuration, i.e. 'Minecraft Client'.
|
||||
*
|
||||
* <p>By default this is determined from the base name.
|
||||
*
|
||||
* <p>Note: unless the project is the root project (or {@link #appendProjectPathToConfigName} is disabled),
|
||||
* the project path will be appended automatically, e.g. 'Minecraft Client (:some:project)'.
|
||||
*/
|
||||
private String configName;
|
||||
|
||||
/**
|
||||
* Whether to append the project path to the {@link #configName} when {@code project} isn't the root project.
|
||||
*
|
||||
* <p>Warning: could produce ambiguous run config names if disabled, unless used carefully in conjunction with
|
||||
* {@link #configName}.
|
||||
*/
|
||||
private boolean appendProjectPathToConfigName;
|
||||
|
||||
/**
|
||||
* The default main class of the run configuration.
|
||||
*
|
||||
@@ -117,6 +128,7 @@ public class RunConfigSettings implements Named {
|
||||
public RunConfigSettings(Project project, String name) {
|
||||
this.name = name;
|
||||
this.project = project;
|
||||
this.appendProjectPathToConfigName = true;
|
||||
this.extension = LoomGradleExtension.get(project);
|
||||
this.ideConfigGenerated = extension.isRootProject();
|
||||
this.mainClass = project.getObjects().property(String.class).convention(project.provider(() -> {
|
||||
@@ -174,6 +186,14 @@ public class RunConfigSettings implements Named {
|
||||
this.configName = name;
|
||||
}
|
||||
|
||||
public boolean getAppendProjectPathToConfigName() {
|
||||
return appendProjectPathToConfigName;
|
||||
}
|
||||
|
||||
public void setAppendProjectPathToConfigName(boolean append) {
|
||||
appendProjectPathToConfigName = append;
|
||||
}
|
||||
|
||||
public String getDefaultMainClass() {
|
||||
return defaultMainClass;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user