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
diff options
context:
space:
mode:
authorMatt Ward <matt.ward@microsoft.com>2019-12-04 15:30:13 +0300
committermonojenkins <jo.shields+jenkins@xamarin.com>2019-12-04 22:01:16 +0300
commit45f4ae3da379421b0badd493322b33ab4598b408 (patch)
tree5b146fff3b9244eabafd2a53055b4b9acae32ea1 /main
parent48f60a9e59f8a54647a1c9cf6b4177838c9427a7 (diff)
[Ide] Type system updates file information less often
With a project that uses the DevExpress.Blazor NuGet package the IDE would get stuck running MSBuild design time builds repeatedly. Every MSBuild target that was run would trigger the DevExpress UpdateStatic MSBuild target to run. This UpdateStatic target would delete and create javascript files in the project. This then triggered the 'Files' project modified event to fire. The type system then re-ran the design time builds again since it uses this event as a trigger. This then resulted in the design time builds being run repeatedly. The status bar would repeatedly show messages, usually Saving, but sometimes some version control messages. To avoid this repeated calling of the MSBuild design time targets the project now has a new CoreCompileFiles modified event which only fires for a small subset of build actions - Compile, AdditionalFiles, Analyzer and EditorConfigFiles. These build actions are the only ones the type system is interested in so there is no need to re-run a design time build to get the list of source files if files with different build actions are added. This prevents the problem with the dev express build targets since it adds/removes javascript files which are not needed by the type system. Fixes VSTS #1030001 - Stuck in constant loop of Saving -> Checkout of files after building a solution.
Diffstat (limited to 'main')
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs38
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.cs2
-rw-r--r--main/tests/MonoDevelop.Core.Tests/MonoDevelop.Projects/GetAnalyzerFilesAsyncTests.cs4
-rw-r--r--main/tests/MonoDevelop.Core.Tests/MonoDevelop.Projects/GetSourceFilesAsyncTests.cs4
4 files changed, 36 insertions, 12 deletions
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs
index bb08ea41fe..71f98a8661 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs
@@ -678,7 +678,7 @@ namespace MonoDevelop.Projects
compileEvaluator.MarkDirty ();
Runtime.RunInMainThread (() => {
- NotifyModified ("Files");
+ NotifyModified ("CoreCompileFiles");
}).Ignore ();
}
@@ -719,6 +719,12 @@ namespace MonoDevelop.Projects
string evaluatedCompileItemsConfiguration;
bool reevaluateCoreCompileDependsOn;
TaskCompletionSource<CoreCompileEvaluationResult> evaluatedCompileItemsTask;
+ static readonly HashSet<string> coreCompileBuildActions = new HashSet<string> (new [] {
+ "Compile",
+ "Analyzer",
+ "EditorConfigFiles",
+ "AdditionalFiles"
+ });
public void MarkDirty ()
{
@@ -729,6 +735,11 @@ namespace MonoDevelop.Projects
}
}
+ public static bool IsCoreCompileFile (string buildAction)
+ {
+ return coreCompileBuildActions.Contains (buildAction);
+ }
+
/// <summary>
/// Gets the list of files that are included as Compile items from the evaluation of the CoreCompile dependecy targets
/// </summary>
@@ -775,10 +786,9 @@ namespace MonoDevelop.Projects
try {
// evaluate the Compile targets
var ctx = new TargetEvaluationContext ();
- ctx.ItemsToEvaluate.Add ("Compile");
- ctx.ItemsToEvaluate.Add ("Analyzer");
- ctx.ItemsToEvaluate.Add ("EditorConfigFiles");
- ctx.ItemsToEvaluate.Add ("AdditionalFiles");
+ foreach (string buildAction in coreCompileBuildActions) {
+ ctx.ItemsToEvaluate.Add (buildAction);
+ }
ctx.LoadReferencedProjects = false;
ctx.BuilderQueue = BuilderQueue.ShortOperations;
ctx.LogVerbosity = MSBuildVerbosity.Quiet;
@@ -2623,6 +2633,8 @@ namespace MonoDevelop.Projects
internal void NotifyFilePropertyChangedInProject (ProjectFile file, string property)
{
NotifyModified ("Files");
+ if (CachingCoreCompileEvaluator.IsCoreCompileFile (file.BuildAction))
+ NotifyModified ("CoreCompileFiles");
OnFilePropertyChangedInProject (new ProjectFileEventArgs (this, file, property));
}
@@ -2634,10 +2646,13 @@ namespace MonoDevelop.Projects
{
if (!objs.Any ())
return;
-
+
+ bool coreCompileFile = false;
var args = new ProjectFileEventArgs ();
foreach (ProjectFile file in objs) {
+ if (CachingCoreCompileEvaluator.IsCoreCompileFile (file.BuildAction))
+ coreCompileFile = true;
args.Add (new ProjectFileEventInfo (this, file));
if (DependencyResolutionEnabled) {
unresolvedDeps.Remove (file);
@@ -2650,6 +2665,8 @@ namespace MonoDevelop.Projects
}
}
NotifyModified ("Files");
+ if (coreCompileFile)
+ NotifyModified ("CoreCompileFiles");
OnFileRemovedFromProject (args);
ParentSolution?.OnRootDirectoriesChanged (this, isRemove: false, isAdd: false);
}
@@ -2658,15 +2675,20 @@ namespace MonoDevelop.Projects
{
if (!objs.Any ())
return;
-
+
+ bool coreCompileFile = false;
var args = new ProjectFileEventArgs ();
foreach (ProjectFile file in objs) {
+ if (CachingCoreCompileEvaluator.IsCoreCompileFile (file.BuildAction))
+ coreCompileFile = true;
args.Add (new ProjectFileEventInfo (this, file));
ResolveDependencies (file);
}
NotifyModified ("Files");
+ if (coreCompileFile)
+ NotifyModified ("CoreCompileFiles");
OnFileAddedToProject (args);
if (!Loading)
@@ -4785,6 +4807,8 @@ namespace MonoDevelop.Projects
internal void NotifyFileRenamedInProject (ProjectFileRenamedEventArgs args)
{
NotifyModified ("Files");
+ if (args.Any (file => CachingCoreCompileEvaluator.IsCoreCompileFile (file.ProjectFile.BuildAction)))
+ NotifyModified ("CoreCompileFiles");
OnFileRenamedInProject (args);
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.cs
index 41d964ac2f..f83ba9884f 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.cs
@@ -1486,7 +1486,7 @@ namespace MonoDevelop.Ide.TypeSystem
if (freezeProjectModify)
return;
try {
- if (!args.Any (x => x.Hint == "TargetFramework" || x.Hint == "References" || x.Hint == "CompilerParameters" || x.Hint == "Files"))
+ if (!args.Any (x => x.Hint == "TargetFramework" || x.Hint == "References" || x.Hint == "CompilerParameters" || x.Hint == "CoreCompileFiles"))
return;
var project = sender as MonoDevelop.Projects.DotNetProject;
if (project == null)
diff --git a/main/tests/MonoDevelop.Core.Tests/MonoDevelop.Projects/GetAnalyzerFilesAsyncTests.cs b/main/tests/MonoDevelop.Core.Tests/MonoDevelop.Projects/GetAnalyzerFilesAsyncTests.cs
index e13ec1fda4..73417b6d49 100644
--- a/main/tests/MonoDevelop.Core.Tests/MonoDevelop.Projects/GetAnalyzerFilesAsyncTests.cs
+++ b/main/tests/MonoDevelop.Core.Tests/MonoDevelop.Projects/GetAnalyzerFilesAsyncTests.cs
@@ -116,7 +116,7 @@ namespace MonoDevelop.Projects
var before = new MSBuildItem (); // Ensures import added at end of project.
project.MSBuildProject.AddNewImport ("consoleproject-import.targets", null, before);
- Assert.AreEqual ("Files", modifiedHint);
+ Assert.AreEqual ("CoreCompileFiles", modifiedHint);
analyzerFiles = await project.GetAnalyzerFilesAsync (project.Configurations [0].Selector);
@@ -124,7 +124,7 @@ namespace MonoDevelop.Projects
modifiedHint = null;
project.MSBuildProject.RemoveImport ("consoleproject-import.targets");
- Assert.AreEqual ("Files", modifiedHint);
+ Assert.AreEqual ("CoreCompileFiles", modifiedHint);
analyzerFiles = await project.GetAnalyzerFilesAsync (project.Configurations [0].Selector);
diff --git a/main/tests/MonoDevelop.Core.Tests/MonoDevelop.Projects/GetSourceFilesAsyncTests.cs b/main/tests/MonoDevelop.Core.Tests/MonoDevelop.Projects/GetSourceFilesAsyncTests.cs
index ea93d73e54..1289815b3f 100644
--- a/main/tests/MonoDevelop.Core.Tests/MonoDevelop.Projects/GetSourceFilesAsyncTests.cs
+++ b/main/tests/MonoDevelop.Core.Tests/MonoDevelop.Projects/GetSourceFilesAsyncTests.cs
@@ -196,7 +196,7 @@ namespace MonoDevelop.Projects
var before = new MSBuildItem (); // Ensures import added at end of project.
project.MSBuildProject.AddNewImport ("consoleproject-import.targets", null, before);
- Assert.AreEqual ("Files", modifiedHint);
+ Assert.AreEqual ("CoreCompileFiles", modifiedHint);
sourceFiles = await project.GetSourceFilesAsync (project.Configurations[0].Selector);
@@ -204,7 +204,7 @@ namespace MonoDevelop.Projects
modifiedHint = null;
project.MSBuildProject.RemoveImport ("consoleproject-import.targets");
- Assert.AreEqual ("Files", modifiedHint);
+ Assert.AreEqual ("CoreCompileFiles", modifiedHint);
sourceFiles = await project.GetSourceFilesAsync (project.Configurations[0].Selector);