diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2018-01-04 16:13:03 +0100 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2018-10-22 09:55:30 +0000 |
commit | d8ab3491e22e56b1e15fa46f259bdf8052bb137f (patch) | |
tree | 80272a19cfc804f1be9c89b9ebda94ca5cbd048d /src | |
parent | 54c1cb6bc37c82cbfa688e360e880c2e72198785 (diff) |
Executor: Increment progress bar after a rule's transformers are done
... rather than after the prepare script has run. This gives a more
realistic estimate on average.
Fixes: QTCREATORBUG-18523
Change-Id: I61214903936f964e060b92238d5644f0a8414539
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/corelib/buildgraph/executor.cpp | 21 | ||||
-rw-r--r-- | src/lib/corelib/buildgraph/executor.h | 1 | ||||
-rw-r--r-- | src/lib/corelib/buildgraph/rulenode.cpp | 8 | ||||
-rw-r--r-- | src/lib/corelib/buildgraph/rulenode.h | 2 |
4 files changed, 30 insertions, 2 deletions
diff --git a/src/lib/corelib/buildgraph/executor.cpp b/src/lib/corelib/buildgraph/executor.cpp index 7b1e92f18..0558980d6 100644 --- a/src/lib/corelib/buildgraph/executor.cpp +++ b/src/lib/corelib/buildgraph/executor.cpp @@ -543,9 +543,18 @@ void Executor::executeRuleNode(RuleNode *ruleNode) updateLeaves(result.createdArtifacts); updateLeaves(result.invalidatedArtifacts); m_artifactsRemovedFromDisk << result.removedArtifacts; + + if (m_progressObserver) { + const int transformerCount = ruleNode->transformerCount(); + if (transformerCount == 0) { + m_progressObserver->incrementProgressValue(); + } else { + m_pendingTransformersPerRule.insert(std::make_pair(ruleNode->rule().get(), + transformerCount)); + } + } + finishNode(ruleNode); - if (m_progressObserver) - m_progressObserver->incrementProgressValue(); } void Executor::finishJob(ExecutorJob *job, bool success) @@ -1014,6 +1023,14 @@ void Executor::finishTransformer(const TransformerPtr &transformer) possiblyInstallArtifact(artifact); finishArtifact(artifact); } + if (m_progressObserver) { + const auto it = m_pendingTransformersPerRule.find(transformer->rule.get()); + QBS_CHECK(it != m_pendingTransformersPerRule.cend()); + if (--it->second == 0) { + m_progressObserver->incrementProgressValue(); + m_pendingTransformersPerRule.erase(it); + } + } } void Executor::possiblyInstallArtifact(const Artifact *artifact) diff --git a/src/lib/corelib/buildgraph/executor.h b/src/lib/corelib/buildgraph/executor.h index 79391d346..2756a7120 100644 --- a/src/lib/corelib/buildgraph/executor.h +++ b/src/lib/corelib/buildgraph/executor.h @@ -175,6 +175,7 @@ private: std::unordered_map<QString, const ResolvedProject *> m_projectsByName; std::unordered_map<QString, int> m_jobCountPerPool; std::unordered_map<const ResolvedProduct *, JobLimits> m_jobLimitsPerProduct; + std::unordered_map<const Rule *, int> m_pendingTransformersPerRule; NodeSet m_roots; Leaves m_leaves; InputArtifactScannerContext *m_inputArtifactScanContext; diff --git a/src/lib/corelib/buildgraph/rulenode.cpp b/src/lib/corelib/buildgraph/rulenode.cpp index 6f9084637..516b9b830 100644 --- a/src/lib/corelib/buildgraph/rulenode.cpp +++ b/src/lib/corelib/buildgraph/rulenode.cpp @@ -222,6 +222,14 @@ void RuleNode::store(PersistentPool &pool) serializationOp<PersistentPool::Store>(pool); } +int RuleNode::transformerCount() const +{ + Set<const Transformer *> transformers; + for (const Artifact * const output : filterByType<Artifact>(parents)) + transformers.insert(output->transformer.get()); + return transformers.size(); +} + ArtifactSet RuleNode::currentInputArtifacts() const { ArtifactSet s; diff --git a/src/lib/corelib/buildgraph/rulenode.h b/src/lib/corelib/buildgraph/rulenode.h index 406afff9f..0585678ec 100644 --- a/src/lib/corelib/buildgraph/rulenode.h +++ b/src/lib/corelib/buildgraph/rulenode.h @@ -83,6 +83,8 @@ public: void load(PersistentPool &pool) override; void store(PersistentPool &pool) override; + int transformerCount() const; + private: template<PersistentPool::OpType opType> void serializationOp(PersistentPool &pool) { |