|
@@ -7,6 +7,7 @@ using System.IO;
|
|
|
using System.Linq;
|
|
|
using System.Text;
|
|
|
using System.Threading.Tasks;
|
|
|
+using Godot;
|
|
|
using GodotTools.BuildLogger;
|
|
|
using GodotTools.Utils;
|
|
|
|
|
@@ -22,9 +23,11 @@ namespace GodotTools.Build
|
|
|
if (dotnetPath == null)
|
|
|
throw new FileNotFoundException("Cannot find the dotnet executable.");
|
|
|
|
|
|
+ var editorSettings = GodotSharpEditor.Instance.GetEditorInterface().GetEditorSettings();
|
|
|
+
|
|
|
var startInfo = new ProcessStartInfo(dotnetPath);
|
|
|
|
|
|
- BuildArguments(buildInfo, startInfo.ArgumentList);
|
|
|
+ BuildArguments(buildInfo, startInfo.ArgumentList, editorSettings);
|
|
|
|
|
|
string launchMessage = startInfo.GetCommandLineDisplay(new StringBuilder("Running: ")).ToString();
|
|
|
stdOutHandler?.Invoke(launchMessage);
|
|
@@ -35,6 +38,8 @@ namespace GodotTools.Build
|
|
|
startInfo.RedirectStandardError = true;
|
|
|
startInfo.UseShellExecute = false;
|
|
|
startInfo.CreateNoWindow = true;
|
|
|
+ startInfo.EnvironmentVariables["DOTNET_CLI_UI_LANGUAGE"]
|
|
|
+ = ((string)editorSettings.GetSetting("interface/editor/editor_language")).Replace('_', '-');
|
|
|
|
|
|
// Needed when running from Developer Command Prompt for VS
|
|
|
RemovePlatformVariable(startInfo.EnvironmentVariables);
|
|
@@ -83,9 +88,11 @@ namespace GodotTools.Build
|
|
|
if (dotnetPath == null)
|
|
|
throw new FileNotFoundException("Cannot find the dotnet executable.");
|
|
|
|
|
|
+ var editorSettings = GodotSharpEditor.Instance.GetEditorInterface().GetEditorSettings();
|
|
|
+
|
|
|
var startInfo = new ProcessStartInfo(dotnetPath);
|
|
|
|
|
|
- BuildPublishArguments(buildInfo, startInfo.ArgumentList);
|
|
|
+ BuildPublishArguments(buildInfo, startInfo.ArgumentList, editorSettings);
|
|
|
|
|
|
string launchMessage = startInfo.GetCommandLineDisplay(new StringBuilder("Running: ")).ToString();
|
|
|
stdOutHandler?.Invoke(launchMessage);
|
|
@@ -95,6 +102,8 @@ namespace GodotTools.Build
|
|
|
startInfo.RedirectStandardOutput = true;
|
|
|
startInfo.RedirectStandardError = true;
|
|
|
startInfo.UseShellExecute = false;
|
|
|
+ startInfo.EnvironmentVariables["DOTNET_CLI_UI_LANGUAGE"]
|
|
|
+ = ((string)editorSettings.GetSetting("interface/editor/editor_language")).Replace('_', '-');
|
|
|
|
|
|
// Needed when running from Developer Command Prompt for VS
|
|
|
RemovePlatformVariable(startInfo.EnvironmentVariables);
|
|
@@ -124,7 +133,8 @@ namespace GodotTools.Build
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private static void BuildArguments(BuildInfo buildInfo, Collection<string> arguments)
|
|
|
+ private static void BuildArguments(BuildInfo buildInfo, Collection<string> arguments,
|
|
|
+ EditorSettings editorSettings)
|
|
|
{
|
|
|
// `dotnet clean` / `dotnet build` commands
|
|
|
arguments.Add(buildInfo.OnlyClean ? "clean" : "build");
|
|
@@ -150,12 +160,14 @@ namespace GodotTools.Build
|
|
|
arguments.Add(buildInfo.Configuration);
|
|
|
|
|
|
// Verbosity
|
|
|
- arguments.Add("-v");
|
|
|
- arguments.Add("normal");
|
|
|
+ AddVerbosityArguments(buildInfo, arguments, editorSettings);
|
|
|
|
|
|
// Logger
|
|
|
AddLoggerArgument(buildInfo, arguments);
|
|
|
|
|
|
+ // Binary log
|
|
|
+ AddBinaryLogArgument(buildInfo, arguments, editorSettings);
|
|
|
+
|
|
|
// Custom properties
|
|
|
foreach (var customProperty in buildInfo.CustomProperties)
|
|
|
{
|
|
@@ -163,7 +175,8 @@ namespace GodotTools.Build
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private static void BuildPublishArguments(BuildInfo buildInfo, Collection<string> arguments)
|
|
|
+ private static void BuildPublishArguments(BuildInfo buildInfo, Collection<string> arguments,
|
|
|
+ EditorSettings editorSettings)
|
|
|
{
|
|
|
arguments.Add("publish"); // `dotnet publish` command
|
|
|
|
|
@@ -193,12 +206,14 @@ namespace GodotTools.Build
|
|
|
arguments.Add("true");
|
|
|
|
|
|
// Verbosity
|
|
|
- arguments.Add("-v");
|
|
|
- arguments.Add("normal");
|
|
|
+ AddVerbosityArguments(buildInfo, arguments, editorSettings);
|
|
|
|
|
|
// Logger
|
|
|
AddLoggerArgument(buildInfo, arguments);
|
|
|
|
|
|
+ // Binary log
|
|
|
+ AddBinaryLogArgument(buildInfo, arguments, editorSettings);
|
|
|
+
|
|
|
// Custom properties
|
|
|
foreach (var customProperty in buildInfo.CustomProperties)
|
|
|
{
|
|
@@ -213,6 +228,25 @@ namespace GodotTools.Build
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private static void AddVerbosityArguments(BuildInfo buildInfo, Collection<string> arguments,
|
|
|
+ EditorSettings editorSettings)
|
|
|
+ {
|
|
|
+ var verbosityLevel =
|
|
|
+ editorSettings.GetSetting(GodotSharpEditor.Settings.VerbosityLevel).As<VerbosityLevelId>();
|
|
|
+ arguments.Add("-v");
|
|
|
+ arguments.Add(verbosityLevel switch
|
|
|
+ {
|
|
|
+ VerbosityLevelId.Quiet => "quiet",
|
|
|
+ VerbosityLevelId.Minimal => "minimal",
|
|
|
+ VerbosityLevelId.Detailed => "detailed",
|
|
|
+ VerbosityLevelId.Diagnostic => "diagnostic",
|
|
|
+ _ => "normal",
|
|
|
+ });
|
|
|
+
|
|
|
+ if ((bool)editorSettings.GetSetting(GodotSharpEditor.Settings.NoConsoleLogging))
|
|
|
+ arguments.Add("-noconlog");
|
|
|
+ }
|
|
|
+
|
|
|
private static void AddLoggerArgument(BuildInfo buildInfo, Collection<string> arguments)
|
|
|
{
|
|
|
string buildLoggerPath = Path.Combine(Internals.GodotSharpDirs.DataEditorToolsDir,
|
|
@@ -222,6 +256,16 @@ namespace GodotTools.Build
|
|
|
$"-l:{typeof(GodotBuildLogger).FullName},{buildLoggerPath};{buildInfo.LogsDirPath}");
|
|
|
}
|
|
|
|
|
|
+ private static void AddBinaryLogArgument(BuildInfo buildInfo, Collection<string> arguments,
|
|
|
+ EditorSettings editorSettings)
|
|
|
+ {
|
|
|
+ if (!(bool)editorSettings.GetSetting(GodotSharpEditor.Settings.CreateBinaryLog))
|
|
|
+ return;
|
|
|
+
|
|
|
+ arguments.Add($"-bl:{Path.Combine(buildInfo.LogsDirPath, "msbuild.binlog")}");
|
|
|
+ arguments.Add("-ds:False"); // Honestly never understood why -bl also switches -ds on.
|
|
|
+ }
|
|
|
+
|
|
|
private static void RemovePlatformVariable(StringDictionary environmentVariables)
|
|
|
{
|
|
|
// EnvironmentVariables is case sensitive? Seriously?
|