mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-04-02 05:27:43 -05:00
Co-authored-by: ShadewRG <onankman@gmail.com> Co-authored-by: UndeadCat | Shadew <redgalaxysw@gmail.com> Co-authored-by: liach <7806504+liach@users.noreply.github.com>
This commit is contained in:
@@ -38,6 +38,7 @@ import org.gradle.api.tasks.TaskAction;
|
||||
|
||||
import net.fabricmc.loom.LoomGradleExtension;
|
||||
import net.fabricmc.loom.configuration.ide.RunConfig;
|
||||
import net.fabricmc.loom.configuration.ide.RunConfigSettings;
|
||||
|
||||
// Recommended vscode plugins:
|
||||
// https://marketplace.visualstudio.com/items?itemName=redhat.java
|
||||
@@ -61,8 +62,11 @@ public class GenVsCodeProjectTask extends AbstractLoomTask {
|
||||
}
|
||||
|
||||
VsCodeLaunch launch = new VsCodeLaunch();
|
||||
launch.add(RunConfig.clientRunConfig(project));
|
||||
launch.add(RunConfig.serverRunConfig(project));
|
||||
|
||||
for (RunConfigSettings settings : getExtension().getRuns()) {
|
||||
launch.add(RunConfig.runConfig(project, settings));
|
||||
settings.makeRunDir();
|
||||
}
|
||||
|
||||
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||
String json = gson.toJson(launch);
|
||||
@@ -72,12 +76,6 @@ public class GenVsCodeProjectTask extends AbstractLoomTask {
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("Failed to write launch.json", e);
|
||||
}
|
||||
|
||||
File runDir = new File(project.getRootDir(), extension.runDir);
|
||||
|
||||
if (!runDir.exists()) {
|
||||
runDir.mkdirs();
|
||||
}
|
||||
}
|
||||
|
||||
private static class VsCodeLaunch {
|
||||
@@ -94,7 +92,7 @@ public class GenVsCodeProjectTask extends AbstractLoomTask {
|
||||
public String type = "java";
|
||||
public String name;
|
||||
public String request = "launch";
|
||||
public String cwd = "${workspaceFolder}/run";
|
||||
public String cwd;
|
||||
public String console = "internalConsole";
|
||||
public boolean stopOnEntry = false;
|
||||
public String mainClass;
|
||||
@@ -106,6 +104,7 @@ public class GenVsCodeProjectTask extends AbstractLoomTask {
|
||||
this.mainClass = runConfig.mainClass;
|
||||
this.vmArgs = runConfig.vmArgs;
|
||||
this.args = runConfig.programArgs;
|
||||
this.cwd = "${workspaceFolder}/" + runConfig.runDir;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user