Author: mkrueger
Date: 2007-05-23 04:44:10 -0400 (Wed, 23 May 2007)
New Revision: 77824

Modified:
   
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Commands/ProjectCommands.cs
   
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.ExternalTools/ExternalTool.cs
   
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/AbstractBackendBinding.cs
   
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/BackendBindingService.cs
   
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/IBackendBinding.cs
   
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/IProject.cs
   
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/MSBuildProject.cs
   
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/ProjectService.cs
   branches/mkrueger/monodevelop/Extras/CSharpBinding/CSharpBackendBinding.cs
Log:
parsed compiler output.

Modified: 
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Commands/ProjectCommands.cs
===================================================================
--- 
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Commands/ProjectCommands.cs
  2007-05-23 04:31:06 UTC (rev 77823)
+++ 
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Commands/ProjectCommands.cs
  2007-05-23 08:44:10 UTC (rev 77824)
@@ -108,7 +108,7 @@
        
        internal class RunEntryHandler: CommandHandler
        {
-               MonoDevelop.Ide.Projects.IProject entry;
+               MonoDevelop.Ide.Projects.SolutionProject entry;
                
                protected override void Run ()
                {
@@ -344,7 +344,7 @@
                {
                        if 
(MonoDevelop.Ide.Projects.ProjectService.ActiveProject != null) {
                                info.Enabled = 
MonoDevelop.Ide.Projects.ProjectService.ActiveProject != null;
-                               info.Text = info.Description = 
GettextCatalog.GetString ("Clean {0}", Path.GetFileNameWithoutExtension 
(MonoDevelop.Ide.Projects.ProjectService.ActiveProject.FileName));
+                               info.Text = info.Description = 
GettextCatalog.GetString ("Clean {0}", Path.GetFileNameWithoutExtension 
(MonoDevelop.Ide.Projects.ProjectService.ActiveProject.Project.FileName));
                        } else {
                                info.Enabled = false;
                        }

Modified: 
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.ExternalTools/ExternalTool.cs
===================================================================
--- 
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.ExternalTools/ExternalTool.cs
        2007-05-23 04:31:06 UTC (rev 77823)
+++ 
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.ExternalTools/ExternalTool.cs
        2007-05-23 08:44:10 UTC (rev 77824)
@@ -111,7 +111,6 @@
                                                
                        PromptForArguments = 
Boolean.Parse(el["PROMPTFORARGUMENTS"].InnerText);
                        UseOutputPad       = 
Boolean.Parse(el["USEOUTPUTPAD"].InnerText);
-                       
                }
                
                public override string ToString()

Modified: 
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/AbstractBackendBinding.cs
===================================================================
--- 
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/AbstractBackendBinding.cs
   2007-05-23 04:31:06 UTC (rev 77823)
+++ 
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/AbstractBackendBinding.cs
   2007-05-23 08:44:10 UTC (rev 77824)
@@ -54,7 +54,7 @@
                        return null;
                }
                
-               public virtual CompilerResult Compile (List<IProject> projects, 
IProgressMonitor monitor)
+               public virtual CompilerResult Compile (IProject project, 
IProgressMonitor monitor)
                {
                        return null;
                }

Modified: 
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/BackendBindingService.cs
===================================================================
--- 
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/BackendBindingService.cs
    2007-05-23 04:31:06 UTC (rev 77823)
+++ 
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/BackendBindingService.cs
    2007-05-23 08:44:10 UTC (rev 77824)
@@ -62,6 +62,7 @@
                        }
                }
                
+               
                public static BackendBindingCodon GetBackendBindingCodonByGuid 
(string guid)
                {
                        foreach (BackendBindingCodon codon in 
backendBindingCodons) { 
@@ -78,6 +79,12 @@
                                return codon.BackendBinding;
                        return null;
                }
+               public static IBackendBinding GetBackendBinding 
(SolutionProject project)
+               {
+                       if (project != null)
+                               return GetBackendBindingByGuid 
(project.TypeGuid);
+                       return null;
+               }
                
        }
 }

