diff options
author | Christian Kandeler <christian.kandeler@theqtcompany.com> | 2016-03-02 16:38:00 +0100 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@theqtcompany.com> | 2016-03-07 09:16:01 +0000 |
commit | a57e75884e4526e32192ad5c96f3101ad0e9b58a (patch) | |
tree | 1879c339359de7785080ce63e59ff5a640c34e6b /src/plugins/qbsprojectmanager/qbsprojectparser.cpp | |
parent | da3f3eecc53e1ae592ba74da62b21493cfaf2144 (diff) | |
download | qt-creator-a57e75884e4526e32192ad5c96f3101ad0e9b58a.tar.gz |
QbsProjectManager: Execute rules when parsing a project.
This makes information about build artifacts available before the actual
build starts (as far as the rule implementations allow that), at the
cost of a higher initial project resolving time.
Task-number: QBS-901
Change-Id: I0a223db85001136d359a53d4edc7239350f01701
Reviewed-by: Ulf Hermann <ulf.hermann@theqtcompany.com>
Reviewed-by: Jake Petroules <jake.petroules@theqtcompany.com>
Diffstat (limited to 'src/plugins/qbsprojectmanager/qbsprojectparser.cpp')
-rw-r--r-- | src/plugins/qbsprojectmanager/qbsprojectparser.cpp | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/src/plugins/qbsprojectmanager/qbsprojectparser.cpp b/src/plugins/qbsprojectmanager/qbsprojectparser.cpp index a31435f429..77b0ebbb80 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectparser.cpp +++ b/src/plugins/qbsprojectmanager/qbsprojectparser.cpp @@ -49,6 +49,7 @@ namespace Internal { QbsProjectParser::QbsProjectParser(QbsProject *project, QFutureInterface<bool> *fi) : m_qbsSetupProjectJob(0), + m_ruleExecutionJob(0), m_fi(fi), m_currentProgressBase(0) { @@ -64,6 +65,12 @@ QbsProjectParser::~QbsProjectParser() m_qbsSetupProjectJob->deleteLater(); m_qbsSetupProjectJob = 0; } + if (m_ruleExecutionJob) { + m_ruleExecutionJob->disconnect(this); + m_ruleExecutionJob->cancel(); + m_ruleExecutionJob->deleteLater(); + m_ruleExecutionJob = 0; + } m_fi = 0; // we do not own m_fi, do not delete } @@ -110,7 +117,10 @@ void QbsProjectParser::parse(const QVariantMap &config, const Environment &env, void QbsProjectParser::cancel() { QTC_ASSERT(m_qbsSetupProjectJob, return); - m_qbsSetupProjectJob->cancel(); + if (m_ruleExecutionJob) + m_ruleExecutionJob->cancel(); + else + m_qbsSetupProjectJob->cancel(); } qbs::Project QbsProjectParser::qbsProject() const @@ -133,7 +143,33 @@ void QbsProjectParser::handleQbsParsingDone(bool success) // Do not report the operation as canceled here, as we might want to make overlapping // parses appear atomic to the user. - emit done(success); + if (!success) + emit done(false); + else + startRuleExecution(); +} + +void QbsProjectParser::startRuleExecution() +{ + qbs::BuildOptions options; + options.setExecuteRulesOnly(true); + m_ruleExecutionJob = m_project.buildAllProducts( + options, qbs::Project::ProductSelectionWithNonDefault, this); + connect(m_ruleExecutionJob, &qbs::AbstractJob::finished, + this, &QbsProjectParser::handleRuleExecutionDone); + connect(m_ruleExecutionJob, &qbs::AbstractJob::taskStarted, + this, &QbsProjectParser::handleQbsParsingTaskSetup); + connect(m_ruleExecutionJob, &qbs::AbstractJob::taskProgress, + this, &QbsProjectParser::handleQbsParsingProgress); +} + +void QbsProjectParser::handleRuleExecutionDone() +{ + QTC_ASSERT(m_ruleExecutionJob, return); + // We always report success here, since execution of some very dynamic rules might fail due + // to artifacts not being present. No genuine errors will get lost, as they will re-appear + // on the next build attempt. + emit done(true); } void QbsProjectParser::handleQbsParsingProgress(int progress) |