CMake: Move code from CMakeProject into CMakeBuildSystem

Introduce BuildSystem to implement functionality common to all
build systems out there. This includes things like delaying the
parsing by 1s.

The actual CMake specific code is then moved into a derived
class CMakeBuildSystem.

Change-Id: I84f4344430f19a44e16534db294382c436169ed5
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Tobias Hunger
2019-08-06 12:41:46 +02:00
parent fcffb5f2fc
commit d115276b34
11 changed files with 718 additions and 422 deletions

View File

@@ -28,6 +28,7 @@
#include "cmake_global.h"
#include "builddirmanager.h"
#include "cmakebuildsystem.h"
#include "cmakebuildtarget.h"
#include "cmakeprojectimporter.h"
@@ -49,6 +50,8 @@ namespace ProjectExplorer { class FileNode; }
namespace CMakeProjectManager {
class BuildSystem;
namespace Internal {
class CMakeBuildConfiguration;
class CMakeBuildSettingsWidget;
@@ -63,6 +66,8 @@ public:
explicit CMakeProject(const Utils::FilePath &filename);
~CMakeProject() final;
BuildSystem *buildSystem() const { return m_buildsystem.get(); }
ProjectExplorer::Tasks projectIssues(const ProjectExplorer::Kit *k) const final;
void runCMake();
@@ -75,53 +80,26 @@ public:
bool persistCMakeState();
void clearCMakeCache();
bool mustUpdateCMakeStateBeforeBuild();
void checkAndReportError(QString &errorMessage) const;
void reportError(const QString &errorMessage) const;
void requestReparse(int reparseParameters);
bool mustUpdateCMakeStateBeforeBuild() const;
protected:
bool setupTarget(ProjectExplorer::Target *t) final;
private:
void startParsing(int reparseParameters);
void handleTreeScanningFinished();
void handleParsingSuccess(Internal::CMakeBuildConfiguration *bc);
void handleParsingError(Internal::CMakeBuildConfiguration *bc);
void combineScanAndParse(Internal::CMakeBuildConfiguration *bc);
void updateProjectData(Internal::CMakeBuildConfiguration *bc);
void updateQmlJSCodeModel(Internal::CMakeBuildConfiguration *bc);
QList<ProjectExplorer::ExtraCompiler *> findExtraCompilers() const;
QStringList filesGeneratedFrom(const QString &sourceFile) const final;
ProjectExplorer::DeploymentKnowledge deploymentKnowledge() const override;
ProjectExplorer::MakeInstallCommand makeInstallCommand(const ProjectExplorer::Target *target,
const QString &installRoot) override;
CppTools::CppProjectUpdater *m_cppCodeModelUpdater = nullptr;
QList<ProjectExplorer::ExtraCompiler *> m_extraCompilers;
ProjectExplorer::TreeScanner m_treeScanner;
bool m_waitingForScan = false;
bool m_waitingForParse = false;
bool m_combinedScanAndParseResult = false;
QHash<QString, bool> m_mimeBinaryCache;
QList<const ProjectExplorer::FileNode *> m_allFiles;
mutable std::unique_ptr<Internal::CMakeProjectImporter> m_projectImporter;
QTimer m_delayedParsingTimer;
int m_delayedParsingParameters = 0;
std::unique_ptr<CMakeBuildSystem> m_buildsystem;
ParseGuard m_parseGuard;
// friend class Internal::CMakeBuildConfiguration;
// friend class Internal::CMakeBuildSettingsWidget;
friend class Internal::CMakeBuildConfiguration;
friend class Internal::CMakeBuildSettingsWidget;
friend class CMakeBuildSystem;
};
} // namespace CMakeProjectManager