Modified: 
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/IBackendBinding.cs
===================================================================
--- 
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/IBackendBinding.cs
  2007-05-23 04:31:06 UTC (rev 77823)
+++ 
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/IBackendBinding.cs
  2007-05-23 08:44:10 UTC (rev 77824)
@@ -57,7 +57,7 @@
                IProject LoadProject (string fileName);
                IProject CreateProject 
(MonoDevelop.Projects.ProjectCreateInformation info);
                
-               CompilerResult Compile (List<IProject> projects, 
IProgressMonitor monitor);
+               CompilerResult Compile (IProject project, IProgressMonitor 
monitor);
 #endregion
                
        }

Modified: 
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/IProject.cs
===================================================================
--- 
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/IProject.cs
 2007-05-23 04:31:06 UTC (rev 77823)
+++ 
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/IProject.cs
 2007-05-23 08:44:10 UTC (rev 77824)
@@ -92,7 +92,6 @@
                        set;
                }
                
-               CompilerResult Build (IProgressMonitor monitor);
                void Start (IProgressMonitor monitor, ExecutionContext context);
                void Save ();
        }

Modified: 
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/MSBuildProject.cs
===================================================================
--- 
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/MSBuildProject.cs
   2007-05-23 04:31:06 UTC (rev 77823)
+++ 
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/MSBuildProject.cs
   2007-05-23 08:44:10 UTC (rev 77824)
@@ -34,7 +34,6 @@
 using System.Text.RegularExpressions;
 
 using MonoDevelop.Core;
-using MonoDevelop.Core.Execution;
 using MonoDevelop.Ide.Projects.Item;
 
 namespace MonoDevelop.Ide.Projects
@@ -107,73 +106,6 @@
                        this.fileName = fileName;
                }
                
