forked from qt-creator/qt-creator
QbsProjectManager: Have one qbs::Project per target
The class qbs::Project corresponds to a Qt Creator target, not to a Qt Creator project. It represents a project set up for a particular configuration. Task-number: QTCREATORBUG-16545 Change-Id: I9e4fa6a4bf763e49335f294609d7465545df4559 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
committed by
Christian Kandeler
parent
9ac9211d64
commit
2b3d4685db
@@ -119,6 +119,7 @@ QbsProject::QbsProject(QbsManager *manager, const QString &fileName) :
|
|||||||
|
|
||||||
connect(this, &Project::activeTargetChanged, this, &QbsProject::changeActiveTarget);
|
connect(this, &Project::activeTargetChanged, this, &QbsProject::changeActiveTarget);
|
||||||
connect(this, &Project::addedTarget, this, &QbsProject::targetWasAdded);
|
connect(this, &Project::addedTarget, this, &QbsProject::targetWasAdded);
|
||||||
|
connect(this, &Project::removedTarget, this, &QbsProject::targetWasRemoved);
|
||||||
connect(this, &Project::environmentChanged, this, &QbsProject::delayParsing);
|
connect(this, &Project::environmentChanged, this, &QbsProject::delayParsing);
|
||||||
|
|
||||||
connect(&m_parsingDelay, &QTimer::timeout, this, &QbsProject::startParsing);
|
connect(&m_parsingDelay, &QTimer::timeout, this, &QbsProject::startParsing);
|
||||||
@@ -469,6 +470,7 @@ void QbsProject::handleQbsParsingDone(bool success)
|
|||||||
generateErrors(m_qbsProjectParser->error());
|
generateErrors(m_qbsProjectParser->error());
|
||||||
|
|
||||||
m_qbsProject = m_qbsProjectParser->qbsProject();
|
m_qbsProject = m_qbsProjectParser->qbsProject();
|
||||||
|
m_qbsProjects.insert(activeTarget(), m_qbsProject);
|
||||||
bool dataChanged = false;
|
bool dataChanged = false;
|
||||||
if (success) {
|
if (success) {
|
||||||
QTC_ASSERT(m_qbsProject.isValid(), return);
|
QTC_ASSERT(m_qbsProject.isValid(), return);
|
||||||
@@ -529,15 +531,26 @@ void QbsProject::handleRuleExecutionDone()
|
|||||||
|
|
||||||
void QbsProject::targetWasAdded(Target *t)
|
void QbsProject::targetWasAdded(Target *t)
|
||||||
{
|
{
|
||||||
|
m_qbsProjects.insert(t, qbs::Project());
|
||||||
connect(t, &Target::activeBuildConfigurationChanged, this, &QbsProject::delayParsing);
|
connect(t, &Target::activeBuildConfigurationChanged, this, &QbsProject::delayParsing);
|
||||||
connect(t, &Target::buildDirectoryChanged, this, &QbsProject::delayParsing);
|
connect(t, &Target::buildDirectoryChanged, this, &QbsProject::delayParsing);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QbsProject::targetWasRemoved(Target *t)
|
||||||
|
{
|
||||||
|
m_qbsProjects.remove(t);
|
||||||
|
}
|
||||||
|
|
||||||
void QbsProject::changeActiveTarget(Target *t)
|
void QbsProject::changeActiveTarget(Target *t)
|
||||||
{
|
{
|
||||||
BuildConfiguration *bc = 0;
|
BuildConfiguration *bc = 0;
|
||||||
if (t && t->kit())
|
if (t) {
|
||||||
bc = t->activeBuildConfiguration();
|
m_qbsProject = m_qbsProjects.value(t);
|
||||||
|
if (m_qbsProject.isValid())
|
||||||
|
m_projectData = m_qbsProject.projectData();
|
||||||
|
if (t->kit())
|
||||||
|
bc = t->activeBuildConfiguration();
|
||||||
|
}
|
||||||
buildConfigurationChanged(bc);
|
buildConfigurationChanged(bc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -41,6 +41,7 @@
|
|||||||
#include <qbs.h>
|
#include <qbs.h>
|
||||||
|
|
||||||
#include <QFuture>
|
#include <QFuture>
|
||||||
|
#include <QHash>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
namespace Core { class IDocument; }
|
namespace Core { class IDocument; }
|
||||||
@@ -118,6 +119,7 @@ private:
|
|||||||
void handleQbsParsingDone(bool success);
|
void handleQbsParsingDone(bool success);
|
||||||
|
|
||||||
void targetWasAdded(ProjectExplorer::Target *t);
|
void targetWasAdded(ProjectExplorer::Target *t);
|
||||||
|
void targetWasRemoved(ProjectExplorer::Target *t);
|
||||||
void changeActiveTarget(ProjectExplorer::Target *t);
|
void changeActiveTarget(ProjectExplorer::Target *t);
|
||||||
void buildConfigurationChanged(ProjectExplorer::BuildConfiguration *bc);
|
void buildConfigurationChanged(ProjectExplorer::BuildConfiguration *bc);
|
||||||
void startParsing();
|
void startParsing();
|
||||||
@@ -145,6 +147,7 @@ private:
|
|||||||
const qbs::GroupData &oldGroup);
|
const qbs::GroupData &oldGroup);
|
||||||
|
|
||||||
const QString m_projectName;
|
const QString m_projectName;
|
||||||
|
QHash<ProjectExplorer::Target *, qbs::Project> m_qbsProjects;
|
||||||
qbs::Project m_qbsProject;
|
qbs::Project m_qbsProject;
|
||||||
qbs::ProjectData m_projectData;
|
qbs::ProjectData m_projectData;
|
||||||
QSet<Core::IDocument *> m_qbsDocuments;
|
QSet<Core::IDocument *> m_qbsDocuments;
|
||||||
|
Reference in New Issue
Block a user