forked from qt-creator/qt-creator
ProjectExplorer: Use a functor for BuildSystem creation
... instead of creating the BuildSystem direct. This will help the shift of BuildSystem owner ship as a Project will have potentially multiple BuildSystem instances (one per BuildConfiguration), but still be responsible for creating them with the Targets. Change-Id: I2dd71c7687ed41af9e42c874b3f932ce704e7ee3 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -365,8 +365,8 @@ QbsRootProjectNode::QbsRootProjectNode(QbsProject *project) :
|
||||
// QbsBuildSystem:
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
QbsBuildSystem::QbsBuildSystem(QbsProject *project)
|
||||
: BuildSystem(project), m_project(project)
|
||||
QbsBuildSystem::QbsBuildSystem(Project *project)
|
||||
: BuildSystem(project)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -449,7 +449,7 @@ RemovedFilesFromProject QbsBuildSystem::removeFiles(Node *context, const QString
|
||||
return RemovedFilesFromProject::Error;
|
||||
}
|
||||
|
||||
return m_project->removeFilesFromProduct(filePaths, prdNode->qbsProductData(),
|
||||
return project()->removeFilesFromProduct(filePaths, prdNode->qbsProductData(),
|
||||
n->m_qbsGroupData, notRemoved);
|
||||
}
|
||||
|
||||
@@ -486,7 +486,7 @@ bool QbsBuildSystem::renameFile(Node *context, const QString &filePath, const QS
|
||||
if (!prdNode || !prdNode->qbsProductData().isValid())
|
||||
return false;
|
||||
|
||||
return m_project->renameFileInProduct(filePath, newFilePath,
|
||||
return project()->renameFileInProduct(filePath, newFilePath,
|
||||
prdNode->qbsProductData(), n->m_qbsGroupData);
|
||||
}
|
||||
|
||||
@@ -502,5 +502,10 @@ bool QbsBuildSystem::renameFile(Node *context, const QString &filePath, const QS
|
||||
return BuildSystem::renameFile(context, filePath, newFilePath);
|
||||
}
|
||||
|
||||
QbsProject *QbsBuildSystem::project() const
|
||||
{
|
||||
return static_cast<QbsProject *>(BuildSystem::project());
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QbsProjectManager
|
||||
|
||||
@@ -39,7 +39,7 @@ class QbsProject;
|
||||
class QbsBuildSystem : public ProjectExplorer::BuildSystem
|
||||
{
|
||||
public:
|
||||
explicit QbsBuildSystem(QbsProject *project);
|
||||
explicit QbsBuildSystem(ProjectExplorer::Project *project);
|
||||
|
||||
bool supportsAction(ProjectExplorer::Node *context,
|
||||
ProjectExplorer::ProjectAction action,
|
||||
@@ -53,8 +53,7 @@ public:
|
||||
bool renameFile(ProjectExplorer::Node *context,
|
||||
const QString &filePath, const QString &newFilePath) override;
|
||||
|
||||
private:
|
||||
QbsProject *m_project = nullptr;
|
||||
QbsProject *project() const;
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -135,7 +135,7 @@ QbsProject::QbsProject(const FilePath &fileName)
|
||||
setProjectLanguages(Context(ProjectExplorer::Constants::CXX_LANGUAGE_ID));
|
||||
setCanBuildProducts();
|
||||
|
||||
setBuildSystem(std::make_unique<QbsBuildSystem>(this));
|
||||
setBuildSystemCreator([](Project *p) { return new QbsBuildSystem(p); });
|
||||
|
||||
rebuildProjectTree();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user