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:
authorLluis Sanchez <llsan@microsoft.com>2017-07-14 14:54:27 +0300
committerLluis Sanchez <llsan@microsoft.com>2017-07-14 19:23:42 +0300
commit32e4b5f2686071579a413fdb9efc78474f96c87a (patch)
tree59a924b31f12a71188dac9c6357f29502c907b39 /main/src/core/MonoDevelop.Ide
parente12653eb337a0d79ab6f8010636e69ad9066f0b0 (diff)
Fix issue in FastCheckNeedsBuild
The FastCheckNeedsBuild method now takes an OperationContext as argument. This is necessary because when building a project, OperationContext can contain custom msbuild properties that can have an effect on the build (for example, a build can be specific to the target device currently selected in the IDE). OnFastCheckNeedsBuild now keeps track of the global msbuild properties specified in the context, and uses them when checking for changes.
Diffstat (limited to 'main/src/core/MonoDevelop.Ide')
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ProjectOperations.cs29
1 files changed, 24 insertions, 5 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ProjectOperations.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ProjectOperations.cs
index 19e3b067ca..a88c448dfc 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ProjectOperations.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ProjectOperations.cs
@@ -1182,7 +1182,7 @@ namespace MonoDevelop.Ide
BuildResult res = null;
try {
tt.Trace ("Cleaning item");
- res = await entry.Clean (monitor, IdeApp.Workspace.ActiveConfiguration, operationContext);
+ res = await entry.Clean (monitor, IdeApp.Workspace.ActiveConfiguration, InitOperationContext (entry, operationContext));
} catch (Exception ex) {
monitor.ReportError (GettextCatalog.GetString ("Clean failed."), ex);
} finally {
@@ -1435,13 +1435,13 @@ namespace MonoDevelop.Ide
var sei = target as Project;
if (sei != null) {
- if (sei.FastCheckNeedsBuild (configuration))
+ if (sei.FastCheckNeedsBuild (configuration, InitOperationContext (target, new TargetEvaluationContext ())))
return true;
//TODO: respect solution level dependencies
var deps = new HashSet<SolutionItem> ();
CollectReferencedItems (sei, deps, configuration);
foreach (var dep in deps.OfType<Project> ()) {
- if (dep.FastCheckNeedsBuild (configuration))
+ if (dep.FastCheckNeedsBuild (configuration, InitOperationContext (target, new TargetEvaluationContext ())))
return true;
}
return false;
@@ -1450,7 +1450,7 @@ namespace MonoDevelop.Ide
var sln = target as Solution;
if (sln != null) {
foreach (var item in sln.GetAllProjects ()) {
- if (item.FastCheckNeedsBuild (configuration))
+ if (item.FastCheckNeedsBuild (configuration, InitOperationContext (target, new TargetEvaluationContext ())))
return true;
}
return false;
@@ -1517,7 +1517,7 @@ namespace MonoDevelop.Ide
if (skipPrebuildCheck || result.ErrorCount == 0) {
tt.Trace ("Building item");
- result = await entry.Build (monitor, IdeApp.Workspace.ActiveConfiguration, true, operationContext);
+ result = await entry.Build (monitor, IdeApp.Workspace.ActiveConfiguration, true, InitOperationContext (entry, operationContext));
}
} catch (Exception ex) {
monitor.ReportError (GettextCatalog.GetString ("Build failed."), ex);
@@ -1534,6 +1534,25 @@ namespace MonoDevelop.Ide
return result;
}
+
+ /// <summary>
+ /// Initializes the context to be used for build operations. It currently just initializes
+ /// it with the currently selected execution target.
+ /// </summary>
+ T InitOperationContext<T> (IBuildTarget target, T context) where T:OperationContext
+ {
+ OperationContext ctx = context;
+ if (ctx == null)
+ ctx = new OperationContext ();
+ if (ctx.ExecutionTarget == null) {
+ var item = target as SolutionItem;
+ if (item != null)
+ ctx.ExecutionTarget = IdeApp.Workspace.GetActiveExecutionTarget (item);
+ else
+ ctx.ExecutionTarget = IdeApp.Workspace.ActiveExecutionTarget;
+ }
+ return (T)ctx;
+ }
// Note: This must run in the main thread
async Task PromptForSave (BuildResult result)