diff --git a/source/Cosmos.Build.MSBuild/BaseToolTask.cs b/source/Cosmos.Build.MSBuild/BaseToolTask.cs index ef2b1b85e6..b5bb3d757c 100644 --- a/source/Cosmos.Build.MSBuild/BaseToolTask.cs +++ b/source/Cosmos.Build.MSBuild/BaseToolTask.cs @@ -94,8 +94,8 @@ protected bool ExecuteTool(string workingDir, string filename, string arguments, xProcessStartInfo.RedirectStandardError = true; xProcessStartInfo.CreateNoWindow = true; - //Log.LogWarning("Running '{0}' with arguments: '{1}'", filename, arguments); - //Log.LogWarning("Working directory = '{0}'", workingDir); + Log.LogCommandLine(string.Format("Executing command line \"{0}\" {1}", filename, arguments)); + Log.LogCommandLine(string.Format("Working directory = '{0}'", workingDir)); using (var xProcess = new Process()) { @@ -130,32 +130,23 @@ protected bool ExecuteTool(string workingDir, string filename, string arguments, Log.LogError("Error occurred while invoking {0}.", name); } } + + LogInfo logContent; foreach (var xError in mErrors) { - Log.LogError(xError); + if (ExtendLineError(xProcess.ExitCode, xError, out logContent)) + { + Logs(logContent); + } } + foreach (var xOutput in mOutput) { - Log.LogMessage(xOutput); - } - - //while (!xProcess.StandardOutput.EndOfStream) - //{ - // var xLine = xProcess.StandardOutput.ReadLine(); - // if (xLine != null) - // { - // Log.LogMessage(xLine); - // } - //} - - //while (!xProcess.StandardError.EndOfStream) - //{ - // var xLine = xProcess.StandardError.ReadLine(); - // if (xLine != null) - // { - // Log.LogError(xLine); - // } - //} + if (ExtendLineOutput(xProcess.ExitCode, xOutput, out logContent)) + { + Logs(logContent); + } + } return xProcess.ExitCode == 0; } @@ -174,7 +165,7 @@ public virtual bool ExtendLineError(int exitCode, string errorMessage, out LogIn return true; } - public virtual bool ExtendLineOutput(int exitCode, ref string errorMessage, out LogInfo log) + public virtual bool ExtendLineOutput(int exitCode, string errorMessage, out LogInfo log) { log = new LogInfo(); log.logType = WriteType.Info; diff --git a/source/Cosmos.Build.MSBuild/IL2CPU.cs b/source/Cosmos.Build.MSBuild/IL2CPU.cs index 5a304ed35f..52a1c4d4c1 100644 --- a/source/Cosmos.Build.MSBuild/IL2CPU.cs +++ b/source/Cosmos.Build.MSBuild/IL2CPU.cs @@ -164,5 +164,13 @@ public override bool Execute() { Log.LogMessage(MessageImportance.High, "IL2CPU task took {0}", xSW.Elapsed); } } + + public override bool ExtendLineError(int exitCode, string errorMessage, out LogInfo log) + { + log = new LogInfo(); + log.logType = WriteType.Error; + log.message = errorMessage; + return true; + } } }