From b9b5ec9e3ff0a3c353632e071b417156cf5ec190 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Thu, 12 Sep 2024 15:43:36 +0200 Subject: [PATCH] ProjectExplorer: avoid workspace project rescan on unchanged filters Changing the project name or run configuration in the project file should not trigger a full parsing of the workspace project. Only if the exclude filters are changed we need to rebuild the project tree. Change-Id: I0f537f14aa1055eee2f03444209479a65b8115e7 Reviewed-by: Marcus Tillmanns --- src/plugins/projectexplorer/workspaceproject.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/plugins/projectexplorer/workspaceproject.cpp b/src/plugins/projectexplorer/workspaceproject.cpp index 5dcd8a91983..e3442e8d261 100644 --- a/src/plugins/projectexplorer/workspaceproject.cpp +++ b/src/plugins/projectexplorer/workspaceproject.cpp @@ -61,6 +61,7 @@ class WorkspaceBuildSystem final : public BuildSystem public: WorkspaceBuildSystem(Target *t); + void reparse(bool force); void triggerParsing() final; void watchFolder(const FilePath &path, const QList &versionControls); @@ -152,8 +153,9 @@ WorkspaceBuildSystem::WorkspaceBuildSystem(Target *t) requestDelayedParse(); } -void WorkspaceBuildSystem::triggerParsing() +void WorkspaceBuildSystem::reparse(bool force) { + const QList oldFilters = m_filters; m_filters.clear(); FilePath projectPath = project()->projectDirectory(); @@ -211,7 +213,13 @@ void WorkspaceBuildSystem::triggerParsing() setApplicationTargets(targetInfos); - scan(target()->project()->projectDirectory()); + if (force || oldFilters != m_filters) + scan(target()->project()->projectDirectory()); +} + +void WorkspaceBuildSystem::triggerParsing() +{ + reparse(false); } void WorkspaceBuildSystem::watchFolder( @@ -518,8 +526,8 @@ void setupWorkspaceProject(QObject *guard) const auto project = qobject_cast(node->getProject()); QTC_ASSERT(project, return); if (auto target = project->activeTarget()) { - if (target->buildSystem()) - target->buildSystem()->triggerParsing(); + if (auto buildSystem = dynamic_cast(target->buildSystem())) + buildSystem->reparse(true); } });