aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/designer
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2019-10-25 09:55:32 +0200
committerhjk <hjk@qt.io>2019-11-19 11:05:52 +0000
commit27586827238ca9079860e77a7b23ae20d163143e (patch)
tree2197dc7f97a4a70524381071888336558dc0b4a3 /src/plugins/designer
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 <christian.stenger@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/plugins/designer')
-rw-r--r--src/plugins/designer/codemodelhelpers.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/plugins/designer/codemodelhelpers.cpp b/src/plugins/designer/codemodelhelpers.cpp
index 5f3422e412..f57f1081d2 100644
--- a/src/plugins/designer/codemodelhelpers.cpp
+++ b/src/plugins/designer/codemodelhelpers.cpp
@@ -27,15 +27,19 @@
#include <cpptools/cppmodelmanager.h>
+#include <projectexplorer/buildsystem.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/session.h>
+#include <projectexplorer/target.h>
#include <QCoreApplication>
#include <QDebug>
// Debug helpers for code model. @todo: Move to some CppTools library?
+using namespace ProjectExplorer;
+
typedef QMap<QString, QStringList> DependencyMap;
typedef CPlusPlus::Document::Ptr DocumentPtr;
typedef QList<CPlusPlus::Symbol *> SymbolList;
@@ -46,11 +50,15 @@ static const char setupUiC[] = "setupUi";
// Find the generated "ui_form.h" header of the form via project.
static QString generatedHeaderOf(const QString &uiFileName)
{
- if (const ProjectExplorer::Project *uiProject =
- ProjectExplorer::SessionManager::projectForFile(Utils::FilePath::fromString(uiFileName))) {
- QStringList files = uiProject->filesGeneratedFrom(uiFileName);
- if (!files.isEmpty()) // There should be at most one header generated from a .ui
- return files.front();
+ if (const Project *uiProject =
+ SessionManager::projectForFile(Utils::FilePath::fromString(uiFileName))) {
+ if (Target *t = uiProject->activeTarget()) {
+ if (BuildSystem *bs = t->buildSystem()) {
+ QStringList files = bs->filesGeneratedFrom(uiFileName);
+ if (!files.isEmpty()) // There should be at most one header generated from a .ui
+ return files.front();
+ }
+ }
}
return QString();
}