ProjectExplorer: Introduce RecipeRunner

For running pure task tree recipes.

Task-number: QTCREATORBUG-29168
Change-Id: Ia6690b7f7e0fb007ff3baf44ed4f01265ca937b6
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2025-02-20 14:24:49 +01:00
parent 4348a2fc56
commit 2a9fe2704e
2 changed files with 36 additions and 2 deletions

View File

@@ -1955,6 +1955,24 @@ ProcessRunnerFactory::ProcessRunnerFactory(const QList<Id> &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"

View File

@@ -6,6 +6,8 @@
#include "devicesupport/idevicefwd.h"
#include "runconfiguration.h"
#include <solutions/tasking/tasktreerunner.h>
#include <utils/commandline.h>
#include <utils/environment.h>
#include <utils/outputformatter.h>
@@ -20,8 +22,6 @@
#include <functional>
#include <memory>
namespace Tasking { class Group; }
namespace Utils {
class Icon;
class MacroExpander;
@@ -304,4 +304,20 @@ void addOutputParserFactory(const std::function<Utils::OutputLineParser *(Target
PROJECTEXPLORER_EXPORT QList<Utils::OutputLineParser *> 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