diff options
author | Lluis Sanchez <lluis@xamarin.com> | 2014-01-20 19:32:53 +0400 |
---|---|---|
committer | Lluis Sanchez Gual <lluis@xamarin.com> | 2014-10-21 18:39:14 +0400 |
commit | f73b2a9990495587d514aa1856919c21170a3940 (patch) | |
tree | 9842411ee8644ead5915a715ee7e53984a601df4 /main/src/addins/MonoDeveloperExtensions/MonoSolutionItemHandler.cs | |
parent | a2046b6331a271e8203df7d3d0f14500d33d60fa (diff) |
Initial drop of the new project model
Diffstat (limited to 'main/src/addins/MonoDeveloperExtensions/MonoSolutionItemHandler.cs')
-rw-r--r-- | main/src/addins/MonoDeveloperExtensions/MonoSolutionItemHandler.cs | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/main/src/addins/MonoDeveloperExtensions/MonoSolutionItemHandler.cs b/main/src/addins/MonoDeveloperExtensions/MonoSolutionItemHandler.cs index d43e15eb86..9636ac7e1c 100644 --- a/main/src/addins/MonoDeveloperExtensions/MonoSolutionItemHandler.cs +++ b/main/src/addins/MonoDeveloperExtensions/MonoSolutionItemHandler.cs @@ -36,6 +36,7 @@ using MonoDevelop.Core.ProgressMonitoring; using MonoDevelop.Ide; using MonoDevelop.Projects; using MonoDevelop.Projects.Extensions; +using System.Threading.Tasks; namespace MonoDeveloper { @@ -73,8 +74,9 @@ namespace MonoDeveloper } } - public void Save (MonoDevelop.Core.IProgressMonitor monitor) + public Task Save (MonoDevelop.Core.ProgressMonitor monitor) { + return Task.FromResult (0); } internal void Read (MonoMakefile mkfile) @@ -171,7 +173,7 @@ namespace MonoDeveloper static Regex regexError = new Regex (@"^(\s*(?<file>.*)\((?<line>\d*)(,(?<column>\d*[\+]*))?\)(:|)\s+)*(?<level>\w+)\s*(?<number>.*):\s(?<message>.*)", RegexOptions.Compiled | RegexOptions.ExplicitCapture); - public BuildResult RunTarget (MonoDevelop.Core.IProgressMonitor monitor, string target, ConfigurationSelector configuration) + public Task<BuildResult> RunTarget (MonoDevelop.Core.ProgressMonitor monitor, string target, ConfigurationSelector configuration) { if (target == ProjectService.BuildTarget) target = "all"; @@ -180,28 +182,30 @@ namespace MonoDeveloper DotNetProjectConfiguration conf = (DotNetProjectConfiguration) project.GetConfiguration (configuration); - using (var output = new StringWriter ()) { - using (var tw = new LogTextWriter ()) { - tw.ChainWriter (output); - tw.ChainWriter (monitor.Log); + return Task<BuildResult>.Factory.StartNew (delegate { + using (var output = new StringWriter ()) { + using (var tw = new LogTextWriter ()) { + tw.ChainWriter (output); + tw.ChainWriter (monitor.Log); - using (ProcessWrapper proc = Runtime.ProcessService.StartProcess ("make", "PROFILE=" + conf.Id + " " + target, conf.OutputDirectory, monitor.Log, tw, null)) - proc.WaitForOutput (); + using (ProcessWrapper proc = Runtime.ProcessService.StartProcess ("make", "PROFILE=" + conf.Id + " " + target, conf.OutputDirectory, monitor.Log, tw, null)) + proc.WaitForOutput (); - tw.UnchainWriter (output); - tw.UnchainWriter (monitor.Log); + tw.UnchainWriter (output); + tw.UnchainWriter (monitor.Log); - CompilerResults cr = new CompilerResults (null); - string[] lines = output.ToString().Split ('\n'); - foreach (string line in lines) { - CompilerError err = CreateErrorFromString (line); - if (err != null) cr.Errors.Add (err); - } + CompilerResults cr = new CompilerResults (null); + string[] lines = output.ToString ().Split ('\n'); + foreach (string line in lines) { + CompilerError err = CreateErrorFromString (line); + if (err != null) + cr.Errors.Add (err); + } - return new BuildResult (cr, output.ToString()); + return new BuildResult (cr, output.ToString ()); + } } - } - + }); } private CompilerError CreateErrorFromString (string error_string) |