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
path: root/main/src
diff options
context:
space:
mode:
authorLluis Sanchez Gual <lluis@xamarin.com>2013-08-21 14:52:04 +0400
committerLluis Sanchez Gual <lluis@xamarin.com>2013-08-27 20:05:23 +0400
commit38f1bd7300908da91cd0c7ffab71420dd00b9994 (patch)
treeaf6d568dc605c283168dde4f724e5bbdab6f5ea1 /main/src
parent6e1037d71191077ff5ef920107d81258d4abb4d3 (diff)
Revert "Revert "[MSBuild] Implement RefreshWithContent in the v4 builder""
This reverts commit 6ec678ff6fb26e41246e9f109e40173d56029711.
Diffstat (limited to 'main/src')
-rw-r--r--main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/BuildEngine.v4.0.cs22
-rw-r--r--main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/ProjectBuilder.v4.0.cs17
2 files changed, 35 insertions, 4 deletions
diff --git a/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/BuildEngine.v4.0.cs b/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/BuildEngine.v4.0.cs
index 1f44808973..5d003919e2 100644
--- a/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/BuildEngine.v4.0.cs
+++ b/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/BuildEngine.v4.0.cs
@@ -48,6 +48,7 @@ namespace MonoDevelop.Projects.Formats.MSBuild
ManualResetEvent doneEvent = new ManualResetEvent (false);
Dictionary<string,ProjectCollection> engines = new Dictionary<string, ProjectCollection> ();
+ Dictionary<string, string> unsavedProjects = new Dictionary<string, string> ();
public void Dispose ()
{
@@ -68,6 +69,21 @@ namespace MonoDevelop.Projects.Formats.MSBuild
((ProjectBuilder)pb).Dispose ();
RemotingServices.Disconnect ((MarshalByRefObject) pb);
}
+
+ internal void SetUnsavedProjectContent (string file, string content)
+ {
+ lock (unsavedProjects)
+ unsavedProjects[file] = content;
+ }
+
+ internal string GetUnsavedProjectContent (string file)
+ {
+ lock (unsavedProjects) {
+ string content;
+ unsavedProjects.TryGetValue (file, out content);
+ return content;
+ }
+ }
public override object InitializeLifetimeService ()
{
@@ -94,7 +110,11 @@ namespace MonoDevelop.Projects.Formats.MSBuild
internal void UnloadProject (string file)
{
- RunSTA (delegate {
+ lock (unsavedProjects)
+ unsavedProjects.Remove (file);
+
+ RunSTA (delegate
+ {
foreach (var engine in engines.Values) {
//unloading projects modifies the collection, so copy it
var projects = engine.GetLoadedProjects (file).ToArray ();
diff --git a/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/ProjectBuilder.v4.0.cs b/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/ProjectBuilder.v4.0.cs
index b570e5b9e0..b460fa3bd9 100644
--- a/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/ProjectBuilder.v4.0.cs
+++ b/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/ProjectBuilder.v4.0.cs
@@ -36,6 +36,7 @@ using System.Collections;
using System.Linq;
using Microsoft.Build.Logging;
using Microsoft.Build.Execution;
+using System.Xml;
namespace MonoDevelop.Projects.Formats.MSBuild
{
@@ -65,6 +66,12 @@ namespace MonoDevelop.Projects.Formats.MSBuild
{
buildEngine.UnloadProject (file);
}
+
+ public void RefreshWithContent (string projectContent)
+ {
+ buildEngine.UnloadProject (file);
+ buildEngine.SetUnsavedProjectContent (file, projectContent);
+ }
void LogWriteLine (string txt)
{
@@ -155,9 +162,13 @@ namespace MonoDevelop.Projects.Formats.MSBuild
Project ConfigureProject (string file, string configuration, string platform)
{
var p = engine.GetLoadedProjects (file).FirstOrDefault ();
- if (p == null)
- p = engine.LoadProject (file);
-
+ if (p == null) {
+ var content = buildEngine.GetUnsavedProjectContent (file);
+ if (content == null)
+ p = engine.LoadProject (file);
+ else
+ p = engine.LoadProject (new XmlTextReader (new StringReader (content)));
+ }
p.SetProperty ("Configuration", configuration);
if (!string.IsNullOrEmpty (platform))
p.SetProperty ("Platform", platform);