diff options
author | Greg Munn <gregm@microsoft.com> | 2019-12-05 00:53:11 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-05 00:53:11 +0300 |
commit | a31b5aec6029543cf485bd0f577a8b6023e1603f (patch) | |
tree | 67520c8f0dc9d36f157d3a1fb772af157338ae1c /main | |
parent | 4770b529860b1365df68f43ffeb64ef42e8c341a (diff) | |
parent | 45f4ae3da379421b0badd493322b33ab4598b408 (diff) |
Merge pull request #9424 from mono/backport-pr-9423-to-release-8.4
[release-8.4] [Ide] Type system updates file information less often
Diffstat (limited to 'main')
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); |