Mono: Fix passing wrong logger assembly path to MSBuild
- Add option to print MSBuild's stdout and stderr instead of redirecting it. This can be enabled by setting the environment variable: Godot_DEBUG_MSBUILD=1
(cherry picked from commit 25f10b3c40
)
This commit is contained in:
parent
84e1551c64
commit
16550339ba
|
@ -78,6 +78,8 @@ namespace GodotSharpTools.Build
|
||||||
|
|
||||||
public bool Build(string loggerAssemblyPath, string loggerOutputDir, string[] customProperties = null)
|
public bool Build(string loggerAssemblyPath, string loggerOutputDir, string[] customProperties = null)
|
||||||
{
|
{
|
||||||
|
bool debugMSBuild = IsDebugMSBuildRequested();
|
||||||
|
|
||||||
List<string> customPropertiesList = new List<string>();
|
List<string> customPropertiesList = new List<string>();
|
||||||
|
|
||||||
if (customProperties != null)
|
if (customProperties != null)
|
||||||
|
@ -92,9 +94,10 @@ namespace GodotSharpTools.Build
|
||||||
|
|
||||||
ProcessStartInfo startInfo = new ProcessStartInfo(GetMSBuildPath(), compilerArgs);
|
ProcessStartInfo startInfo = new ProcessStartInfo(GetMSBuildPath(), compilerArgs);
|
||||||
|
|
||||||
// No console output, thanks
|
bool redirectOutput = !debugMSBuild;
|
||||||
startInfo.RedirectStandardOutput = true;
|
|
||||||
startInfo.RedirectStandardError = true;
|
startInfo.RedirectStandardOutput = redirectOutput;
|
||||||
|
startInfo.RedirectStandardError = redirectOutput;
|
||||||
startInfo.UseShellExecute = false;
|
startInfo.UseShellExecute = false;
|
||||||
|
|
||||||
if (UsingMonoMSBuildOnWindows)
|
if (UsingMonoMSBuildOnWindows)
|
||||||
|
@ -116,8 +119,11 @@ namespace GodotSharpTools.Build
|
||||||
|
|
||||||
process.Start();
|
process.Start();
|
||||||
|
|
||||||
process.BeginOutputReadLine();
|
if (redirectOutput)
|
||||||
process.BeginErrorReadLine();
|
{
|
||||||
|
process.BeginOutputReadLine();
|
||||||
|
process.BeginErrorReadLine();
|
||||||
|
}
|
||||||
|
|
||||||
process.WaitForExit();
|
process.WaitForExit();
|
||||||
|
|
||||||
|
@ -129,6 +135,8 @@ namespace GodotSharpTools.Build
|
||||||
|
|
||||||
public bool BuildAsync(string loggerAssemblyPath, string loggerOutputDir, string[] customProperties = null)
|
public bool BuildAsync(string loggerAssemblyPath, string loggerOutputDir, string[] customProperties = null)
|
||||||
{
|
{
|
||||||
|
bool debugMSBuild = IsDebugMSBuildRequested();
|
||||||
|
|
||||||
if (process != null)
|
if (process != null)
|
||||||
throw new InvalidOperationException("Already in use");
|
throw new InvalidOperationException("Already in use");
|
||||||
|
|
||||||
|
@ -146,9 +154,10 @@ namespace GodotSharpTools.Build
|
||||||
|
|
||||||
ProcessStartInfo startInfo = new ProcessStartInfo(GetMSBuildPath(), compilerArgs);
|
ProcessStartInfo startInfo = new ProcessStartInfo(GetMSBuildPath(), compilerArgs);
|
||||||
|
|
||||||
// No console output, thanks
|
bool redirectOutput = !debugMSBuild;
|
||||||
startInfo.RedirectStandardOutput = true;
|
|
||||||
startInfo.RedirectStandardError = true;
|
startInfo.RedirectStandardOutput = redirectOutput;
|
||||||
|
startInfo.RedirectStandardError = redirectOutput;
|
||||||
startInfo.UseShellExecute = false;
|
startInfo.UseShellExecute = false;
|
||||||
|
|
||||||
if (UsingMonoMSBuildOnWindows)
|
if (UsingMonoMSBuildOnWindows)
|
||||||
|
@ -171,8 +180,11 @@ namespace GodotSharpTools.Build
|
||||||
|
|
||||||
process.Start();
|
process.Start();
|
||||||
|
|
||||||
process.BeginOutputReadLine();
|
if (redirectOutput)
|
||||||
process.BeginErrorReadLine();
|
{
|
||||||
|
process.BeginOutputReadLine();
|
||||||
|
process.BeginErrorReadLine();
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -220,6 +232,11 @@ namespace GodotSharpTools.Build
|
||||||
Dispose();
|
Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static bool IsDebugMSBuildRequested()
|
||||||
|
{
|
||||||
|
return Environment.GetEnvironmentVariable("GODOT_DEBUG_MSBUILD").Trim() == "1";
|
||||||
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
if (process != null)
|
if (process != null)
|
||||||
|
|
|
@ -527,8 +527,9 @@ void GodotSharpBuilds::BuildProcess::start(bool p_blocking) {
|
||||||
|
|
||||||
// Call Build
|
// Call Build
|
||||||
|
|
||||||
Variant logger_assembly = OS::get_singleton()->get_executable_path().get_base_dir().plus_file(EDITOR_TOOLS_ASSEMBLY_NAME) + ".dll";
|
String logger_assembly_path = GDMono::get_singleton()->get_editor_tools_assembly()->get_path();
|
||||||
Variant logger_output_dir = logs_dir;
|
Variant logger_assembly = ProjectSettings::get_singleton()->globalize_path(logger_assembly_path);
|
||||||
|
Variant logger_output_dir = log_dirpath;
|
||||||
Variant custom_props = build_info.custom_props;
|
Variant custom_props = build_info.custom_props;
|
||||||
|
|
||||||
const Variant *args[3] = { &logger_assembly, &logger_output_dir, &custom_props };
|
const Variant *args[3] = { &logger_assembly, &logger_output_dir, &custom_props };
|
||||||
|
|
Loading…
Reference in New Issue