enable error log for basetooltask

optimize nasm.cs
This commit is contained in:
Trivalik_cp 2011-06-23 18:22:01 +00:00
parent d107548297
commit 8b424ca50d
2 changed files with 11 additions and 19 deletions

View file

@ -5,6 +5,7 @@ using System.Text;
using Microsoft.Build.Utilities; using Microsoft.Build.Utilities;
using System.Diagnostics; using System.Diagnostics;
using MessageImportance = Microsoft.Build.Framework.MessageImportance; using MessageImportance = Microsoft.Build.Framework.MessageImportance;
using Microsoft.Build.Framework;
namespace Cosmos.Build.MSBuild namespace Cosmos.Build.MSBuild
{ {
@ -47,39 +48,30 @@ namespace Cosmos.Build.MSBuild
xProcess.BeginErrorReadLine(); xProcess.BeginErrorReadLine();
xProcess.BeginOutputReadLine(); xProcess.BeginOutputReadLine();
xProcess.WaitForExit(15 * 60 * 1000); // wait 15 minutes xProcess.WaitForExit(15 * 60 * 1000); // wait 15 minutes
if (xProcess.ExitCode != 0) if (xProcess.ExitCode != 0) {
{ if (!xProcess.HasExited) {
if (!xProcess.HasExited)
{
xProcess.Kill(); xProcess.Kill();
Log.LogError("{0} timed out.", name); Log.LogError("{0} timed out.", name);
} }
else else {
{
Log.LogError("Error occurred while invoking {0}.", name); Log.LogError("Error occurred while invoking {0}.", name);
} }
return false;
} }
WriteType typ; WriteType typ;
foreach (var xError in mErrors) foreach (var xError in mErrors) {
{
string error = xError; string error = xError;
if(ExtendLineError(xProcess.ExitCode, ref error, out typ)) if(ExtendLineError(xProcess.ExitCode, ref error, out typ)) {
{
Logs(typ, error); Logs(typ, error);
} }
} }
foreach (var xOutput in mOutput) foreach (var xOutput in mOutput) {
{
string output = xOutput; string output = xOutput;
if (ExtendLineError(xProcess.ExitCode, ref output, out typ)) if (ExtendLineError(xProcess.ExitCode, ref output, out typ)) {
{
Logs(typ, output); Logs(typ, output);
} }
} }
return xProcess.ExitCode == 0;
} }
return true;
} }
private List<string> mErrors; private List<string> mErrors;

View file

@ -89,8 +89,8 @@ namespace Cosmos.Build.MSBuild
typ = WriteType.Warning; typ = WriteType.Warning;
uint lineNumber = uint.Parse(split[1]); uint lineNumber = uint.Parse(split[1]);
errorMessage = file + " Line: " + lineNumber + " Code: " + GetLine(InputFile, lineNumber).Trim(); errorMessage = file + " Line: " + lineNumber + " Code: " + GetLine(InputFile, lineNumber).Trim();
this.BuildEngine.LogMessageEvent(new BuildMessageEventArgs(errorMessage,"","",MessageImportance.High)); this.BuildEngine.LogMessageEvent(
new BuildMessageEventArgs(errorMessage, string.Empty, string.Empty, MessageImportance.High));
} }
} }
catch (Exception) catch (Exception)