forked from qt-creator/qt-creator
BuildStep: Make it possible to run with task tree
Move the doRun() implementation from AbstractProcessStep and from AbstractRemoteLinuxDeployStep into BuildStep. Do the same with doCancel(). Task-number: QTCREATORBUG-29168 Change-Id: I767f73dc7408d7c5a9fe9821da92e664cf1ed8f3 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -72,7 +72,6 @@ public:
|
||||
Private(AbstractProcessStep *q) : q(q) {}
|
||||
|
||||
AbstractProcessStep *q;
|
||||
std::unique_ptr<TaskTree> m_taskTree;
|
||||
ProcessParameters m_param;
|
||||
ProcessParameters *m_displayedParams = &m_param;
|
||||
std::function<CommandLine()> m_commandLineProvider;
|
||||
@@ -144,7 +143,7 @@ void AbstractProcessStep::setWorkingDirectoryProvider(const std::function<FilePa
|
||||
|
||||
bool AbstractProcessStep::init()
|
||||
{
|
||||
if (d->m_taskTree)
|
||||
if (!BuildStep::init())
|
||||
return false;
|
||||
|
||||
if (!setupProcessParameters(processParameters()))
|
||||
@@ -163,30 +162,6 @@ void AbstractProcessStep::setupOutputFormatter(OutputFormatter *formatter)
|
||||
BuildStep::setupOutputFormatter(formatter);
|
||||
}
|
||||
|
||||
/*!
|
||||
Reimplemented from BuildStep::init(). You need to call this from
|
||||
YourBuildStep::run().
|
||||
*/
|
||||
|
||||
void AbstractProcessStep::doRun()
|
||||
{
|
||||
QTC_ASSERT(!d->m_taskTree, return);
|
||||
|
||||
d->m_taskTree.reset(new TaskTree({runRecipe()}));
|
||||
connect(d->m_taskTree.get(), &TaskTree::progressValueChanged, this, [this](int value) {
|
||||
emit progress(qRound(double(value) * 100 / std::max(d->m_taskTree->progressMaximum(), 1)), {});
|
||||
});
|
||||
connect(d->m_taskTree.get(), &TaskTree::done, this, [this] {
|
||||
d->m_taskTree.release()->deleteLater();
|
||||
emit finished(true);
|
||||
});
|
||||
connect(d->m_taskTree.get(), &TaskTree::errorOccurred, this, [this] {
|
||||
d->m_taskTree.release()->deleteLater();
|
||||
emit finished(false);
|
||||
});
|
||||
d->m_taskTree->start();
|
||||
}
|
||||
|
||||
GroupItem AbstractProcessStep::defaultProcessTask()
|
||||
{
|
||||
const auto onSetup = [this](Process &process) {
|
||||
@@ -269,16 +244,6 @@ void AbstractProcessStep::setLowPriority()
|
||||
d->m_lowPriority = true;
|
||||
}
|
||||
|
||||
void AbstractProcessStep::doCancel()
|
||||
{
|
||||
if (!d->m_taskTree)
|
||||
return;
|
||||
|
||||
d->m_taskTree.reset();
|
||||
emit addOutput(Tr::tr("The build step was ended forcefully."), OutputFormat::ErrorMessage);
|
||||
emit finished(false);
|
||||
}
|
||||
|
||||
ProcessParameters *AbstractProcessStep::processParameters()
|
||||
{
|
||||
return &d->m_param;
|
||||
|
||||
Reference in New Issue
Block a user