aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/corelib/buildgraph/executor.cpp32
-rw-r--r--src/lib/corelib/buildgraph/rulesevaluationcontext.cpp5
-rw-r--r--src/lib/corelib/buildgraph/rulesevaluationcontext.h1
3 files changed, 27 insertions, 11 deletions
diff --git a/src/lib/corelib/buildgraph/executor.cpp b/src/lib/corelib/buildgraph/executor.cpp
index 8a028f0dd..7cfc3137a 100644
--- a/src/lib/corelib/buildgraph/executor.cpp
+++ b/src/lib/corelib/buildgraph/executor.cpp
@@ -435,6 +435,7 @@ void Executor::buildArtifact(Artifact *artifact)
void Executor::executeRuleNode(RuleNode *ruleNode)
{
+ QBS_CHECK(!m_evalContext->isActive());
ArtifactSet changedInputArtifacts;
if (ruleNode->rule()->isDynamic()) {
foreach (Artifact *artifact, m_changedSourceArtifacts) {
@@ -891,20 +892,28 @@ void Executor::possiblyInstallArtifact(const Artifact *artifact)
void Executor::onJobFinished(const qbs::ErrorInfo &err)
{
- if (err.hasError()) {
- if (m_buildOptions.keepGoing()) {
- ErrorInfo fullWarning(err);
- fullWarning.prepend(Tr::tr("Ignoring the following errors on user request:"));
- m_logger.printWarning(fullWarning);
- } else {
- if (!m_error.hasError())
- m_error = err; // All but the first one could be due to canceling.
- }
- }
-
try {
ExecutorJob * const job = qobject_cast<ExecutorJob *>(sender());
QBS_CHECK(job);
+ if (m_evalContext->isActive()) {
+ m_logger.qbsDebug() << "Executor job finished while rule execution is pausing. "
+ "Delaying slot execution.";
+ QMetaObject::invokeMethod(job, "finished", Qt::QueuedConnection,
+ Q_ARG(qbs::ErrorInfo, err));
+ return;
+ }
+
+ if (err.hasError()) {
+ if (m_buildOptions.keepGoing()) {
+ ErrorInfo fullWarning(err);
+ fullWarning.prepend(Tr::tr("Ignoring the following errors on user request:"));
+ m_logger.printWarning(fullWarning);
+ } else {
+ if (!m_error.hasError())
+ m_error = err; // All but the first one could be due to canceling.
+ }
+ }
+
finishJob(job, !err.hasError());
} catch (const ErrorInfo &error) {
handleError(error);
@@ -914,6 +923,7 @@ void Executor::onJobFinished(const qbs::ErrorInfo &err)
void Executor::finish()
{
QBS_ASSERT(m_state != ExecutorIdle, /* ignore */);
+ QBS_ASSERT(!m_evalContext || !m_evalContext->isActive(), /* ignore */);
QList<ResolvedProductPtr> unbuiltProducts;
foreach (const ResolvedProductPtr &product, m_productsToBuild) {
diff --git a/src/lib/corelib/buildgraph/rulesevaluationcontext.cpp b/src/lib/corelib/buildgraph/rulesevaluationcontext.cpp
index 1f412b454..eed00cdac 100644
--- a/src/lib/corelib/buildgraph/rulesevaluationcontext.cpp
+++ b/src/lib/corelib/buildgraph/rulesevaluationcontext.cpp
@@ -58,6 +58,11 @@ RulesEvaluationContext::~RulesEvaluationContext()
delete m_engine;
}
+bool RulesEvaluationContext::isActive() const
+{
+ return m_initScopeCalls > 0;
+}
+
void RulesEvaluationContext::initializeObserver(const QString &description, int maximumProgress)
{
if (m_observer)
diff --git a/src/lib/corelib/buildgraph/rulesevaluationcontext.h b/src/lib/corelib/buildgraph/rulesevaluationcontext.h
index 274d9bcae..f00b2c44d 100644
--- a/src/lib/corelib/buildgraph/rulesevaluationcontext.h
+++ b/src/lib/corelib/buildgraph/rulesevaluationcontext.h
@@ -61,6 +61,7 @@ public:
ScriptEngine *engine() const { return m_engine; }
QScriptValue scope() const { return m_scope; }
+ bool isActive() const;
void setObserver(ProgressObserver *observer) { m_observer = observer; }
ProgressObserver *observer() const { return m_observer; }