forked from qt-creator/qt-creator
ProjectExplorer: Move BuildSystem owership to BuildConfiguration
... or Target. This patch moves build system from conceptually "one per project" to "one per target (i.e. per project-and-kit)" or "per BuildConfigurations" for targets where the builds differ significantly. Building requires usually items from the kit (Qt version, compiler, ...) so a target-agnostic build is practically almost always wrong. Moving the build system to the target also has the potential to solve issues caused by switching targets while parsing, that used Project::activeTarget() regularly, with potentially different results before and after the switch. This patch might create performance/size regressions when several targets are set up per project as the build system implementation's internal data are duplicated in this case. The idea is to fix that by sharing per-project pieces again in the project implementation once these problems occur. Change-Id: I87f640ce418b93175b5029124eaa55f3b8721dca Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -34,13 +34,12 @@
|
||||
#include <projectexplorer/deploymentdata.h>
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
class CMakeBuildSystem;
|
||||
class CMakeExtraBuildInfo;
|
||||
class CMakeProject;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class BuildDirManager;
|
||||
class CMakeBuildSystem;
|
||||
class CMakeBuildSettingsWidget;
|
||||
|
||||
class CMakeBuildConfiguration : public ProjectExplorer::BuildConfiguration
|
||||
@@ -49,6 +48,7 @@ class CMakeBuildConfiguration : public ProjectExplorer::BuildConfiguration
|
||||
|
||||
friend class ProjectExplorer::BuildConfigurationFactory;
|
||||
CMakeBuildConfiguration(ProjectExplorer::Target *parent, Core::Id id);
|
||||
~CMakeBuildConfiguration() final;
|
||||
|
||||
public:
|
||||
void emitBuildTypeChanged();
|
||||
@@ -61,17 +61,14 @@ public:
|
||||
|
||||
CMakeProject *project() const;
|
||||
|
||||
QStringList buildTargetTitles() const;
|
||||
const QList<CMakeBuildTarget> &buildTargets() const;
|
||||
const QList<ProjectExplorer::BuildTargetInfo> appTargets() const;
|
||||
ProjectExplorer::DeploymentData deploymentData() const;
|
||||
|
||||
static Utils::FilePath
|
||||
shadowBuildDirectory(const Utils::FilePath &projectFilePath, const ProjectExplorer::Kit *k,
|
||||
const QString &bcName, BuildConfiguration::BuildType buildType);
|
||||
|
||||
// Context menu action:
|
||||
void buildTarget(const QString &buildTarget);
|
||||
ProjectExplorer::BuildSystem *buildSystem() const final;
|
||||
|
||||
signals:
|
||||
void errorOccured(const QString &message);
|
||||
void warningOccured(const QString &message);
|
||||
@@ -92,7 +89,6 @@ private:
|
||||
enum ForceEnabledChanged { False, True };
|
||||
void clearError(ForceEnabledChanged fec = ForceEnabledChanged::False);
|
||||
|
||||
void setBuildTargets(const QList<CMakeBuildTarget> &targets);
|
||||
void setConfigurationFromCMake(const CMakeConfig &config);
|
||||
void setConfigurationForCMake(const QList<ConfigModel::DataItem> &items);
|
||||
void setConfigurationForCMake(const CMakeConfig &config);
|
||||
@@ -100,27 +96,17 @@ private:
|
||||
void setError(const QString &message);
|
||||
void setWarning(const QString &message);
|
||||
|
||||
void handleParsingSucceeded();
|
||||
void handleParsingFailed(const QString &msg);
|
||||
|
||||
std::unique_ptr<CMakeProjectNode> generateProjectTree(
|
||||
const QList<const ProjectExplorer::FileNode *> &allFiles);
|
||||
|
||||
void checkAndReportError(QString &errorMessage);
|
||||
|
||||
Internal::BuildDirManager m_buildDirManager;
|
||||
|
||||
CMakeConfig m_configurationForCMake;
|
||||
CMakeConfig m_initialConfiguration;
|
||||
QString m_error;
|
||||
QString m_warning;
|
||||
|
||||
CMakeConfig m_configurationFromCMake;
|
||||
QList<CMakeBuildTarget> m_buildTargets;
|
||||
CMakeBuildSystem *m_buildSystem = nullptr;
|
||||
|
||||
friend class CMakeBuildSettingsWidget;
|
||||
friend class CMakeProjectManager::CMakeBuildSystem;
|
||||
friend class CMakeProjectManager::CMakeProject;
|
||||
friend class CMakeBuildSystem;
|
||||
friend class CMakeProject;
|
||||
friend class BuildDirManager;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user