forked from qt-creator/qt-creator
CMake: make project file system tree scanner persistent
Project source tree is a same for all build configurations so it is a good idea to keep it persistent between CMake runs, configurations switches and so on. It safes a lot of time for big projects. Move more operations to the scanner thread: - Nodes filtering: skip .user files on top level of the project, skip well-known extensions and octet-streams: In most cases these are not required to be shown in the project tree. - Nodes sorting Fix small memory leak: we have .user in the scanner result. After this node filtered out, but is not feed (old code at the BuildDirManager::generateProjectTree()). Now .user file skips during scan without memory allocation at all. Allow user manually rescan project tree by call Build -> Rescan project tree. It runs CMake and Tree Scanner together: in most cases only CMake run requires but time to time (VCS update) full rescan also required. Change-Id: I4a6e6c897202da557509291c79932dd7751860e5 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -30,7 +30,6 @@
|
||||
|
||||
#include <utils/fileutils.h>
|
||||
|
||||
#include <QFutureWatcher>
|
||||
#include <QObject>
|
||||
#include <QTemporaryDir>
|
||||
#include <QTimer>
|
||||
@@ -72,7 +71,7 @@ public:
|
||||
bool updateCMakeStateBeforeBuild();
|
||||
bool persistCMakeState();
|
||||
|
||||
void generateProjectTree(CMakeListsNode *root);
|
||||
void generateProjectTree(CMakeListsNode *root, const QList<ProjectExplorer::FileNode *> &allFiles);
|
||||
QSet<Core::Id> updateCodeModel(CppTools::ProjectPartBuilder &ppBuilder);
|
||||
|
||||
QList<CMakeBuildTarget> buildTargets() const;
|
||||
@@ -103,8 +102,6 @@ private:
|
||||
|
||||
void becameDirty();
|
||||
|
||||
void asyncScanForFiles(QFutureInterface<QList<ProjectExplorer::FileNode *>> *fi);
|
||||
|
||||
CMakeBuildConfiguration *m_buildConfiguration = nullptr;
|
||||
mutable std::unique_ptr<QTemporaryDir> m_tempDir = nullptr;
|
||||
mutable CMakeConfig m_cmakeCache;
|
||||
@@ -112,8 +109,6 @@ private:
|
||||
QTimer m_reparseTimer;
|
||||
|
||||
std::unique_ptr<BuildDirReader> m_reader;
|
||||
QFutureWatcher<QList<ProjectExplorer::FileNode*>> m_futureWatcher;
|
||||
QFuture<QList<ProjectExplorer::FileNode*>> m_scanFuture;
|
||||
|
||||
mutable QList<CMakeBuildTarget> m_buildTargets;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user