Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Property for separate run directories #29

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,18 @@ Uncomment this to disable Checkstyle checks (currently wildcard import check).
Leave blank to use the old release type, with -pre designations
""")
public String releaseType = "release";

@Prop(
name = "separateRunDirs",
isSettings = false,
preferPopulated = false,
required = false,
defaultInComment = "false",
docComment = """
Separate run directories into "run/client" for runClient task, and "run/server" for runServer task.
Useful for debugging a server and client simultaneously. If not enabled, it will be in the standard location "run/"
""")
public boolean separateRunDirs = false;
// </editor-fold>
// </editor-fold>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,8 @@ public void apply(GTNHGradlePlugin.@NotNull GTNHExtension gtnh, @NotNull Project
final RunMinecraftTask runClient = tasks.named("runClient", RunMinecraftTask.class)
.get();
final var run = ijClientRun.get();
run.setWorkingDirectory(
runClient.getWorkingDir()
.getAbsolutePath());
File clientFile = new File(runClient.getWorkingDir(), gtnh.configuration.separateRunDirs ? "client" : "");
run.setWorkingDirectory(clientFile.getAbsolutePath());
run.setProgramParameters(quotedJoin(runClient.calculateArgs()));
run.setJvmArgs(
quotedJoin(runClient.calculateJvmArgs()) + ' ' + quotedPropJoin(runClient.getSystemProperties()));
Expand All @@ -192,9 +191,8 @@ public void apply(GTNHGradlePlugin.@NotNull GTNHExtension gtnh, @NotNull Project
final RunMinecraftTask runServer = tasks.named("runServer", RunMinecraftTask.class)
.get();
final var run = ijServerRun.get();
run.setWorkingDirectory(
runServer.getWorkingDir()
.getAbsolutePath());
File serverFile = new File(runServer.getWorkingDir(), gtnh.configuration.separateRunDirs ? "server" : "");
run.setWorkingDirectory(serverFile.getAbsolutePath());
run.setProgramParameters(quotedJoin(runServer.calculateArgs()));
run.setJvmArgs(
quotedJoin(runServer.calculateJvmArgs()) + ' ' + quotedPropJoin(runServer.getSystemProperties()));
Expand Down