diff --git a/src/plugins/projectexplorer/runcontrol.cpp b/src/plugins/projectexplorer/runcontrol.cpp index 117483f0ce3..ffc9b3fa357 100644 --- a/src/plugins/projectexplorer/runcontrol.cpp +++ b/src/plugins/projectexplorer/runcontrol.cpp @@ -1955,6 +1955,24 @@ ProcessRunnerFactory::ProcessRunnerFactory(const QList &runConfigs) setSupportedRunConfigs(runConfigs); } +void RecipeRunner::start() +{ + QTC_CHECK(!m_taskTreeRunner.isRunning()); + m_taskTreeRunner.start(m_recipe, {}, [this](DoneWith result) { + if (result == DoneWith::Success) + reportStopped(); + else + reportFailure(); + }); + reportStarted(); +} + +void RecipeRunner::stop() +{ + m_taskTreeRunner.cancel(); + reportStopped(); +} + } // namespace ProjectExplorer #include "runcontrol.moc" diff --git a/src/plugins/projectexplorer/runcontrol.h b/src/plugins/projectexplorer/runcontrol.h index 871b53dfe69..948d4faf355 100644 --- a/src/plugins/projectexplorer/runcontrol.h +++ b/src/plugins/projectexplorer/runcontrol.h @@ -6,6 +6,8 @@ #include "devicesupport/idevicefwd.h" #include "runconfiguration.h" +#include + #include #include #include @@ -20,8 +22,6 @@ #include #include -namespace Tasking { class Group; } - namespace Utils { class Icon; class MacroExpander; @@ -304,4 +304,20 @@ void addOutputParserFactory(const std::function createOutputParsers(Target *target); +class PROJECTEXPLORER_EXPORT RecipeRunner final : public RunWorker +{ +public: + explicit RecipeRunner(RunControl *runControl) + : RunWorker(runControl) {} + + void setRecipe(const Tasking::Group &recipe) { m_recipe = recipe; } + +private: + void start() final; + void stop() final; + + Tasking::TaskTreeRunner m_taskTreeRunner; + Tasking::Group m_recipe = {}; +}; + } // namespace ProjectExplorer