forked from qt-creator/qt-creator
QbsProjectManager: Fix infinite loop on per-product build.
- Setting the QFuture result is not enough, we also need to emit the finished() signal. - Never fail silently; use soft asserts for things that shouldn't happen and compile pane output for things that can. Task-number: QBS-705 Change-Id: I4dad18c2ad573a92f2a0c5aa92b596851c56541e Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
@@ -365,10 +365,12 @@ void QbsBuildStep::build()
|
|||||||
options.setFilesToConsider(m_changedFiles);
|
options.setFilesToConsider(m_changedFiles);
|
||||||
options.setActiveFileTags(m_activeFileTags);
|
options.setActiveFileTags(m_activeFileTags);
|
||||||
|
|
||||||
m_job = qbsProject()->build(options, m_products);
|
QString error;
|
||||||
|
m_job = qbsProject()->build(options, m_products, error);
|
||||||
if (!m_job) {
|
if (!m_job) {
|
||||||
|
emit addOutput(error, ErrorMessageOutput);
|
||||||
m_fi->reportResult(false);
|
m_fi->reportResult(false);
|
||||||
|
emit finished();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -105,6 +105,7 @@ void QbsCleanStep::run(QFutureInterface<bool> &fi)
|
|||||||
|
|
||||||
if (!m_job) {
|
if (!m_job) {
|
||||||
m_fi->reportResult(false);
|
m_fi->reportResult(false);
|
||||||
|
emit finished();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -98,6 +98,7 @@ void QbsInstallStep::run(QFutureInterface<bool> &fi)
|
|||||||
|
|
||||||
if (!m_job) {
|
if (!m_job) {
|
||||||
m_fi->reportResult(false);
|
m_fi->reportResult(false);
|
||||||
|
emit finished();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -344,13 +344,15 @@ void QbsProject::invalidate()
|
|||||||
prepareForParsing();
|
prepareForParsing();
|
||||||
}
|
}
|
||||||
|
|
||||||
qbs::BuildJob *QbsProject::build(const qbs::BuildOptions &opts, QStringList productNames)
|
qbs::BuildJob *QbsProject::build(const qbs::BuildOptions &opts, QStringList productNames,
|
||||||
|
QString &error)
|
||||||
{
|
{
|
||||||
if (!qbsProject().isValid() || isParsing())
|
QTC_ASSERT(qbsProject().isValid(), return 0);
|
||||||
return 0;
|
QTC_ASSERT(!isParsing(), return 0);
|
||||||
if (productNames.isEmpty()) {
|
|
||||||
|
if (productNames.isEmpty())
|
||||||
return qbsProject().buildAllProducts(opts);
|
return qbsProject().buildAllProducts(opts);
|
||||||
} else {
|
|
||||||
QList<qbs::ProductData> products;
|
QList<qbs::ProductData> products;
|
||||||
foreach (const QString &productName, productNames) {
|
foreach (const QString &productName, productNames) {
|
||||||
bool found = false;
|
bool found = false;
|
||||||
@@ -361,12 +363,13 @@ qbs::BuildJob *QbsProject::build(const qbs::BuildOptions &opts, QStringList prod
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found)
|
if (!found) {
|
||||||
|
error = QLatin1String("Cannot build: Selected products do not exist anymore."); // TODO: Use tr() in 3.4
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return qbsProject().buildSomeProducts(products, opts);
|
return qbsProject().buildSomeProducts(products, opts);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
qbs::CleanJob *QbsProject::clean(const qbs::CleanOptions &opts)
|
qbs::CleanJob *QbsProject::clean(const qbs::CleanOptions &opts)
|
||||||
|
@@ -84,7 +84,7 @@ public:
|
|||||||
const QString &newPath, const qbs::ProductData &productData,
|
const QString &newPath, const qbs::ProductData &productData,
|
||||||
const qbs::GroupData &groupData);
|
const qbs::GroupData &groupData);
|
||||||
|
|
||||||
qbs::BuildJob *build(const qbs::BuildOptions &opts, QStringList products = QStringList());
|
qbs::BuildJob *build(const qbs::BuildOptions &opts, QStringList products, QString &error);
|
||||||
qbs::CleanJob *clean(const qbs::CleanOptions &opts);
|
qbs::CleanJob *clean(const qbs::CleanOptions &opts);
|
||||||
qbs::InstallJob *install(const qbs::InstallOptions &opts);
|
qbs::InstallJob *install(const qbs::InstallOptions &opts);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user