Skip to content

Commit

Permalink
added option to create remapped server jar file
Browse files Browse the repository at this point in the history
  • Loading branch information
0uti committed Apr 2, 2022
1 parent e5d29c3 commit 6d572f9
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 27 deletions.
67 changes: 45 additions & 22 deletions BuildTools/BuildTools.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion BuildTools/BuildTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public BuildTools(Guid guid, Job job) {
// Run BuildTools Button Clicked
private void RunBT_Click(object sender, EventArgs e) {
bool update = autoUpdateCB.Checked;
bool remapped = checkRemapped.Checked;
string version;
if (versionBox.SelectedIndex == 0) {
version = "latest";
Expand All @@ -85,7 +86,7 @@ private void RunBT_Click(object sender, EventArgs e) {
}

Thread thread = new Thread(delegate() {
_runner.RunBuildTools(update, version);
_runner.RunBuildTools(update, version, remapped);
Enable();
ProgressHide();
});
Expand Down
15 changes: 11 additions & 4 deletions BuildTools/Runner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ public bool UpdateJar()
/// </summary>
/// <param name="autoUpdate">If true, this will first call <see cref="UpdateJar()"/> Before continuing.</param>
/// <param name="version">Version to build.</param>
public void RunBuildTools(bool autoUpdate, string version)
public void RunBuildTools(bool autoUpdate, string version, bool remapped)
{
if (!Environment.Is64BitOperatingSystem)
{
Expand Down Expand Up @@ -450,6 +450,15 @@ public void RunBuildTools(bool autoUpdate, string version)
_form.AppendRawText("");
_form.AppendText("Running BuildTools.jar\n");

string startArgs = "--login -c \"git config --global --replace-all core.autocrlf true & " + GetBashJavaPath() + " -jar " + (string)_json["buildTools"]["name"] + " --rev " + version;
if (remapped)
{
startArgs += " --remapped";
}
startArgs += "\"";

_form.AppendText("Arguments: " + startArgs);

// Run Build Tools
using (Process buildProcess = new Process())
{
Expand All @@ -463,9 +472,7 @@ public void RunBuildTools(bool autoUpdate, string version)
buildProcess.StartInfo.RedirectStandardOutput = true;
buildProcess.StartInfo.RedirectStandardError = true;
buildProcess.StartInfo.WorkingDirectory = Path.GetFullPath(Dir);
buildProcess.StartInfo.Arguments =
"--login -c \"git config --global --replace-all core.autocrlf true & " + GetBashJavaPath() + " -jar " +
(string)_json["buildTools"]["name"] + " --rev " + version + "\"";
buildProcess.StartInfo.Arguments = startArgs;
buildProcess.OutputDataReceived += (sender, args) => _form.AppendRawText(args.Data);
buildProcess.ErrorDataReceived += (sender, args) => _form.AppendRawText(args.Data);
buildProcess.Start();
Expand Down

0 comments on commit 6d572f9

Please sign in to comment.