diff options
author | Michael Hutchinson <mhutch@xamarin.com> | 2014-02-14 02:12:46 +0400 |
---|---|---|
committer | Michael Hutchinson <mhutch@xamarin.com> | 2014-02-14 10:45:44 +0400 |
commit | e41c1c8b9e78eb99b977aa180611fc0b8fe5b5fc (patch) | |
tree | 33313eeb9dfccb5c2fc31687ed71d5eaefc2dc67 /main/src/core/MonoDevelop.Projects.Formats.MSBuild | |
parent | 63f8ecfff223bcc52ec64db9b8b677470c6e1ee1 (diff) |
[MSBuild] Send more MSBuild error details back to MD
End line/col, help keywords etc - though we don't use it yet.
Diffstat (limited to 'main/src/core/MonoDevelop.Projects.Formats.MSBuild')
4 files changed, 44 insertions, 53 deletions
diff --git a/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/LocalLogger.cs b/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/LocalLogger.cs index 9aa8cf14e1..d53463f249 100644 --- a/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/LocalLogger.cs +++ b/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/LocalLogger.cs @@ -36,11 +36,11 @@ namespace MonoDevelop.Projects.Formats.MSBuild { IEventSource eventSource; readonly List<MSBuildResult> results = new List<MSBuildResult> (); - string basePath; + readonly string projectFile; - public LocalLogger (string basePath) + public LocalLogger (string projectFile) { - this.basePath = basePath; + this.projectFile = projectFile; } public List<MSBuildResult> BuildResult { @@ -62,18 +62,20 @@ namespace MonoDevelop.Projects.Formats.MSBuild void EventSourceWarningRaised (object sender, BuildWarningEventArgs e) { - string file = e.File; - if (file != null) - file = Path.GetFullPath (Path.Combine (basePath, file)); - results.Add (new MSBuildResult (true, file, e.LineNumber, e.ColumnNumber, e.Code, e.Message)); + results.Add (new MSBuildResult ( + e.ProjectFile ?? projectFile, true, e.Subcategory, e.Code, e.File, + e.LineNumber, e.ColumnNumber, e.ColumnNumber, e.EndLineNumber, + e.Message, e.HelpKeyword) + ); } void EventSourceErrorRaised (object sender, BuildErrorEventArgs e) { - string file = e.File; - if (file != null) - file = Path.GetFullPath (Path.Combine (basePath, file)); - results.Add (new MSBuildResult (false, file, e.LineNumber, e.ColumnNumber, e.Code, e.Message)); + results.Add (new MSBuildResult ( + e.ProjectFile ?? projectFile, false, e.Subcategory, e.Code, e.File, + e.LineNumber, e.ColumnNumber, e.ColumnNumber, e.EndLineNumber, + e.Message, e.HelpKeyword) + );; } } } diff --git a/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/MSBuildResult.cs b/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/MSBuildResult.cs index 8f248b0c66..7cbfacee75 100644 --- a/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/MSBuildResult.cs +++ b/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/MSBuildResult.cs @@ -25,56 +25,41 @@ // THE SOFTWARE. using System; +using System.Text; namespace MonoDevelop.Projects.Formats.MSBuild { [Serializable] public class MSBuildResult { - public MSBuildResult (bool isWarning, string file, int line, int column, string code, string message) + public MSBuildResult ( + string projectFile, bool isWarning, string subcategory, string code, string file, + int lineNumber, int columnNumber, int endLineNumber, int endColumnNumber, + string message, string helpKeyword) { + ProjectFile = projectFile; IsWarning = isWarning; - File = file; - Line = line; - Column = column; + Subcategory = subcategory; Code = code; + File = file; + LineNumber = lineNumber; + ColumnNumber = columnNumber; + EndLineNumber = endLineNumber; + EndColumnNumber = endColumnNumber; Message = message; + HelpKeyword = helpKeyword; } - public bool IsWarning { - get{ return isWarning; } - set{ isWarning = value; } - } - bool isWarning; - - public string File { - get{ return file; } - set{ file = value; } - } - string file; - - public int Line { - get{ return line; } - set{ line = value; } - } - int line; - - public int Column { - get{ return column; } - set{ column = value; } - } - int column; - - public string Code { - get{ return code; } - set{ code = value; } - } - string code; - - public string Message { - get{ return message; } - set{ message = value; } - } - string message; + public string ProjectFile { get; set; } + public bool IsWarning { get; set; } + public string Subcategory { get; set; } + public string Code { get; set; } + public string File { get; set; } + public int LineNumber { get; set; } + public int ColumnNumber { get; set; } + public int EndLineNumber { get; set; } + public int EndColumnNumber { get; set; } + public string Message { get; set; } + public string HelpKeyword { get; set; } } } diff --git a/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/ProjectBuilder.cs b/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/ProjectBuilder.cs index fe80c4cd0c..7913085628 100644 --- a/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/ProjectBuilder.cs +++ b/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/ProjectBuilder.cs @@ -83,7 +83,7 @@ namespace MonoDevelop.Projects.Formats.MSBuild var project = SetupProject (configurations);
currentLogWriter = logWriter;
- LocalLogger logger = new LocalLogger (Path.GetDirectoryName (file)); + var logger = new LocalLogger (Path.GetDirectoryName (file)); buildEngine.Engine.UnregisterAllLoggers ();
buildEngine.Engine.RegisterLogger (logger); buildEngine.Engine.RegisterLogger (consoleLogger);
@@ -96,7 +96,11 @@ namespace MonoDevelop.Projects.Formats.MSBuild result = logger.BuildResult.ToArray ();
} catch (InvalidProjectFileException ex) { - result = new MSBuildResult[] { new MSBuildResult (false, ex.ProjectFile ?? file, ex.LineNumber, ex.ColumnNumber, ex.ErrorCode, ex.Message) };
+ var r = new MSBuildResult ( + file, false, ex.ErrorSubcategory, ex.ErrorCode, ex.ProjectFile, + ex.LineNumber, ex.ColumnNumber, ex.EndLineNumber, ex.EndColumnNumber, + ex.BaseMessage, ex.HelpKeyword); + result = new [] { r }; } finally {
currentLogWriter = null;
}
diff --git a/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/ProjectBuilder.v4.0.cs b/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/ProjectBuilder.v4.0.cs index 8ca033df91..35f91755e8 100644 --- a/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/ProjectBuilder.v4.0.cs +++ b/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/ProjectBuilder.v4.0.cs @@ -85,7 +85,7 @@ namespace MonoDevelop.Projects.Formats.MSBuild var project = SetupProject (configurations);
currentLogWriter = logWriter;
- LocalLogger logger = new LocalLogger (Path.GetDirectoryName (file));
+ var logger = new LocalLogger (file);
engine.UnregisterAllLoggers ();
engine.RegisterLogger (logger);
engine.RegisterLogger (consoleLogger);
|