-               string ToOutput (string outputType)
-               {
-                       return outputType.ToLower ();
-               }
-               
-               string GetExtension (string outputType)
-               {
-                       if (outputType.ToLower () == "exe" || 
outputType.ToLower () == "winexe") {
-                               return ".exe";
-                       }
-                       return ".dll";
-               }
-               
-               public CompilerResult Build (IProgressMonitor monitor)
-               {
-                       string responseFileName = Path.GetTempFileName ();
-                       Console.WriteLine ("response file:" + responseFileName);
-                       StreamWriter writer = new StreamWriter 
(responseFileName);
-                       try {
-                               writer.WriteLine ("/noconfig");
-                               writer.WriteLine ("/nologo");
-                               writer.WriteLine ("/codepage:utf8");
-                               writer.WriteLine ("/t:{0}", ToOutput 
(this.OutputType));
-                               if (!String.IsNullOrEmpty 
(this.DefineConstants))
-                                       writer.WriteLine ("/d:{0}", 
this.DefineConstants);
-                               
-                               Console.WriteLine ("Writing Out!!!");
-                               string assemblyName = this.AssemblyName + 
GetExtension (this.OutputType);
-                               if (String.IsNullOrEmpty (this.OutputPath)) {
-                                       writer.WriteLine ("\"/out:{0}\"", 
assemblyName);
-                               } else {
-                                       string path = 
SolutionProject.NormalizePath (this.OutputPath);
-                                       if (!Directory.Exists (Path.Combine 
(BasePath, path))) {
-                                               Directory.CreateDirectory 
(Path.Combine (BasePath, path));
-                                       }
-                                       writer.WriteLine ("\"/out:{0}\"", 
Path.Combine(path, assemblyName));
-                               }
-                               
-                               Console.WriteLine ("Writing items");
-                               foreach (ProjectItem item in this.Items) {
-                                       Console.WriteLine (item);
-                                       if (item is ProjectFile) {
-                                               writer.WriteLine ("\"{0}\"", 
item.Include);
-                                       }
-                               }
-                       } catch (Exception e) {
-                               Console.WriteLine ("error:" + e);
-                       } finally {
-                               writer.Close();
-                       }
-                       
-                       string output = Path.GetTempFileName ();
-                       string error = Path.GetTempFileName ();
-                       
-                       StreamWriter outWriter = new StreamWriter (output);
-                       StreamWriter errWriter = new StreamWriter (error);
-                       try {
-                               ProcessWrapper pw = 
Runtime.ProcessService.StartProcess ("gmcs", "\"@" + responseFileName + "\"", 
BasePath, outWriter, errWriter, delegate {});
-                               pw.WaitForExit ();
-                       } finally {
-                               errWriter.Close ();
-                               outWriter.Close ();
-                       }
-                       
-                       return new CompilerResult();
-               }
-               
                public void Start (IProgressMonitor monitor, ExecutionContext 
context)
                {
                        string path;
@@ -181,8 +113,7 @@
                            path = Path.Combine (BasePath, 
SolutionProject.NormalizePath (this.OutputPath));
                        else 
                                path = BasePath;
-                       Console.WriteLine ("exec: " + (this.AssemblyName + 
GetExtension (this.OutputType)));
-                       Runtime.ProcessService.StartConsoleProcess ( 
Path.Combine(path, this.AssemblyName + GetExtension (this.OutputType)),
+                       Runtime.ProcessService.StartConsoleProcess ( 
Path.Combine(path, this.AssemblyName + ".exe"),
                                                                    "",
                                                                    BasePath,
                                                                    
context.ConsoleFactory.CreateConsole (true),

Modified: 
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/ProjectService.cs
===================================================================
--- 
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/ProjectService.cs
   2007-05-23 04:31:06 UTC (rev 77823)
+++ 
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/ProjectService.cs
   2007-05-23 08:44:10 UTC (rev 77824)
@@ -46,7 +46,7 @@
        public static class ProjectService
        {
                static Solution solution;
-               static IProject activeProject;
+               static SolutionProject activeProject;
                
                public static Solution Solution {
                        get {
@@ -54,7 +54,7 @@
                        }
                }
                
-               public static IProject ActiveProject {
+               public static SolutionProject ActiveProject {
                        get {
                                return activeProject;
                        }
@@ -118,7 +118,6 @@
                        ExecutionContext context = array[2] as ExecutionContext;
 
                        List<CompilerResult> results = new List<CompilerResult> 
();
-                       Console.WriteLine ("1");
                        for (int i = 0; i < solution.Items.Count; ++i) {
                                SolutionProject project = solution.Items[i] as 
SolutionProject;
                                if (project == null)
@@ -128,7 +127,16 @@
                                });
                                try {
                                        monitor.Log.WriteLine 
(GettextCatalog.GetString ("Performing main compilation..."));
-                                       CompilerResult result = 
project.Project.Build (null);
+                                       IBackendBinding backendBinding = 
BackendBindingService.GetBackendBinding (project);
+                                       if (backendBinding == null) {
+                                               monitor.ReportError 
(GettextCatalog.GetString ("Found no backend binding for project."), null);
+                                               continue;
+                                       }
+                                       if (!backendBinding.HasProjectSupport) {
+                                               monitor.ReportError 
(GettextCatalog.GetString ("Backend binding has no project support."), null);
+                                               continue;
+                                       }
+                                       CompilerResult result = 
backendBinding.Compile (project.Project, monitor);
                                        if (result != null) {
                                                results.Add (result);
                                                
Services.DispatchService.GuiDispatch (delegate {
@@ -146,15 +154,12 @@
                                }
                                
                        }
-                       Console.WriteLine ("2");
                
                        monitor.EndTask();
-                       Console.WriteLine ("2.5");
                        Services.DispatchService.GuiDispatch (delegate {
                                BuildDone (monitor, results);
                        });
                        monitor.Dispose ();
-                       Console.WriteLine ("3");
                }
                
                public static IAsyncOperation RebuildSolution ()
@@ -170,7 +175,7 @@
                        return null;
                }
                
-               public static IAsyncOperation BuildProject (IProject project)
+               public static IAsyncOperation BuildProject (SolutionProject 
project)
                {
                        if (currentBuildOperation != null && 
!currentBuildOperation.IsCompleted) {
                                return currentBuildOperation;
@@ -181,35 +186,61 @@
                        Services.DispatchService.ThreadDispatch (new 
StatefulMessageHandler (BuildSolutionAsync), new object[] {project, monitor, 
context});
                        currentBuildOperation = monitor.AsyncOperation;
                        return currentRunOperation;
-                       
-                       project.Build (null);
-                       return null;
                }
                static void BuildProjectAsync (object data)
                {
                        object[] array = (object[])data;
-                       IProject project = array[0] as IProject;
+                       SolutionProject project = array[0] as SolutionProject;
                        if (project == null) 
                                return;
                        IProgressMonitor monitor = array[1] as IProgressMonitor;
                        ExecutionContext context = array[2] as ExecutionContext;
+                       List<CompilerResult> results = new List<CompilerResult> 
();
                        
                        try {
-                               project.Build (null);
+                               Services.DispatchService.GuiDispatch (delegate {
+                                       monitor.BeginStepTask 
(GettextCatalog.GetString ("Build Project {0}", project.Project.Name), 1, 0);
+                               });
+                               monitor.Log.WriteLine (GettextCatalog.GetString 
("Performing main compilation..."));
+                               
+                               IBackendBinding backendBinding = 
BackendBindingService.GetBackendBinding (project);
+                               if (backendBinding == null) {
+                                       monitor.ReportError 
(GettextCatalog.GetString ("Found no backend binding for project."), null);
+                                       return;
+                               }
+                               if (!backendBinding.HasProjectSupport) {
+                                       monitor.ReportError 
(GettextCatalog.GetString ("Backend binding has no project support."), null);
+                                       return;
+                               }
+                               CompilerResult result = backendBinding.Compile 
(project.Project, monitor);
+                               if (result != null) {
+                                       results.Add (result);
+                                       Services.DispatchService.GuiDispatch 
(delegate {
+                                               ReportResult (monitor, result);
+                                       });
+                               } else {
+                                       Services.DispatchService.GuiDispatch 
(delegate {
+                                               monitor.ReportError 
(GettextCatalog.GetString ("Got no result from building."), null);
+                                       });
+                               }
                        } catch (Exception ex) {
                                monitor.ReportError (GettextCatalog.GetString 
("Build failed."), ex);
                        }
+                       monitor.EndTask();
+                       Services.DispatchService.GuiDispatch (delegate {
+                               BuildDone (monitor, results);
+                       });
+                       monitor.Dispose ();
                }
                
-               public static IAsyncOperation RebuildProject (IProject project)
+               public static IAsyncOperation RebuildProject (SolutionProject 
project)
                {
                        if (currentBuildOperation != null && 
!currentBuildOperation.IsCompleted) {
                                return currentBuildOperation;
                        }
-                       
                        return null;
                }
-               public static IAsyncOperation CleanProject (IProject project)
+               public static IAsyncOperation CleanProject (SolutionProject 
project)
                {
                        return null;
                }
@@ -227,8 +258,9 @@
                                monitor.ReportError(String.Format 
(GettextCatalog.GetString("Compilation failed - ") + errorString + ", " + 
warningString, result.Errors, result.Warnings), null);
                        }
                        
-                       foreach (string output in 
result.CompilerResults.Output) 
-                               monitor.Log.WriteLine (output);
+//                     foreach (string output in 
result.CompilerResults.Output) 
+//                             monitor.Log.WriteLine (output);
+                       monitor.Log.WriteLine (result.Output);
                }
                
                static void BuildDone (IProgressMonitor monitor, 
List<CompilerResult> results)
@@ -278,12 +310,12 @@
                                SolutionProject project = item as 
SolutionProject;
                                if (project == null)
                                        continue;
-                               return StartProject (project.Project);
+                               return StartProject (project);
                        }
                        return null;
                }
                
-               public static IAsyncOperation StartProject(IProject project)
+               public static IAsyncOperation StartProject(SolutionProject 
project)
                {
                        if (currentRunOperation != null && 
!currentRunOperation.IsCompleted) {
                                return currentRunOperation;
@@ -300,14 +332,14 @@
                static void StartProjectAsync (object data)
                {
                        object[] array = (object[])data;
-                       IProject project = array[0] as IProject;
+                       SolutionProject project = array[0] as SolutionProject;
                        if (project == null) 
                                return;
                        IProgressMonitor monitor = array[1] as IProgressMonitor;
                        ExecutionContext context = array[2] as ExecutionContext;
                        //OnBeforeStartProject ();
                        try {
-                               project.Start (monitor, context);
+                               project.Project.Start (monitor, context);
                        } catch (Exception ex) {
                                monitor.ReportError (GettextCatalog.GetString 
("Execution failed."), ex);
                        } finally {

Modified: 
branches/mkrueger/monodevelop/Extras/CSharpBinding/CSharpBackendBinding.cs
===================================================================
--- branches/mkrueger/monodevelop/Extras/CSharpBinding/CSharpBackendBinding.cs  
2007-05-23 04:31:06 UTC (rev 77823)
+++ branches/mkrueger/monodevelop/Extras/CSharpBinding/CSharpBackendBinding.cs  
2007-05-23 08:44:10 UTC (rev 77824)
@@ -27,11 +27,17 @@
 //
 
 using System;
+using System.CodeDom.Compiler;
+using System.IO;
+using System.Text;
+using System.Text.RegularExpressions;
 
+using MonoDevelop.Core;
+using MonoDevelop.Core.Execution;
 using MonoDevelop.Ide.Projects;
+using MonoDevelop.Ide.Projects.Item;
 using MonoDevelop.Projects.Parser;
 using MonoDevelop.Projects.CodeGeneration;
-using MonoDevelop.Core;
 
 using CSharpBinding.Parser;
 
@@ -68,5 +74,137 @@
                        return MSBuildProject.Load (fileName);
                }
                
+               string ToOutput (string outputType)
+               {
+                       return outputType.ToLower ();
+               }
+               
+               string GetExtension (string outputType)
+               {
+                       if (outputType.ToLower () == "exe" || 
outputType.ToLower () == "winexe") {
+                               return ".exe";
+                       }
+                       return ".dll";
+               }
+               
+               public override CompilerResult Compile (IProject project, 
IProgressMonitor monitor)
+               {
+                       string responseFileName = Path.GetTempFileName ();
+                       
+                       StreamWriter writer = new StreamWriter 
(responseFileName);
+                       try {
+                               writer.WriteLine ("/noconfig");
+                               writer.WriteLine ("/nologo");
+                               writer.WriteLine ("/codepage:utf8");
+                               writer.WriteLine ("/t:{0}", ToOutput 
(project.OutputType));
+                               if (!String.IsNullOrEmpty 
(project.DefineConstants))
+                                       writer.WriteLine ("/d:{0}", 
project.DefineConstants);
+                               
+                               string assemblyName = project.AssemblyName + 
GetExtension (project.OutputType);
+                               if (String.IsNullOrEmpty (project.OutputPath)) {
+                                       writer.WriteLine ("\"/out:{0}\"", 
assemblyName);
+                               } else {
+                                       string path = 
SolutionProject.NormalizePath (project.OutputPath);
+                                       if (!Directory.Exists (Path.Combine 
(project.BasePath, path))) {
+                                               Directory.CreateDirectory 
(Path.Combine (project.BasePath, path));
+                                       }
+                                       writer.WriteLine ("\"/out:{0}\"", 
Path.Combine(path, assemblyName));
+                               }
+                               
+                               foreach (ProjectItem item in project.Items) {
+                                       Console.WriteLine (item);
+                                       if (item is ProjectFile) {
+                                               writer.WriteLine ("\"{0}\"", 
item.Include);
+                                       }
+                               }
+                       } catch (Exception e) {
+                               Console.WriteLine ("error:" + e);
+                       } finally {
+                               writer.Close();
+                       }
+                       
+                       string output = Path.GetTempFileName ();
+                       string error = Path.GetTempFileName ();
+                       
+                       StreamWriter outWriter = new StreamWriter (output);
+                       StreamWriter errWriter = new StreamWriter (error);
+                       try {
+                               ProcessWrapper pw = 
Runtime.ProcessService.StartProcess ("gmcs", "\"@" + responseFileName + "\"", 
project.BasePath, outWriter, errWriter, delegate {});
+                               pw.WaitForExit ();
+                       } finally {
+                               errWriter.Close ();
+                               outWriter.Close ();
+                       }
+                       
+                       CompilerResult result = ParseOutput (output, error);
+                       
+                       Runtime.FileService.DeleteFile (error);
+                       Runtime.FileService.DeleteFile (output);
+                       Runtime.FileService.DeleteFile (responseFileName);
+                       
+                       return result;
+               }
+               
+               CompilerResult ParseOutput (string stdout, string stderr)
+               {
+                       StringBuilder compilerOutput = new StringBuilder();
+                       CompilerResults cr = new CompilerResults (new 
TempFileCollection ());
+                       foreach (string fileName in new string[] { stdout, 
stderr }) {
+                               StreamReader reader = File.OpenText (fileName);
+                               try {
+                                       while (true) {
+                                               string curLine = 
reader.ReadLine();
+                                               if (curLine == null) {
+                                                       break;
+                                               }
+                                               compilerOutput.Append (curLine);
+                                               compilerOutput.Append 
(Environment.NewLine);
+                                               curLine = curLine.Trim();
+                                               if (curLine.Length == 0) {
+                                                       continue;
+                                               }
+                                               CompilerError error = 
CreateErrorFromString (curLine);
+                                               if (error != null)
+                                                       cr.Errors.Add (error);
+                                       }
+                               } finally {
+                                       reader.Close ();
+                               }
+                       }
+                       return new CompilerResult (cr, compilerOutput.ToString 
());
+               }
+               
+#region Snatched from our codedom code.
+               static Regex regexError = new Regex 
(@"^(\s*(?<file>.*)\((?<line>\d*)(,(?<column>\d*[\+]*))?\)(:|)\s+)*(?<level>\w+)\s*(?<number>.*):\s(?<message>.*)",
 RegexOptions.Compiled | RegexOptions.ExplicitCapture);
+               static CompilerError CreateErrorFromString(string error_string)
+               {
+                       // When IncludeDebugInformation is true, prevents the 
debug symbols stats from braeking this.
+                       if (error_string.StartsWith ("WROTE SYMFILE") ||
+                           error_string.StartsWith ("OffsetTable") ||
+                           error_string.StartsWith ("Compilation succeeded") ||
+                           error_string.StartsWith ("Compilation failed"))
+                               return null;
+
+                       CompilerError error = new CompilerError();
+
+                       Match match=regexError.Match(error_string);
+                       if (!match.Success) return null;
+                       if (String.Empty != match.Result("${file}"))
+                               error.FileName=match.Result("${file}");
+                       if (String.Empty != match.Result("${line}"))
+                               error.Line=Int32.Parse(match.Result("${line}"));
+                       if (String.Empty != match.Result("${column}")) {
+                               if (match.Result("${column}") == "255+")
+                                       error.Column = -1;
+                               else
+                                       
error.Column=Int32.Parse(match.Result("${column}"));
+                       }
+                       if (match.Result("${level}")=="warning")
+                               error.IsWarning=true;
+                       error.ErrorNumber=match.Result("${number}");
+                       error.ErrorText=match.Result("${message}");
+                       return error;
+               }
+#endregion
        }
 }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to