diff options
Diffstat (limited to 'main/src/addins/CBinding/Compiler')
-rw-r--r-- | main/src/addins/CBinding/Compiler/CCompiler.cs | 4 | ||||
-rw-r--r-- | main/src/addins/CBinding/Compiler/GNUCompiler.cs | 47 | ||||
-rw-r--r-- | main/src/addins/CBinding/Compiler/ICompiler.cs | 4 |
3 files changed, 26 insertions, 29 deletions
diff --git a/main/src/addins/CBinding/Compiler/CCompiler.cs b/main/src/addins/CBinding/Compiler/CCompiler.cs index b094faf03f..4a92d92bc2 100644 --- a/main/src/addins/CBinding/Compiler/CCompiler.cs +++ b/main/src/addins/CBinding/Compiler/CCompiler.cs @@ -75,9 +75,9 @@ namespace CBinding ProjectFileCollection projectFiles, ProjectPackageCollection packages, CProjectConfiguration configuration, - IProgressMonitor monitor); + ProgressMonitor monitor); - public abstract void Clean (ProjectFileCollection projectFiles, CProjectConfiguration configuration, IProgressMonitor monitor); + public abstract void Clean (ProjectFileCollection projectFiles, CProjectConfiguration configuration, ProgressMonitor monitor); protected abstract void ParseCompilerOutput (string errorString, CompilerResults cr); diff --git a/main/src/addins/CBinding/Compiler/GNUCompiler.cs b/main/src/addins/CBinding/Compiler/GNUCompiler.cs index b75471a9ff..be4a0bc5f8 100644 --- a/main/src/addins/CBinding/Compiler/GNUCompiler.cs +++ b/main/src/addins/CBinding/Compiler/GNUCompiler.cs @@ -56,7 +56,7 @@ namespace CBinding ProjectFileCollection projectFiles, ProjectPackageCollection packages, CProjectConfiguration configuration, - IProgressMonitor monitor) + ProgressMonitor monitor) { if (!appsChecked) { appsChecked = true; @@ -271,7 +271,7 @@ namespace CBinding private bool PrecompileHeaders (ProjectFileCollection projectFiles, CProjectConfiguration configuration, string args, - IProgressMonitor monitor, + ProgressMonitor monitor, CompilerResults cr) { monitor.BeginTask (GettextCatalog.GetString ("Precompiling headers"), 1); @@ -303,7 +303,7 @@ namespace CBinding return success; } - private bool DoPrecompileHeader (ProjectFile file, string output, string args, IProgressMonitor monitor, CompilerResults cr) + private bool DoPrecompileHeader (ProjectFile file, string output, string args, ProgressMonitor monitor, CompilerResults cr) { string completeArgs = String.Format ("\"{0}\" {1} -o {2}", file.Name, args, output); string errorOutput; @@ -353,7 +353,7 @@ namespace CBinding CProjectConfiguration configuration, ProjectPackageCollection packages, CompilerResults cr, - IProgressMonitor monitor, string outputName) + ProgressMonitor monitor, string outputName) { if (!NeedsUpdate (projectFiles, configuration, outputName)) return; @@ -406,7 +406,7 @@ namespace CBinding CProjectConfiguration configuration, ProjectPackageCollection packages, CompilerResults cr, - IProgressMonitor monitor, string outputName) + ProgressMonitor monitor, string outputName) { if (!NeedsUpdate (projectFiles, configuration, outputName)) return; @@ -431,7 +431,7 @@ namespace CBinding CProjectConfiguration configuration, ProjectPackageCollection packages, CompilerResults cr, - IProgressMonitor monitor, string outputName) + ProgressMonitor monitor, string outputName) { if (!NeedsUpdate (projectFiles, configuration, outputName)) return; @@ -479,7 +479,7 @@ namespace CBinding CheckReturnCode (exitCode, cr); } - int ExecuteCommand (string command, string args, string baseDirectory, IProgressMonitor monitor, out string errorOutput) + int ExecuteCommand (string command, string args, string baseDirectory, ProgressMonitor monitor, out string errorOutput) { errorOutput = string.Empty; int exitCode = -1; @@ -491,23 +491,20 @@ namespace CBinding monitor.Log.WriteLine ("{0} {1}", command, args); - using (var operationMonitor = new AggregatedOperationMonitor (monitor)) { - using (ProcessWrapper p = Runtime.ProcessService.StartProcess (command, args, baseDirectory, monitor.Log, chainedError, null)) { - operationMonitor.AddOperation (p); //handles cancellation - - p.WaitForOutput (); - chainedError.UnchainWriter (monitor.Log); - chainedError.UnchainWriter (swError); + using (ProcessWrapper p = Runtime.ProcessService.StartProcess (command, args, baseDirectory, monitor.Log, chainedError, null)) + using (monitor.CancellationToken.Register (p.Cancel)) { + p.WaitForOutput (); + chainedError.UnchainWriter (monitor.Log); + chainedError.UnchainWriter (swError); - errorOutput = swError.ToString (); - exitCode = p.ExitCode; - - if (monitor.IsCancelRequested) { - monitor.Log.WriteLine (GettextCatalog.GetString ("Build cancelled")); - monitor.ReportError (GettextCatalog.GetString ("Build cancelled"), null); - if (exitCode == 0) - exitCode = -1; - } + errorOutput = swError.ToString (); + exitCode = p.ExitCode; + + if (monitor.CancellationToken.IsCancellationRequested) { + monitor.Log.WriteLine (GettextCatalog.GetString ("Build cancelled")); + monitor.ReportError (GettextCatalog.GetString ("Build cancelled"), null); + if (exitCode == 0) + exitCode = -1; } } } @@ -542,7 +539,7 @@ namespace CBinding private bool DoCompilation (ProjectFile file, CProjectConfiguration configuration, string args, - IProgressMonitor monitor, + ProgressMonitor monitor, CompilerResults cr, bool use_ccache) { @@ -605,7 +602,7 @@ namespace CBinding return objectFiles.ToArray (); } - public override void Clean (ProjectFileCollection projectFiles, CProjectConfiguration configuration, IProgressMonitor monitor) + public override void Clean (ProjectFileCollection projectFiles, CProjectConfiguration configuration, ProgressMonitor monitor) { //clean up object files foreach (string oFile in ObjectFiles(projectFiles, configuration, false)) { diff --git a/main/src/addins/CBinding/Compiler/ICompiler.cs b/main/src/addins/CBinding/Compiler/ICompiler.cs index edb2b80c96..a3b7ad7a0e 100644 --- a/main/src/addins/CBinding/Compiler/ICompiler.cs +++ b/main/src/addins/CBinding/Compiler/ICompiler.cs @@ -69,8 +69,8 @@ namespace CBinding ProjectFileCollection projectFiles, ProjectPackageCollection packages, CProjectConfiguration configuration, - IProgressMonitor monitor); + ProgressMonitor monitor); - void Clean (ProjectFileCollection projectFiles, CProjectConfiguration configuration, IProgressMonitor monitor); + void Clean (ProjectFileCollection projectFiles, CProjectConfiguration configuration, ProgressMonitor monitor); } } |