mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-04-01 21:17:46 -05:00
Don't add tasks before run to idea anymore for arch
This commit is contained in:
@@ -61,11 +61,12 @@ public class RunConfig {
|
||||
public String configName;
|
||||
public String eclipseProjectName;
|
||||
public String ideaModuleName;
|
||||
public String vscodeProjectName;
|
||||
public String mainClass;
|
||||
public String runDir;
|
||||
public String vmArgs;
|
||||
public String programArgs;
|
||||
public List<String> tasksBeforeRun = new ArrayList<>();
|
||||
public List<String> vscodeBeforeRun = new ArrayList<>();
|
||||
public final Map<String, String> envVariables = new HashMap<>();
|
||||
|
||||
public Element genRuns(Element doc) {
|
||||
@@ -92,25 +93,6 @@ public class RunConfig {
|
||||
}
|
||||
}
|
||||
|
||||
if (!tasksBeforeRun.isEmpty()) {
|
||||
Element methodElement = this.addXml(root, "method", ImmutableMap.of("v", "2"));
|
||||
|
||||
this.addXml(methodElement, "option", ImmutableMap.of("name", "Make", "enabled", "true"));
|
||||
|
||||
for (String s : tasksBeforeRun) {
|
||||
String project = s.substring(0, s.lastIndexOf(':'));
|
||||
String task = s.substring(s.lastIndexOf(':') + 1);
|
||||
this.addXml(methodElement, "option", ImmutableMap.<String, String>builder()
|
||||
.put("name", "Gradle.BeforeRunTask")
|
||||
.put("enabled", "true")
|
||||
.put("tasks", task)
|
||||
.put("externalProjectPath", project)
|
||||
.put("vmOptions", "")
|
||||
.put("scriptParameters", "")
|
||||
.build());
|
||||
}
|
||||
}
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
@@ -145,6 +127,7 @@ public class RunConfig {
|
||||
runConfig.configName += extension.isRootProject() ? "" : " (" + project.getPath() + ")";
|
||||
runConfig.eclipseProjectName = project.getExtensions().getByType(EclipseModel.class).getProject().getName();
|
||||
runConfig.ideaModuleName = getIdeaModuleName(project);
|
||||
runConfig.vscodeProjectName = extension.isRootProject() ? "" : project.getPath();
|
||||
runConfig.runDir = "file://$PROJECT_DIR$/" + extension.runDir;
|
||||
runConfig.vmArgs = "";
|
||||
|
||||
@@ -212,7 +195,7 @@ public class RunConfig {
|
||||
populate(project, extension, ideaClient, "client");
|
||||
ideaClient.vmArgs += getOSClientJVMArgs();
|
||||
ideaClient.vmArgs += " -Dfabric.dli.main=" + getMainClass("client", extension);
|
||||
ideaClient.tasksBeforeRun = new ArrayList<>(extension.getTasksBeforeRun());
|
||||
ideaClient.vscodeBeforeRun = new ArrayList<>(extension.getTasksBeforeRun());
|
||||
|
||||
return ideaClient;
|
||||
}
|
||||
@@ -225,7 +208,7 @@ public class RunConfig {
|
||||
ideaServer.programArgs = "nogui ";
|
||||
populate(project, extension, ideaServer, "server");
|
||||
ideaServer.vmArgs += " -Dfabric.dli.main=" + getMainClass("server", extension);
|
||||
ideaServer.tasksBeforeRun = new ArrayList<>(extension.getTasksBeforeRun());
|
||||
ideaServer.vscodeBeforeRun = new ArrayList<>(extension.getTasksBeforeRun());
|
||||
|
||||
return ideaServer;
|
||||
}
|
||||
@@ -269,16 +252,6 @@ public class RunConfig {
|
||||
|
||||
dummyConfig = dummyConfig.replace("%ENVS%", envs);
|
||||
|
||||
StringBuilder tasksToRun = new StringBuilder();
|
||||
|
||||
for (String s : tasksBeforeRun) {
|
||||
String project = s.substring(0, s.lastIndexOf(':'));
|
||||
String task = s.substring(s.lastIndexOf(':') + 1);
|
||||
tasksToRun.append(" <option name=\"Gradle.BeforeRunTask\" enabled=\"true\" tasks=\"").append(task).append("\" externalProjectPath=\"").append(project).append("\" vmOptions=\"\" scriptParameters=\"\" />");
|
||||
}
|
||||
|
||||
dummyConfig = dummyConfig.replace("%TASKS%", tasksToRun.toString());
|
||||
|
||||
return dummyConfig;
|
||||
}
|
||||
|
||||
|
||||
@@ -186,14 +186,16 @@ public class GenVsCodeProjectTask extends AbstractLoomTask {
|
||||
public Map<String, String> env = new LinkedHashMap<>();
|
||||
public transient List<String> tasksBeforeRun = new ArrayList<>();
|
||||
public String preLaunchTask = null;
|
||||
public String projectName = null;
|
||||
|
||||
VsCodeConfiguration(RunConfig runConfig) {
|
||||
this.name = runConfig.configName;
|
||||
this.mainClass = runConfig.mainClass;
|
||||
this.vmArgs = runConfig.vmArgs;
|
||||
this.args = runConfig.programArgs;
|
||||
this.projectName = runConfig.vscodeProjectName;
|
||||
this.env.putAll(runConfig.envVariables);
|
||||
this.tasksBeforeRun.addAll(runConfig.tasksBeforeRun);
|
||||
this.tasksBeforeRun.addAll(runConfig.vscodeBeforeRun);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/run/" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
%TASKS%
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
||||
|
||||
Reference in New Issue
Block a user