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 <marcus.tillmanns@qt.io>
This commit is contained in:
David Schulz
2024-09-12 15:43:36 +02:00
parent 92b7df11c0
commit b9b5ec9e3f

View File

@@ -61,6 +61,7 @@ class WorkspaceBuildSystem final : public BuildSystem
public: public:
WorkspaceBuildSystem(Target *t); WorkspaceBuildSystem(Target *t);
void reparse(bool force);
void triggerParsing() final; void triggerParsing() final;
void watchFolder(const FilePath &path, const QList<IVersionControl *> &versionControls); void watchFolder(const FilePath &path, const QList<IVersionControl *> &versionControls);
@@ -152,8 +153,9 @@ WorkspaceBuildSystem::WorkspaceBuildSystem(Target *t)
requestDelayedParse(); requestDelayedParse();
} }
void WorkspaceBuildSystem::triggerParsing() void WorkspaceBuildSystem::reparse(bool force)
{ {
const QList<QRegularExpression> oldFilters = m_filters;
m_filters.clear(); m_filters.clear();
FilePath projectPath = project()->projectDirectory(); FilePath projectPath = project()->projectDirectory();
@@ -211,9 +213,15 @@ void WorkspaceBuildSystem::triggerParsing()
setApplicationTargets(targetInfos); setApplicationTargets(targetInfos);
if (force || oldFilters != m_filters)
scan(target()->project()->projectDirectory()); scan(target()->project()->projectDirectory());
} }
void WorkspaceBuildSystem::triggerParsing()
{
reparse(false);
}
void WorkspaceBuildSystem::watchFolder( void WorkspaceBuildSystem::watchFolder(
const FilePath &path, const QList<IVersionControl *> &versionControls) const FilePath &path, const QList<IVersionControl *> &versionControls)
{ {
@@ -518,8 +526,8 @@ void setupWorkspaceProject(QObject *guard)
const auto project = qobject_cast<WorkspaceProject *>(node->getProject()); const auto project = qobject_cast<WorkspaceProject *>(node->getProject());
QTC_ASSERT(project, return); QTC_ASSERT(project, return);
if (auto target = project->activeTarget()) { if (auto target = project->activeTarget()) {
if (target->buildSystem()) if (auto buildSystem = dynamic_cast<WorkspaceBuildSystem *>(target->buildSystem()))
target->buildSystem()->triggerParsing(); buildSystem->reparse(true);
} }
}); });