forked from qt-creator/qt-creator
RecipeRunner: Make cancellation more general
Make it possible to continue cleanup tasks after the canceled() signal has been sent. Change-Id: I8c59549fdb30fa9bf8a800ce3835c12e2d204553 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -1964,7 +1964,15 @@ Canceler canceler()
|
||||
void RecipeRunner::start()
|
||||
{
|
||||
QTC_CHECK(!m_taskTreeRunner.isRunning());
|
||||
m_taskTreeRunner.start(m_recipe, {}, [this](DoneWith result) {
|
||||
|
||||
const Group recipe {
|
||||
runStorage(),
|
||||
onGroupSetup([this] { connect(this, &RecipeRunner::canceled,
|
||||
runStorage().activeStorage(), &RunInterface::canceled); }),
|
||||
m_recipe
|
||||
};
|
||||
|
||||
m_taskTreeRunner.start(recipe, {}, [this](DoneWith result) {
|
||||
if (result == DoneWith::Success)
|
||||
reportStopped();
|
||||
else
|
||||
@@ -1975,8 +1983,7 @@ void RecipeRunner::start()
|
||||
|
||||
void RecipeRunner::stop()
|
||||
{
|
||||
m_taskTreeRunner.cancel();
|
||||
reportStopped();
|
||||
emit canceled();
|
||||
}
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
@@ -298,7 +298,6 @@ public:
|
||||
explicit ProcessRunnerFactory(const QList<Utils::Id> &runConfig);
|
||||
};
|
||||
|
||||
|
||||
PROJECTEXPLORER_EXPORT
|
||||
void addOutputParserFactory(const std::function<Utils::OutputLineParser *(Target *)> &);
|
||||
|
||||
@@ -318,12 +317,17 @@ PROJECTEXPLORER_EXPORT Canceler canceler();
|
||||
|
||||
class PROJECTEXPLORER_EXPORT RecipeRunner final : public RunWorker
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit RecipeRunner(RunControl *runControl)
|
||||
: RunWorker(runControl) {}
|
||||
|
||||
void setRecipe(const Tasking::Group &recipe) { m_recipe = recipe; }
|
||||
|
||||
signals:
|
||||
void canceled();
|
||||
|
||||
private:
|
||||
void start() final;
|
||||
void stop() final;
|
||||
|
@@ -84,13 +84,13 @@ Group slog2InfoRecipe(RunControl *runControl)
|
||||
storage->processRemainingLogData();
|
||||
};
|
||||
|
||||
return {
|
||||
return Group {
|
||||
storage,
|
||||
ProcessTask(onTestSetup, onTestDone, CallDoneIf::Error),
|
||||
ProcessTask(onLaunchTimeSetup, onLaunchTimeDone, CallDoneIf::Success),
|
||||
ProcessTask(onLogSetup, onLogError, CallDoneIf::Error),
|
||||
onGroupDone(onCanceled, CallDoneIf::Error)
|
||||
};
|
||||
}.withCancel(canceler());
|
||||
}
|
||||
|
||||
void SlogData::processRemainingLogData()
|
||||
|
Reference in New Issue
Block a user