Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Hutchinson <m.j.hutchinson@gmail.com>2015-01-22 22:59:12 +0300
committerMichael Hutchinson <m.j.hutchinson@gmail.com>2015-01-26 18:53:31 +0300
commit09235e4e3df600ddf4ffb3de06e84168148762e2 (patch)
tree2fc74f789a7e4f3ad2864b6503dfbcf23f81b9d2 /main/src/addins/MonoDevelop.Debugger
parent8f9269ec166195392be3214108a090aeed269aa8 (diff)
Implement fast build checks
Diffstat (limited to 'main/src/addins/MonoDevelop.Debugger')
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebugCommands.cs119
1 files changed, 26 insertions, 93 deletions
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebugCommands.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebugCommands.cs
index 8f21e235e0..be753c891c 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebugCommands.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebugCommands.cs
@@ -85,56 +85,33 @@ namespace MonoDevelop.Debugger
IdeApp.ProjectOperations.CurrentRunOperation.WaitForCompleted ();
}
- if (!IdeApp.Preferences.BuildBeforeExecuting) {
- if (IdeApp.Workspace.IsOpen) {
- var it = GetRunTarget ();
- CheckResult cr = CheckBeforeDebugging (it);
- if (cr == DebugHandler.CheckResult.Cancel)
- return;
- if (cr == DebugHandler.CheckResult.Run) {
- ExecuteSolution (it);
- return;
- }
- // Else continue building
- }
- else {
- ExecuteDocument (IdeApp.Workbench.ActiveDocument);
- return;
- }
- }
-
if (IdeApp.Workspace.IsOpen) {
var it = GetRunTarget ();
-
- var buildTarget = it;
- var executionTarget = buildTarget as IExecutableWorkspaceObject;
- if (executionTarget != null) {
- var buildDeps = executionTarget.GetExecutionDependencies ().ToList ();
- if (buildDeps.Count > 1)
- throw new NotImplementedException ("Multiple execution dependencies not yet supported");
- buildTarget = buildDeps [0];
- }
-
- IAsyncOperation op = IdeApp.ProjectOperations.Build (buildTarget);
+ var op = IdeApp.ProjectOperations.CheckAndBuildForExecute (it);
op.Completed += delegate {
- if (op.SuccessWithWarnings && !IdeApp.Preferences.RunWithWarnings)
- return;
if (op.Success)
ExecuteSolution (it);
};
- } else {
- Document doc = IdeApp.Workbench.ActiveDocument;
- if (doc != null) {
- doc.Save ();
- IAsyncOperation op = doc.Build ();
- op.Completed += delegate {
- if (op.SuccessWithWarnings && !IdeApp.Preferences.RunWithWarnings)
- return;
- if (op.Success)
- ExecuteDocument (doc);
- };
- }
+ return;
+ }
+
+ Document doc = IdeApp.Workbench.ActiveDocument;
+ if (doc == null)
+ return;
+
+ if (!IdeApp.Preferences.BuildBeforeExecuting) {
+ ExecuteDocument (doc);
+ return;
}
+
+ doc.Save ();
+ IAsyncOperation docOp = doc.Build ();
+ docOp.Completed += delegate {
+ if (docOp.SuccessWithWarnings && !IdeApp.Preferences.RunWithWarnings)
+ return;
+ if (docOp.Success)
+ ExecuteDocument (doc);
+ };
}
static void ExecuteSolution (IBuildTarget target)
@@ -197,44 +174,6 @@ namespace MonoDevelop.Debugger
info.Enabled = (doc != null && doc.IsBuildTarget) && (doc.CanRun () || doc.CanDebug ());
}
}
-
- internal static CheckResult CheckBeforeDebugging (IBuildTarget target)
- {
- if (IdeApp.Preferences.BuildBeforeExecuting)
- return CheckResult.BuildBeforeRun;
-
- if (!target.NeedsBuilding (IdeApp.Workspace.ActiveConfiguration))
- return CheckResult.Run;
-
- AlertButton bBuild = new AlertButton (GettextCatalog.GetString ("Build"));
- AlertButton bRun = new AlertButton (Gtk.Stock.Execute, true);
- AlertButton res = MessageService.AskQuestion (
- GettextCatalog.GetString ("Outdated Debug Information"),
- GettextCatalog.GetString ("The project you are executing has changes done after the last time it was compiled. The debug information may be outdated. Do you want to continue?"),
- 2,
- AlertButton.Cancel,
- bBuild,
- bRun);
-
- // This call is a workaround for bug #6907. Without it, the main monodevelop window is left it a weird
- // drawing state after the message dialog is shown. This may be a gtk/mac issue. Still under research.
- DispatchService.RunPendingEvents ();
-
- if (res == AlertButton.Cancel)
- return CheckResult.Cancel;
-
- if (res == bRun)
- return CheckResult.Run;
-
- return CheckResult.BuildBeforeRun;
- }
-
- internal enum CheckResult
- {
- Cancel,
- BuildBeforeRun,
- Run
- }
}
class DebugEntryHandler: CommandHandler
@@ -242,18 +181,12 @@ namespace MonoDevelop.Debugger
protected override void Run ()
{
IBuildTarget entry = IdeApp.ProjectOperations.CurrentSelectedBuildTarget;
- DebugHandler.CheckResult cr = DebugHandler.CheckBeforeDebugging (entry);
-
- if (cr == DebugHandler.CheckResult.BuildBeforeRun) {
- IAsyncOperation op = IdeApp.ProjectOperations.Build (entry);
- op.Completed += delegate {
- if (op.SuccessWithWarnings && !IdeApp.Preferences.RunWithWarnings)
- return;
- if (op.Success)
- IdeApp.ProjectOperations.Debug (entry);
- };
- } else if (cr == DebugHandler.CheckResult.Run)
- IdeApp.ProjectOperations.Debug (entry);
+
+ var op = IdeApp.ProjectOperations.CheckAndBuildForExecute (entry);
+ op.Completed += delegate {
+ if (op.Success)
+ IdeApp.ProjectOperations.Debug (entry);
+ };
}
protected override void Update (CommandInfo info)