aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmakeprojectmanager/qmakenodetreebuilder.cpp
diff options
context:
space:
mode:
authorhjk <[email protected]>2019-10-25 09:55:32 +0200
committerhjk <[email protected]>2019-11-19 11:05:52 +0000
commit27586827238ca9079860e77a7b23ae20d163143e (patch)
tree2197dc7f97a4a70524381071888336558dc0b4a3 /src/plugins/qmakeprojectmanager/qmakenodetreebuilder.cpp
parent9073c46c9c431ec0e83987a5781163ca7b1f7ea7 (diff)
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 <[email protected]> Reviewed-by: Christian Kandeler <[email protected]>
Diffstat (limited to 'src/plugins/qmakeprojectmanager/qmakenodetreebuilder.cpp')
-rw-r--r--src/plugins/qmakeprojectmanager/qmakenodetreebuilder.cpp29
1 files changed, 17 insertions, 12 deletions
diff --git a/src/plugins/qmakeprojectmanager/qmakenodetreebuilder.cpp b/src/plugins/qmakeprojectmanager/qmakenodetreebuilder.cpp
index e02c037aa1d..18a73f768fb 100644
--- a/src/plugins/qmakeprojectmanager/qmakenodetreebuilder.cpp
+++ b/src/plugins/qmakeprojectmanager/qmakenodetreebuilder.cpp
@@ -42,6 +42,8 @@ using namespace ProjectExplorer;
using namespace QtSupport;
using namespace Utils;
+using namespace QmakeProjectManager::Internal;
+
namespace {
// Static cached data in struct QmakeStaticData providing information and icons
@@ -128,7 +130,10 @@ void clearQmakeStaticData()
namespace QmakeProjectManager {
-static void createTree(const QmakePriFile *pri, QmakePriFileNode *node, const FilePathList &toExclude)
+static void createTree(QmakeBuildSystem *buildSystem,
+ const QmakePriFile *pri,
+ QmakePriFileNode *node,
+ const FilePathList &toExclude)
{
QTC_ASSERT(pri, return);
QTC_ASSERT(node, return);
@@ -166,7 +171,7 @@ static void createTree(const QmakePriFile *pri, QmakePriFileNode *node, const Fi
if (type == FileType::Resource) {
for (const auto &file : newFilePaths) {
- auto vfs = pri->project()->qmakeVfs();
+ auto vfs = buildSystem->qmakeVfs();
QString contents;
QString errorMessage;
// Prefer the cumulative file if it's non-empty, based on the assumption
@@ -223,26 +228,26 @@ static void createTree(const QmakePriFile *pri, QmakePriFileNode *node, const Fi
for (QmakePriFile *c : pri->children()) {
std::unique_ptr<QmakePriFileNode> newNode;
if (auto pf = dynamic_cast<QmakeProFile *>(c))
- newNode = std::make_unique<QmakeProFileNode>(c->project(), c->filePath(), pf);
+ newNode = std::make_unique<QmakeProFileNode>(c->buildSystem(), c->filePath(), pf);
else
- newNode = std::make_unique<QmakePriFileNode>(c->project(), node->proFileNode(), c->filePath(), c);
- createTree(c, newNode.get(), toExclude);
+ newNode = std::make_unique<QmakePriFileNode>(c->buildSystem(), node->proFileNode(), c->filePath(), c);
+ createTree(buildSystem, c, newNode.get(), toExclude);
node->addNode(std::move(newNode));
}
}
-std::unique_ptr<QmakeProFileNode> QmakeNodeTreeBuilder::buildTree(QmakeProject *project)
+std::unique_ptr<QmakeProFileNode> QmakeNodeTreeBuilder::buildTree(QmakeBuildSystem *buildSystem)
{
// Remove qmake implementation details that litter up the project data:
- Target *t = project->activeTarget();
- Kit *k = t ? t->kit() : KitManager::defaultKit();
- BaseQtVersion *qt = k ? QtKitAspect::qtVersion(k) : nullptr;
+ Target *t = buildSystem->target();
+ BaseQtVersion *qt = QtKitAspect::qtVersion(t->kit());
const FilePathList toExclude = qt ? qt->directoriesToIgnoreInProjectTree() : FilePathList();
- auto root = std::make_unique<QmakeProFileNode>(project, project->projectFilePath(),
- project->rootProFile());
- createTree(project->rootProFile(), root.get(), toExclude);
+ auto root = std::make_unique<QmakeProFileNode>(buildSystem,
+ buildSystem->projectFilePath(),
+ buildSystem->rootProFile());
+ createTree(buildSystem, buildSystem->rootProFile(), root.get(), toExclude);
return root;
}