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 <lluis@xamarin.com>2014-07-31 13:21:57 +0400
committerLluis Sanchez <lluis@xamarin.com>2014-07-31 13:21:57 +0400
commit2ceeeb980e305a396c1358fa70157c5027b8a4a2 (patch)
tree93f9e3a2c0b620750634f3d241071446641f2526 /main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProjectHandler.cs
parent4652f7f309cf903e44dc628ed4f8c864256ea09a (diff)
[Core] Cache assembly references returned by msbuild
Diffstat (limited to 'main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProjectHandler.cs')
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProjectHandler.cs47
1 files changed, 18 insertions, 29 deletions
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProjectHandler.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProjectHandler.cs
index 2161a9a959..fcf8ceb771 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProjectHandler.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProjectHandler.cs
@@ -167,11 +167,10 @@ namespace MonoDevelop.Projects.Formats.MSBuild
{
// If the default runtime changes, the project builder for this project may change
// so it has to be created again.
- if (projectBuilder != null) {
- projectBuilder.Dispose ();
- projectBuilder = null;
- }
+ CleanupProjectBuilder ();
}
+
+ object builderLock = new object ();
RemoteProjectBuilder GetProjectBuilder ()
{
@@ -185,21 +184,20 @@ namespace MonoDevelop.Projects.Formats.MSBuild
var sln = item.ParentSolution;
var slnFile = sln != null ? sln.FileName : null;
- if (projectBuilder == null || lastBuildToolsVersion != ToolsVersion || lastBuildRuntime != runtime.Id || lastFileName != item.FileName || lastSlnFileName != slnFile) {
- if (projectBuilder != null) {
- projectBuilder.Dispose ();
- projectBuilder = null;
+ lock (builderLock) {
+ if (projectBuilder == null || lastBuildToolsVersion != ToolsVersion || lastBuildRuntime != runtime.Id || lastFileName != item.FileName || lastSlnFileName != slnFile) {
+ CleanupProjectBuilder ();
+ projectBuilder = MSBuildProjectService.GetProjectBuilder (runtime, ToolsVersion, item.FileName, slnFile);
+ lastBuildToolsVersion = ToolsVersion;
+ lastBuildRuntime = runtime.Id;
+ lastFileName = item.FileName;
+ lastSlnFileName = slnFile;
+ }
+ if (modifiedInMemory) {
+ modifiedInMemory = false;
+ var p = SaveProject (new NullProgressMonitor ());
+ projectBuilder.RefreshWithContent (p.SaveToString ());
}
- projectBuilder = MSBuildProjectService.GetProjectBuilder (runtime, ToolsVersion, item.FileName, slnFile);
- lastBuildToolsVersion = ToolsVersion;
- lastBuildRuntime = runtime.Id;
- lastFileName = item.FileName;
- lastSlnFileName = slnFile;
- }
- else if (modifiedInMemory) {
- modifiedInMemory = false;
- var p = SaveProject (new NullProgressMonitor ());
- projectBuilder.RefreshWithContent (p.SaveToString ());
}
return projectBuilder;
}
@@ -259,17 +257,8 @@ namespace MonoDevelop.Projects.Formats.MSBuild
SolutionEntityItem item = (SolutionEntityItem) Item;
RemoteProjectBuilder builder = GetProjectBuilder ();
var configs = GetConfigurations (item, configuration);
-
- var result = builder.Run (
- configs, null, MSBuildVerbosity.Normal,
- new[] { "ResolveAssemblyReferences" }, new [] { "ReferencePath" }, null
- );
-
- List<MSBuildEvaluatedItem> items;
- if (result.Items.TryGetValue ("ReferencePath", out items) && items != null) {
- foreach (var i in items)
- yield return i.ItemSpec;
- }
+ foreach (var r in builder.ResolveAssemblyReferences (configs))
+ yield return r;
}
else {
CleanupProjectBuilder ();