TaskTree: Rename TaskAction into SetupResult

It's only used as a return value from group's or task's
setup handler. It instructs the running task tree on
how to proceed further.

It addresses the 21th point in the bugreport below.

Task-number: QTCREATORBUG-28741
Change-Id: I25802c76b9e7bc044c6a38197935798d2da9ad02
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2023-06-16 21:33:59 +02:00
parent 52badc2fa6
commit 664d409489
17 changed files with 159 additions and 159 deletions

View File

@@ -83,14 +83,14 @@ public:
"It is possible that no barrier was added to the tree, "
"or the storage is not reachable from where it is referenced. "
"The WaitForBarrier task will finish with error. ");
return TaskAction::StopWithError;
return SetupResult::StopWithError;
}
Barrier *activeSharedBarrier = activeBarrier->barrier();
const std::optional<bool> result = activeSharedBarrier->result();
if (result.has_value())
return result.value() ? TaskAction::StopWithDone : TaskAction::StopWithError;
return result.value() ? SetupResult::StopWithDone : SetupResult::StopWithError;
QObject::connect(activeSharedBarrier, &Barrier::done, &barrier, &Barrier::stopWithResult);
return TaskAction::Continue;
return SetupResult::Continue;
}) {}
};

View File

@@ -236,7 +236,7 @@ private:
*/
/*!
\enum Tasking::TaskAction
\enum Tasking::SetupResult
This enum is optionally returned from the group's or task's setup handler function.
It instructs the running task tree on how to proceed after the setup handler's execution
@@ -264,21 +264,21 @@ private:
/*!
\typealias GroupItem::GroupSetupHandler
Type alias for \c std::function<TaskAction()>.
Type alias for \c std::function<SetupResult()>.
The GroupSetupHandler is used when constructing the onGroupSetup() element.
Any function with the above signature, when passed as a group setup handler,
will be called by the running task tree when the group execution starts.
The return value of the handler instructs the running group on how to proceed
after the handler's invocation is finished. The default return value of TaskAction::Continue
after the handler's invocation is finished. The default return value of SetupResult::Continue
instructs the group to continue running, i.e. to start executing its child tasks.
The return value of TaskAction::StopWithDone or TaskAction::StopWithError
The return value of SetupResult::StopWithDone or SetupResult::StopWithError
instructs the group to skip the child tasks' execution and finish immediately with
success or an error, respectively.
When the return type is either TaskAction::StopWithDone
of TaskAction::StopWithError, the group's done or error handler (if provided)
When the return type is either SetupResult::StopWithDone
of SetupResult::StopWithError, the group's done or error handler (if provided)
is called synchronously immediately afterwards.
\note Even if the group setup handler returns StopWithDone or StopWithError,
@@ -287,7 +287,7 @@ private:
The onGroupSetup() accepts also functions in the shortened form of \c std::function<void()>,
i.e. the return value is void. In this case it's assumed that the return value
is TaskAction::Continue by default.
is SetupResult::Continue by default.
\sa onGroupSetup()
*/
@@ -311,7 +311,7 @@ private:
Constructs a group's element holding the group setup handler.
The \a handler is invoked whenever the group starts.
The passed \a handler is either of \c std::function<TaskAction()> or \c std::function<void()>
The passed \a handler is either of \c std::function<SetupResult()> or \c std::function<void()>
type. For more information on possible argument type, refer to
\l {GroupItem::GroupSetupHandler}.
@@ -432,9 +432,9 @@ const GroupItem stopOnFinished = workflowPolicy(WorkflowPolicy::StopOnFinished);
const GroupItem finishAllAndDone = workflowPolicy(WorkflowPolicy::FinishAllAndDone);
const GroupItem finishAllAndError = workflowPolicy(WorkflowPolicy::FinishAllAndError);
static TaskAction toTaskAction(bool success)
static SetupResult toSetupResult(bool success)
{
return success ? TaskAction::StopWithDone : TaskAction::StopWithError;
return success ? SetupResult::StopWithDone : SetupResult::StopWithError;
}
bool TreeStorageBase::isValid() const
@@ -660,10 +660,10 @@ public:
TaskContainer(TaskTreePrivate *taskTreePrivate, const GroupItem &task,
TaskNode *parentNode, TaskContainer *parentContainer)
: m_constData(taskTreePrivate, task, parentNode, parentContainer, this) {}
TaskAction start();
TaskAction continueStart(TaskAction startAction, int nextChild);
TaskAction startChildren(int nextChild);
TaskAction childDone(bool success);
SetupResult start();
SetupResult continueStart(SetupResult startAction, int nextChild);
SetupResult startChildren(int nextChild);
SetupResult childDone(bool success);
void stop();
void invokeEndHandler();
bool isRunning() const { return m_runtimeData.has_value(); }
@@ -718,7 +718,7 @@ public:
// If returned value != Continue, childDone() needs to be called in parent container (in caller)
// in order to unwind properly.
TaskAction start();
SetupResult start();
void stop();
void invokeEndHandler(bool success);
bool isRunning() const { return m_task || m_container.isRunning(); }
@@ -947,34 +947,34 @@ int TaskContainer::RuntimeData::currentLimit() const
? qMin(m_doneCount + m_constData.m_parallelLimit, childCount) : childCount;
}
TaskAction TaskContainer::start()
SetupResult TaskContainer::start()
{
QTC_CHECK(!isRunning());
m_runtimeData.emplace(m_constData);
TaskAction startAction = TaskAction::Continue;
SetupResult startAction = SetupResult::Continue;
if (m_constData.m_groupHandler.m_setupHandler) {
startAction = invokeHandler(this, m_constData.m_groupHandler.m_setupHandler);
if (startAction != TaskAction::Continue) {
if (startAction != SetupResult::Continue) {
m_constData.m_taskTreePrivate->advanceProgress(m_constData.m_taskCount);
// Non-Continue TaskAction takes precedence over the workflow policy.
m_runtimeData->m_successBit = startAction == TaskAction::StopWithDone;
// Non-Continue SetupResult takes precedence over the workflow policy.
m_runtimeData->m_successBit = startAction == SetupResult::StopWithDone;
}
}
if (startAction == TaskAction::Continue) {
if (startAction == SetupResult::Continue) {
if (m_constData.m_children.isEmpty())
startAction = toTaskAction(m_runtimeData->m_successBit);
startAction = toSetupResult(m_runtimeData->m_successBit);
}
return continueStart(startAction, 0);
}
TaskAction TaskContainer::continueStart(TaskAction startAction, int nextChild)
SetupResult TaskContainer::continueStart(SetupResult startAction, int nextChild)
{
const TaskAction groupAction = startAction == TaskAction::Continue ? startChildren(nextChild)
const SetupResult groupAction = startAction == SetupResult::Continue ? startChildren(nextChild)
: startAction;
QTC_CHECK(isRunning()); // TODO: superfluous
if (groupAction != TaskAction::Continue) {
const bool success = m_runtimeData->updateSuccessBit(groupAction == TaskAction::StopWithDone);
if (groupAction != SetupResult::Continue) {
const bool success = m_runtimeData->updateSuccessBit(groupAction == SetupResult::StopWithDone);
invokeEndHandler();
if (TaskContainer *parentContainer = m_constData.m_parentContainer) {
QTC_CHECK(parentContainer->isRunning());
@@ -989,7 +989,7 @@ TaskAction TaskContainer::continueStart(TaskAction startAction, int nextChild)
return groupAction;
}
TaskAction TaskContainer::startChildren(int nextChild)
SetupResult TaskContainer::startChildren(int nextChild)
{
QTC_CHECK(isRunning());
GuardLocker locker(m_runtimeData->m_startGuard);
@@ -998,12 +998,12 @@ TaskAction TaskContainer::startChildren(int nextChild)
if (i >= limit)
break;
const TaskAction startAction = m_constData.m_children.at(i)->start();
if (startAction == TaskAction::Continue)
const SetupResult startAction = m_constData.m_children.at(i)->start();
if (startAction == SetupResult::Continue)
continue;
const TaskAction finalizeAction = childDone(startAction == TaskAction::StopWithDone);
if (finalizeAction == TaskAction::Continue)
const SetupResult finalizeAction = childDone(startAction == SetupResult::StopWithDone);
if (finalizeAction == SetupResult::Continue)
continue;
int skippedTaskCount = 0;
@@ -1013,10 +1013,10 @@ TaskAction TaskContainer::startChildren(int nextChild)
m_constData.m_taskTreePrivate->advanceProgress(skippedTaskCount);
return finalizeAction;
}
return TaskAction::Continue;
return SetupResult::Continue;
}
TaskAction TaskContainer::childDone(bool success)
SetupResult TaskContainer::childDone(bool success)
{
QTC_CHECK(isRunning());
const int limit = m_runtimeData->currentLimit(); // Read before bumping m_doneCount and stop()
@@ -1028,9 +1028,9 @@ TaskAction TaskContainer::childDone(bool success)
++m_runtimeData->m_doneCount;
const bool updatedSuccess = m_runtimeData->updateSuccessBit(success);
const TaskAction startAction
const SetupResult startAction
= (shouldStop || m_runtimeData->m_doneCount == m_constData.m_children.size())
? toTaskAction(updatedSuccess) : TaskAction::Continue;
? toSetupResult(updatedSuccess) : SetupResult::Continue;
if (isStarting())
return startAction;
@@ -1064,30 +1064,30 @@ void TaskContainer::invokeEndHandler()
m_runtimeData.reset();
}
TaskAction TaskNode::start()
SetupResult TaskNode::start()
{
QTC_CHECK(!isRunning());
if (!isTask())
return m_container.start();
m_task.reset(m_taskHandler.m_createHandler());
const TaskAction startAction = m_taskHandler.m_setupHandler
const SetupResult startAction = m_taskHandler.m_setupHandler
? invokeHandler(parentContainer(), m_taskHandler.m_setupHandler, *m_task.get())
: TaskAction::Continue;
if (startAction != TaskAction::Continue) {
: SetupResult::Continue;
if (startAction != SetupResult::Continue) {
m_container.m_constData.m_taskTreePrivate->advanceProgress(1);
m_task.reset();
return startAction;
}
const std::shared_ptr<TaskAction> unwindAction
= std::make_shared<TaskAction>(TaskAction::Continue);
const std::shared_ptr<SetupResult> unwindAction
= std::make_shared<SetupResult>(SetupResult::Continue);
QObject::connect(m_task.get(), &TaskInterface::done, taskTree(), [=](bool success) {
invokeEndHandler(success);
QObject::disconnect(m_task.get(), &TaskInterface::done, taskTree(), nullptr);
m_task.release()->deleteLater();
QTC_ASSERT(parentContainer() && parentContainer()->isRunning(), return);
if (parentContainer()->isStarting())
*unwindAction = toTaskAction(success);
*unwindAction = toSetupResult(success);
else
parentContainer()->childDone(success);
});
@@ -1326,18 +1326,18 @@ void TaskNode::invokeEndHandler(bool success)
as the task tree calls it when needed. The setup handler is optional. When used,
it must be the first argument of the task's constructor.
Optionally, the setup handler may return a TaskAction. The returned
TaskAction influences the further start behavior of a given task. The
Optionally, the setup handler may return a SetupResult. The returned
SetupResult influences the further start behavior of a given task. The
possible values are:
\table
\header
\li TaskAction Value
\li SetupResult Value
\li Brief Description
\row
\li Continue
\li The task will be started normally. This is the default behavior when the
setup handler doesn't return TaskAction (that is, its return type is
setup handler doesn't return SetupResult (that is, its return type is
void).
\row
\li StopWithDone
@@ -1409,12 +1409,12 @@ void TaskNode::invokeEndHandler(bool success)
handler. If you add more than one onGroupSetup() element to a group, an assert
is triggered at runtime that includes an error message.
Like the task's start handler, the group start handler may return TaskAction.
The returned TaskAction value affects the start behavior of the
Like the task's start handler, the group start handler may return SetupResult.
The returned SetupResult value affects the start behavior of the
whole group. If you do not specify a group start handler or its return type
is void, the default group's action is TaskAction::Continue, so that all
is void, the default group's action is SetupResult::Continue, so that all
tasks are started normally. Otherwise, when the start handler returns
TaskAction::StopWithDone or TaskAction::StopWithError, the tasks are not
SetupResult::StopWithDone or SetupResult::StopWithError, the tasks are not
started (they are skipped) and the group itself reports success or failure,
depending on the returned value, respectively.
@@ -1422,15 +1422,15 @@ void TaskNode::invokeEndHandler(bool success)
const Group root {
onGroupSetup([] { qDebug() << "Root setup"; }),
Group {
onGroupSetup([] { qDebug() << "Group 1 setup"; return TaskAction::Continue; }),
onGroupSetup([] { qDebug() << "Group 1 setup"; return SetupResult::Continue; }),
ProcessTask(...) // Process 1
},
Group {
onGroupSetup([] { qDebug() << "Group 2 setup"; return TaskAction::StopWithDone; }),
onGroupSetup([] { qDebug() << "Group 2 setup"; return SetupResult::StopWithDone; }),
ProcessTask(...) // Process 2
},
Group {
onGroupSetup([] { qDebug() << "Group 3 setup"; return TaskAction::StopWithError; }),
onGroupSetup([] { qDebug() << "Group 3 setup"; return SetupResult::StopWithError; }),
ProcessTask(...) // Process 3
},
ProcessTask(...) // Process 4
@@ -1446,7 +1446,7 @@ void TaskNode::invokeEndHandler(bool success)
\li Comment
\row
\li Root Group starts
\li Doesn't return TaskAction, so its tasks are executed.
\li Doesn't return SetupResult, so its tasks are executed.
\row
\li Group 1 starts
\li Returns Continue, so its tasks are executed.
@@ -1838,7 +1838,7 @@ void TaskTree::setRecipe(const Group &recipe)
Otherwise, the task tree is started.
The started task tree may finish synchronously,
for example when the main group's start handler returns TaskAction::StopWithError.
for example when the main group's start handler returns SetupResult::StopWithError.
For this reason, the connections to the done and errorOccurred signals should be
established before calling start. Use isRunning() in order to detect whether
the task tree is still running after a call to start().

View File

@@ -115,13 +115,13 @@ enum class WorkflowPolicy {
};
Q_ENUM_NS(WorkflowPolicy);
enum class TaskAction
enum class SetupResult
{
Continue,
StopWithDone,
StopWithError
};
Q_ENUM_NS(TaskAction);
Q_ENUM_NS(SetupResult);
class TASKING_EXPORT GroupItem
{
@@ -129,11 +129,11 @@ public:
// Internal, provided by QTC_DECLARE_CUSTOM_TASK
using TaskCreateHandler = std::function<TaskInterface *(void)>;
// Called prior to task start, just after createHandler
using TaskSetupHandler = std::function<TaskAction(TaskInterface &)>;
using TaskSetupHandler = std::function<SetupResult(TaskInterface &)>;
// Called on task done / error
using TaskEndHandler = std::function<void(const TaskInterface &)>;
// Called when group entered
using GroupSetupHandler = std::function<TaskAction()>;
using GroupSetupHandler = std::function<SetupResult()>;
// Called when group done / error
using GroupEndHandler = std::function<void()>;
@@ -228,17 +228,17 @@ private:
static GroupSetupHandler wrapGroupSetup(SetupHandler &&handler)
{
static constexpr bool isDynamic
= std::is_same_v<TaskAction, std::invoke_result_t<std::decay_t<SetupHandler>>>;
= std::is_same_v<SetupResult, std::invoke_result_t<std::decay_t<SetupHandler>>>;
constexpr bool isVoid
= std::is_same_v<void, std::invoke_result_t<std::decay_t<SetupHandler>>>;
static_assert(isDynamic || isVoid,
"Group setup handler needs to take no arguments and has to return "
"void or TaskAction. The passed handler doesn't fulfill these requirements.");
"void or SetupResult. The passed handler doesn't fulfill these requirements.");
return [=] {
if constexpr (isDynamic)
return std::invoke(handler);
std::invoke(handler);
return TaskAction::Continue;
return SetupResult::Continue;
};
};
};
@@ -290,10 +290,10 @@ private:
static_assert(isBool || isVoid,
"Sync element: The synchronous function has to return void or bool.");
if constexpr (isBool) {
return {onGroupSetup([function] { return function() ? TaskAction::StopWithDone
: TaskAction::StopWithError; })};
return {onGroupSetup([function] { return function() ? SetupResult::StopWithDone
: SetupResult::StopWithError; })};
}
return {onGroupSetup([function] { function(); return TaskAction::StopWithDone; })};
return {onGroupSetup([function] { function(); return SetupResult::StopWithDone; })};
};
};
@@ -344,19 +344,19 @@ public:
private:
template<typename SetupFunction>
static GroupItem::TaskSetupHandler wrapSetup(SetupFunction &&function) {
static constexpr bool isDynamic = std::is_same_v<TaskAction,
static constexpr bool isDynamic = std::is_same_v<SetupResult,
std::invoke_result_t<std::decay_t<SetupFunction>, typename Adapter::Type &>>;
constexpr bool isVoid = std::is_same_v<void,
std::invoke_result_t<std::decay_t<SetupFunction>, typename Adapter::Type &>>;
static_assert(isDynamic || isVoid,
"Task setup handler needs to take (Task &) as an argument and has to return "
"void or TaskAction. The passed handler doesn't fulfill these requirements.");
"void or SetupResult. The passed handler doesn't fulfill these requirements.");
return [=](TaskInterface &taskInterface) {
Adapter &adapter = static_cast<Adapter &>(taskInterface);
if constexpr (isDynamic)
return std::invoke(function, *adapter.task());
std::invoke(function, *adapter.task());
return TaskAction::Continue;
return SetupResult::Continue;
};
};

View File

@@ -355,13 +355,13 @@ void TestRunner::runTestsHelper()
const auto onSetup = [this, config] {
if (!config->project())
return TaskAction::StopWithDone;
return SetupResult::StopWithDone;
if (config->testExecutable().isEmpty()) {
reportResult(ResultType::MessageFatal,
Tr::tr("Executable path is empty. (%1)").arg(config->displayName()));
return TaskAction::StopWithDone;
return SetupResult::StopWithDone;
}
return TaskAction::Continue;
return SetupResult::Continue;
};
const auto onProcessSetup = [this, config, storage](Process &process) {
TestStorage *testStorage = storage.activeStorage();

View File

@@ -43,7 +43,7 @@ Group QdbStopApplicationStep::deployRecipe()
const auto device = DeviceKitAspect::device(target()->kit());
if (!device) {
addErrorMessage(Tr::tr("No device to stop the application on."));
return TaskAction::StopWithError;
return SetupResult::StopWithError;
}
QTC_CHECK(device);
process.setCommand({device->filePath(Constants::AppcontrollerFilepath), {"--stop"}});
@@ -52,7 +52,7 @@ Group QdbStopApplicationStep::deployRecipe()
connect(proc, &Process::readyReadStandardOutput, this, [this, proc] {
handleStdOutData(proc->readAllStandardOutput());
});
return TaskAction::Continue;
return SetupResult::Continue;
};
const auto doneHandler = [this](const Process &) {
addProgressMessage(Tr::tr("Stopped the running application."));

View File

@@ -128,23 +128,23 @@ GroupItem clangToolTask(const AnalyzeInputData &input,
const auto onSetup = [=] {
if (setupHandler && !setupHandler())
return TaskAction::StopWithError;
return SetupResult::StopWithError;
ClangToolStorage *data = storage.activeStorage();
data->name = clangToolName(input.tool);
data->executable = toolExecutable(input.tool);
if (!data->executable.isExecutableFile()) {
qWarning() << "Can't start:" << data->executable << "as" << data->name;
return TaskAction::StopWithError;
return SetupResult::StopWithError;
}
QTC_CHECK(!input.unit.arguments.contains(QLatin1String("-o")));
QTC_CHECK(!input.unit.arguments.contains(input.unit.file.nativePath()));
QTC_ASSERT(input.unit.file.exists(), return TaskAction::StopWithError);
QTC_ASSERT(input.unit.file.exists(), return SetupResult::StopWithError);
data->outputFilePath = createOutputFilePath(input.outputDirPath, input.unit.file);
QTC_ASSERT(!data->outputFilePath.isEmpty(), return TaskAction::StopWithError);
QTC_ASSERT(!data->outputFilePath.isEmpty(), return SetupResult::StopWithError);
return TaskAction::Continue;
return SetupResult::Continue;
};
const auto onProcessSetup = [=](Process &process) {
process.setEnvironment(input.environment);

View File

@@ -190,11 +190,11 @@ LocatorMatcherTasks ActionsFilter::matchers()
collectEntriesForCommands();
if (storage->input().simplified().isEmpty()) {
storage->reportOutput(m_entries);
return TaskAction::StopWithDone;
return SetupResult::StopWithDone;
}
async.setFutureSynchronizer(ExtensionSystem::PluginManager::futureSynchronizer());
async.setConcurrentCallData(matches, *storage, m_entries);
return TaskAction::Continue;
return SetupResult::Continue;
};
return {{AsyncTask<void>(onSetup), storage}};

View File

@@ -82,9 +82,9 @@ DirectoryFilter::DirectoryFilter(Id id)
using namespace Tasking;
const auto groupSetup = [this] {
if (!m_directories.isEmpty())
return TaskAction::Continue; // Async task will run
return SetupResult::Continue; // Async task will run
m_cache.setFilePaths({});
return TaskAction::StopWithDone; // Group stops, skips async task
return SetupResult::StopWithDone; // Group stops, skips async task
};
const auto asyncSetup = [this](Async<FilePaths> &async) {
async.setConcurrentCallData(&refresh, m_directories, m_filters, m_exclusionFilters,

View File

@@ -1503,16 +1503,16 @@ LocatorMatcherTask LocatorFileCache::matcher() const
const auto onSetup = [storage, weak](Async<LocatorFileCachePrivate> &async) {
auto that = weak.lock();
if (!that) // LocatorMatcher is running after *this LocatorFileCache was destructed.
return TaskAction::StopWithDone;
return SetupResult::StopWithDone;
if (!that->ensureValidated())
return TaskAction::StopWithDone; // The cache is invalid and
return SetupResult::StopWithDone; // The cache is invalid and
// no provider is set or it returned empty generator
that->bumpExecutionId();
async.setFutureSynchronizer(ExtensionSystem::PluginManager::futureSynchronizer());
async.setConcurrentCallData(&filter, *storage, *that);
return TaskAction::Continue;
return SetupResult::Continue;
};
const auto onDone = [weak](const Async<LocatorFileCachePrivate> &async) {
auto that = weak.lock();

View File

@@ -372,7 +372,7 @@ LocatorMatcherTasks JavaScriptFilter::matchers()
const auto onSetup = [storage, engine] {
if (!engine)
return TaskAction::StopWithError;
return SetupResult::StopWithError;
if (storage->input().trimmed().isEmpty()) {
LocatorFilterEntry entry;
entry.displayName = Tr::tr("Reset Engine");
@@ -385,9 +385,9 @@ LocatorMatcherTasks JavaScriptFilter::matchers()
return AcceptResult();
};
storage->reportOutput({entry});
return TaskAction::StopWithDone;
return SetupResult::StopWithDone;
}
return TaskAction::Continue;
return SetupResult::Continue;
};
const auto onJavaScriptSetup = [storage, engine](JavaScriptRequest &request) {

View File

@@ -179,7 +179,7 @@ LocatorMatcherTasks SpotlightLocatorFilter::matchers()
const Link link = Link::fromString(storage->input(), true);
const FilePath input = link.targetFilePath;
if (input.isEmpty())
return TaskAction::StopWithDone;
return SetupResult::StopWithDone;
// only pass the file name part to allow searches like "somepath/*foo"
const std::unique_ptr<MacroExpander> expander(createMacroExpander(input.fileName()));
@@ -189,7 +189,7 @@ LocatorMatcherTasks SpotlightLocatorFilter::matchers()
CommandLine::Raw);
async.setFutureSynchronizer(ExtensionSystem::PluginManager::futureSynchronizer());
async.setConcurrentCallData(matches, *storage, cmd);
return TaskAction::Continue;
return SetupResult::Continue;
};
return {{AsyncTask<void>(onSetup), storage}};

View File

@@ -310,12 +310,12 @@ FileListDiffController::FileListDiffController(IDocument *document, const QStrin
const auto setupStaged = [this, stagedFiles](Process &process) {
if (stagedFiles.isEmpty())
return TaskAction::StopWithError;
return SetupResult::StopWithError;
process.setCodec(VcsBaseEditor::getCodec(workingDirectory(), stagedFiles));
setupCommand(process, addConfigurationArguments(
QStringList({"diff", "--cached", "--"}) + stagedFiles));
VcsOutputWindow::appendCommand(process.workingDirectory(), process.commandLine());
return TaskAction::Continue;
return SetupResult::Continue;
};
const auto onStagedDone = [storage](const Process &process) {
storage->m_stagedOutput = process.cleanedStdOut();
@@ -323,12 +323,12 @@ FileListDiffController::FileListDiffController(IDocument *document, const QStrin
const auto setupUnstaged = [this, unstagedFiles](Process &process) {
if (unstagedFiles.isEmpty())
return TaskAction::StopWithError;
return SetupResult::StopWithError;
process.setCodec(VcsBaseEditor::getCodec(workingDirectory(), unstagedFiles));
setupCommand(process, addConfigurationArguments(
QStringList({"diff", "--"}) + unstagedFiles));
VcsOutputWindow::appendCommand(process.workingDirectory(), process.commandLine());
return TaskAction::Continue;
return SetupResult::Continue;
};
const auto onUnstagedDone = [storage](const Process &process) {
storage->m_unstagedOutput = process.cleanedStdOut();
@@ -421,8 +421,8 @@ ShowController::ShowController(IDocument *document, const QString &id)
const auto desciptionDetailsSetup = [storage] {
if (!storage->m_postProcessDescription)
return TaskAction::StopWithDone;
return TaskAction::Continue;
return SetupResult::StopWithDone;
return SetupResult::Continue;
};
const auto setupBranches = [this, storage](Process &process) {

View File

@@ -69,10 +69,10 @@ LocatorMatcherTask locatorMatcher(Client *client, int maxResultCount,
const auto onFilterSetup = [storage, resultStorage, client, filter](Async<void> &async) {
const QList<SymbolInformation> results = *resultStorage;
if (results.isEmpty())
return TaskAction::StopWithDone;
return SetupResult::StopWithDone;
async.setFutureSynchronizer(ExtensionSystem::PluginManager::futureSynchronizer());
async.setConcurrentCallData(filterResults, *storage, client, results, filter);
return TaskAction::Continue;
return SetupResult::Continue;
};
const Group root {

View File

@@ -149,10 +149,10 @@ GroupItem QnxDeployQtLibrariesDialogPrivate::removeDirTask()
{
const auto setupHandler = [this](Process &process) {
if (m_checkResult != CheckResult::RemoveDir)
return TaskAction::StopWithDone;
return SetupResult::StopWithDone;
m_deployLogWindow->appendPlainText(Tr::tr("Removing \"%1\"").arg(fullRemoteDirectory()));
process.setCommand({m_device->filePath("rm"), {"-rf", fullRemoteDirectory()}});
return TaskAction::Continue;
return SetupResult::Continue;
};
const auto errorHandler = [this](const Process &process) {
QTC_ASSERT(process.exitCode() == 0, return);
@@ -167,7 +167,7 @@ GroupItem QnxDeployQtLibrariesDialogPrivate::uploadTask()
const auto setupHandler = [this](FileTransfer &transfer) {
if (m_deployableFiles.isEmpty()) {
emitProgressMessage(Tr::tr("No files need to be uploaded."));
return TaskAction::StopWithDone;
return SetupResult::StopWithDone;
}
emitProgressMessage(Tr::tr("%n file(s) need to be uploaded.", "",
m_deployableFiles.size()));
@@ -177,18 +177,18 @@ GroupItem QnxDeployQtLibrariesDialogPrivate::uploadTask()
const QString message = Tr::tr("Local file \"%1\" does not exist.")
.arg(file.localFilePath().toUserOutput());
emitErrorMessage(message);
return TaskAction::StopWithError;
return SetupResult::StopWithError;
}
files.append({file.localFilePath(), m_device->filePath(file.remoteFilePath())});
}
if (files.isEmpty()) {
emitProgressMessage(Tr::tr("No files need to be uploaded."));
return TaskAction::StopWithDone;
return SetupResult::StopWithDone;
}
transfer.setFilesToTransfer(files);
QObject::connect(&transfer, &FileTransfer::progress,
this, &QnxDeployQtLibrariesDialogPrivate::emitProgressMessage);
return TaskAction::Continue;
return SetupResult::Continue;
};
const auto errorHandler = [this](const FileTransfer &transfer) {
emitErrorMessage(transfer.resultData().m_errorString);
@@ -238,7 +238,7 @@ Group QnxDeployQtLibrariesDialogPrivate::deployRecipe()
const auto setupHandler = [this] {
if (!m_device) {
emitErrorMessage(Tr::tr("No device configuration set."));
return TaskAction::StopWithError;
return SetupResult::StopWithError;
}
QList<DeployableFile> collected;
for (int i = 0; i < m_deployableFiles.count(); ++i)
@@ -247,18 +247,18 @@ Group QnxDeployQtLibrariesDialogPrivate::deployRecipe()
QTC_CHECK(collected.size() >= m_deployableFiles.size());
m_deployableFiles = collected;
if (!m_deployableFiles.isEmpty())
return TaskAction::Continue;
return SetupResult::Continue;
emitProgressMessage(Tr::tr("No deployment action necessary. Skipping."));
return TaskAction::StopWithDone;
return SetupResult::StopWithDone;
};
const auto doneHandler = [this] {
emitProgressMessage(Tr::tr("All files successfully deployed."));
};
const auto subGroupSetupHandler = [this] {
if (m_checkResult == CheckResult::Abort)
return TaskAction::StopWithError;
return TaskAction::Continue;
return SetupResult::StopWithError;
return SetupResult::Continue;
};
const Group root {
onGroupSetup(setupHandler),

View File

@@ -194,7 +194,7 @@ GroupItem GenericDirectUploadStep::uploadTask(const TreeStorage<UploadStorage> &
const auto setupHandler = [this, storage](FileTransfer &transfer) {
if (storage->filesToUpload.isEmpty()) {
addProgressMessage(Tr::tr("No files need to be uploaded."));
return TaskAction::StopWithDone;
return SetupResult::StopWithDone;
}
addProgressMessage(Tr::tr("%n file(s) need to be uploaded.", "",
storage->filesToUpload.size()));
@@ -208,19 +208,19 @@ GroupItem GenericDirectUploadStep::uploadTask(const TreeStorage<UploadStorage> &
continue;
}
addErrorMessage(message);
return TaskAction::StopWithError;
return SetupResult::StopWithError;
}
files.append({file.localFilePath(),
deviceConfiguration()->filePath(file.remoteFilePath())});
}
if (files.isEmpty()) {
addProgressMessage(Tr::tr("No files need to be uploaded."));
return TaskAction::StopWithDone;
return SetupResult::StopWithDone;
}
transfer.setFilesToTransfer(files);
QObject::connect(&transfer, &FileTransfer::progress,
this, &GenericDirectUploadStep::addProgressMessage);
return TaskAction::Continue;
return SetupResult::Continue;
};
const auto errorHandler = [this](const FileTransfer &transfer) {
addErrorMessage(transfer.resultData().m_errorString);

View File

@@ -167,13 +167,13 @@ SubversionDiffEditorController::SubversionDiffEditorController(IDocument *docume
const auto setupDescription = [this](Process &process) {
if (m_changeNumber == 0)
return TaskAction::StopWithDone;
return SetupResult::StopWithDone;
setupCommand(process, {"log", "-r", QString::number(m_changeNumber)});
CommandLine command = process.commandLine();
command << SubversionClient::AddAuthOptions();
process.setCommand(command);
setDescription(Tr::tr("Waiting for data..."));
return TaskAction::Continue;
return SetupResult::Continue;
};
const auto onDescriptionDone = [this](const Process &process) {
setDescription(process.cleanedStdOut());

View File

@@ -227,7 +227,7 @@ void tst_Tasking::testTree_data()
};
};
const auto setupDynamicTask = [storage](int taskId, TaskAction action) {
const auto setupDynamicTask = [storage](int taskId, SetupResult action) {
return [storage, taskId, action](TaskObject &) {
storage->m_log.append({taskId, Handler::Setup});
return action;
@@ -274,7 +274,7 @@ void tst_Tasking::testTree_data()
};
const auto createDynamicTask = [storage, setupDynamicTask, setupDone, setupError](
int taskId, TaskAction action) {
int taskId, SetupResult action) {
return TestTask(setupDynamicTask(taskId, action), setupDone(taskId), setupError(taskId));
};
@@ -302,19 +302,19 @@ void tst_Tasking::testTree_data()
};
const Group root2 {
Storage(storage),
onGroupSetup([] { return TaskAction::Continue; }),
onGroupSetup([] { return SetupResult::Continue; }),
groupDone(0),
groupError(0)
};
const Group root3 {
Storage(storage),
onGroupSetup([] { return TaskAction::StopWithDone; }),
onGroupSetup([] { return SetupResult::StopWithDone; }),
groupDone(0),
groupError(0)
};
const Group root4 {
Storage(storage),
onGroupSetup([] { return TaskAction::StopWithError; }),
onGroupSetup([] { return SetupResult::StopWithError; }),
groupDone(0),
groupError(0)
};
@@ -329,22 +329,22 @@ void tst_Tasking::testTree_data()
}
{
const auto setupGroup = [=](TaskAction taskAction, WorkflowPolicy policy) {
const auto setupGroup = [=](SetupResult setupResult, WorkflowPolicy policy) {
return Group {
Storage(storage),
workflowPolicy(policy),
onGroupSetup([taskAction] { return taskAction; }),
onGroupSetup([setupResult] { return setupResult; }),
groupDone(0),
groupError(0)
};
};
const auto doneData = [storage, setupGroup](WorkflowPolicy policy) {
return TestData{storage, setupGroup(TaskAction::StopWithDone, policy),
return TestData{storage, setupGroup(SetupResult::StopWithDone, policy),
Log{{0, Handler::GroupDone}}, 0, OnDone::Success};
};
const auto errorData = [storage, setupGroup](WorkflowPolicy policy) {
return TestData{storage, setupGroup(TaskAction::StopWithError, policy),
return TestData{storage, setupGroup(SetupResult::StopWithError, policy),
Log{{0, Handler::GroupError}}, 0, OnDone::Failure};
};
@@ -368,8 +368,8 @@ void tst_Tasking::testTree_data()
{
const Group root {
Storage(storage),
createDynamicTask(1, TaskAction::StopWithDone),
createDynamicTask(2, TaskAction::StopWithDone)
createDynamicTask(1, SetupResult::StopWithDone),
createDynamicTask(2, SetupResult::StopWithDone)
};
const Log log {{1, Handler::Setup}, {2, Handler::Setup}};
QTest::newRow("DynamicTaskDone") << TestData{storage, root, log, 2, OnDone::Success};
@@ -378,8 +378,8 @@ void tst_Tasking::testTree_data()
{
const Group root {
Storage(storage),
createDynamicTask(1, TaskAction::StopWithError),
createDynamicTask(2, TaskAction::StopWithError)
createDynamicTask(1, SetupResult::StopWithError),
createDynamicTask(2, SetupResult::StopWithError)
};
const Log log {{1, Handler::Setup}};
QTest::newRow("DynamicTaskError") << TestData{storage, root, log, 2, OnDone::Failure};
@@ -388,10 +388,10 @@ void tst_Tasking::testTree_data()
{
const Group root {
Storage(storage),
createDynamicTask(1, TaskAction::Continue),
createDynamicTask(2, TaskAction::Continue),
createDynamicTask(3, TaskAction::StopWithError),
createDynamicTask(4, TaskAction::Continue)
createDynamicTask(1, SetupResult::Continue),
createDynamicTask(2, SetupResult::Continue),
createDynamicTask(3, SetupResult::StopWithError),
createDynamicTask(4, SetupResult::Continue)
};
const Log log {
{1, Handler::Setup},
@@ -407,10 +407,10 @@ void tst_Tasking::testTree_data()
const Group root {
parallel,
Storage(storage),
createDynamicTask(1, TaskAction::Continue),
createDynamicTask(2, TaskAction::Continue),
createDynamicTask(3, TaskAction::StopWithError),
createDynamicTask(4, TaskAction::Continue)
createDynamicTask(1, SetupResult::Continue),
createDynamicTask(2, SetupResult::Continue),
createDynamicTask(3, SetupResult::StopWithError),
createDynamicTask(4, SetupResult::Continue)
};
const Log log {
{1, Handler::Setup},
@@ -426,12 +426,12 @@ void tst_Tasking::testTree_data()
const Group root {
parallel,
Storage(storage),
createDynamicTask(1, TaskAction::Continue),
createDynamicTask(2, TaskAction::Continue),
createDynamicTask(1, SetupResult::Continue),
createDynamicTask(2, SetupResult::Continue),
Group {
createDynamicTask(3, TaskAction::StopWithError)
createDynamicTask(3, SetupResult::StopWithError)
},
createDynamicTask(4, TaskAction::Continue)
createDynamicTask(4, SetupResult::Continue)
};
const Log log {
{1, Handler::Setup},
@@ -447,16 +447,16 @@ void tst_Tasking::testTree_data()
const Group root {
parallel,
Storage(storage),
createDynamicTask(1, TaskAction::Continue),
createDynamicTask(2, TaskAction::Continue),
createDynamicTask(1, SetupResult::Continue),
createDynamicTask(2, SetupResult::Continue),
Group {
onGroupSetup([storage] {
storage->m_log.append({0, Handler::GroupSetup});
return TaskAction::StopWithError;
return SetupResult::StopWithError;
}),
createDynamicTask(3, TaskAction::Continue)
createDynamicTask(3, SetupResult::Continue)
},
createDynamicTask(4, TaskAction::Continue)
createDynamicTask(4, SetupResult::Continue)
};
const Log log {
{1, Handler::Setup},
@@ -1319,14 +1319,14 @@ void tst_Tasking::testTree_data()
{
const auto createRoot = [storage, createSuccessTask, groupDone, groupError](
TaskAction taskAction) {
SetupResult setupResult) {
return Group {
Storage(storage),
Group {
createSuccessTask(1)
},
Group {
onGroupSetup([=] { return taskAction; }),
onGroupSetup([=] { return setupResult; }),
createSuccessTask(2),
createSuccessTask(3),
createSuccessTask(4)
@@ -1336,7 +1336,7 @@ void tst_Tasking::testTree_data()
};
};
const Group root1 = createRoot(TaskAction::StopWithDone);
const Group root1 = createRoot(SetupResult::StopWithDone);
const Log log1 {
{1, Handler::Setup},
{1, Handler::Done},
@@ -1344,7 +1344,7 @@ void tst_Tasking::testTree_data()
};
QTest::newRow("DynamicSetupDone") << TestData{storage, root1, log1, 4, OnDone::Success};
const Group root2 = createRoot(TaskAction::StopWithError);
const Group root2 = createRoot(SetupResult::StopWithError);
const Log log2 {
{1, Handler::Setup},
{1, Handler::Done},
@@ -1352,7 +1352,7 @@ void tst_Tasking::testTree_data()
};
QTest::newRow("DynamicSetupError") << TestData{storage, root2, log2, 4, OnDone::Failure};
const Group root3 = createRoot(TaskAction::Continue);
const Group root3 = createRoot(SetupResult::Continue);
const Log log3 {
{1, Handler::Setup},
{1, Handler::Done},
@@ -1419,7 +1419,7 @@ void tst_Tasking::testTree_data()
},
Group {
groupSetup(3),
createDynamicTask(3, TaskAction::StopWithDone)
createDynamicTask(3, SetupResult::StopWithDone)
},
Group {
groupSetup(4),
@@ -1463,7 +1463,7 @@ void tst_Tasking::testTree_data()
},
Group {
groupSetup(3),
createDynamicTask(3, TaskAction::StopWithError)
createDynamicTask(3, SetupResult::StopWithError)
},
Group {
groupSetup(4),
@@ -1502,7 +1502,7 @@ void tst_Tasking::testTree_data()
},
Group {
groupSetup(3),
createDynamicTask(3, TaskAction::StopWithError)
createDynamicTask(3, SetupResult::StopWithError)
},
Group {
groupSetup(4),
@@ -1547,7 +1547,7 @@ void tst_Tasking::testTree_data()
},
Group {
groupSetup(3),
createDynamicTask(3, TaskAction::StopWithError)
createDynamicTask(3, SetupResult::StopWithError)
},
Group {
groupSetup(4),
@@ -1644,7 +1644,7 @@ void tst_Tasking::testTree_data()
},
Group {
groupSetup(3),
Group { createDynamicTask(3, TaskAction::StopWithDone) }
Group { createDynamicTask(3, SetupResult::StopWithDone) }
},
Group {
groupSetup(4),
@@ -1689,7 +1689,7 @@ void tst_Tasking::testTree_data()
},
Group {
groupSetup(3),
Group { createDynamicTask(3, TaskAction::StopWithError) }
Group { createDynamicTask(3, SetupResult::StopWithError) }
},
Group {
groupSetup(4),