X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2FMicrosoft.Build.Tasks%2FMicrosoft.Build.Tasks%2FVbc.cs;h=81fa3cd7eb486c7f3e021599f66fe64260fd450d;hb=aa6a91981b5df2d215ffdaefcfb9e92409d133ca;hp=66c0889ce9c4e5cf7f3075ae36609a2128a0fbb3;hpb=11fceb0024ac3677d86a3e5b76897e2f3fab4c47;p=mono.git diff --git a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/Vbc.cs b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/Vbc.cs index 66c0889ce9c..81fa3cd7eb4 100644 --- a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/Vbc.cs +++ b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/Vbc.cs @@ -31,9 +31,11 @@ using System; using System.IO; using System.Text; +using System.Text.RegularExpressions; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; +using Mono.XBuild.Utilities; namespace Microsoft.Build.Tasks { @@ -151,9 +153,53 @@ namespace Microsoft.Build.Tasks { [MonoTODO] protected override bool ValidateParameters () { - throw new NotImplementedException (); + return true; } - + + protected override void LogEventsFromTextOutput (string singleLine, MessageImportance importance) + { + singleLine = singleLine.Trim (); + if (singleLine.Length == 0) + return; + + // When IncludeDebugInformation is true, prevents the debug symbols stats from braeking this. + if (singleLine.StartsWith ("WROTE SYMFILE") || + singleLine.StartsWith ("OffsetTable") || + singleLine.StartsWith ("Compilation succeeded") || + singleLine.StartsWith ("Compilation failed")) + return; + + Match match = ErrorRegex.Match (singleLine); + if (!match.Success) { + Log.LogMessage (importance, singleLine); + return; + } + + string filename = match.Result ("${file}") ?? ""; + + string line = match.Result ("${line}"); + int lineNumber = !string.IsNullOrEmpty (line) ? Int32.Parse (line) : 0; + + string col = match.Result ("${column}"); + int columnNumber = 0; + if (!string.IsNullOrEmpty (col)) + columnNumber = col.IndexOf ("+") >= 0 ? -1 : Int32.Parse (col); + + string category = match.Result ("${level}"); + string code = match.Result ("${number}"); + string text = match.Result ("${message}"); + + if (String.Compare (category, "warning", StringComparison.OrdinalIgnoreCase) == 0) { + Log.LogWarning (null, code, null, filename, lineNumber, columnNumber, -1, + -1, text, null); + } else if (String.Compare (category, "error", StringComparison.OrdinalIgnoreCase) == 0) { + Log.LogError (null, code, null, filename, lineNumber, columnNumber, -1, + -1, text, null); + } else { + Log.LogMessage (importance, singleLine); + } + } + [MonoTODO] public string BaseAddress { get { return (string) Bag ["BaseAddress"]; } @@ -258,7 +304,7 @@ namespace Microsoft.Build.Tasks { [MonoTODO] protected override string ToolName { - get { return Utilities.RunningOnWindows ? "vbnc.bat" : "vbnc"; } + get { return MSBuildUtils.RunningOnWindows ? "vbnc.bat" : "vbnc"; } } [MonoTODO] @@ -284,6 +330,20 @@ namespace Microsoft.Build.Tasks { get { return (string) Bag ["WarningsNotAsErrors"]; } set { Bag ["WarningsNotAsErrors"] = value; } } + + // from md's VBBindingCompilerServices.cs + //matches "/home/path/Default.aspx.vb (40,31) : Error VBNC30205: Expected end of statement." + //and "Error : VBNC99999: vbnc crashed nearby this location in the source code." + //and "Error : VBNC99999: Unexpected error: Object reference not set to an instance of an object" + static Regex errorRegex; + static Regex ErrorRegex { + get { + if (errorRegex == null) + errorRegex = new Regex (@"^\s*((?.*)\s?\((?\d*)(,(?\d*))?\) : )?(?\w+) :? ?(?[^:]*): (?.*)$", RegexOptions.Compiled | RegexOptions.ExplicitCapture); + return errorRegex; + } + } + } }