forked from qt-creator/qt-creator
TaskTree: Rename optional into finishAllAndDone
Rationale: 1. More descriptive. 2. More consistent with a planned new finishAllAndError policy. 3. Limits the possibilities of making a conflict with std::optional. Change-Id: I5155630188e4b699e6c18b13a101e0e2d4fe98f2 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -164,7 +164,7 @@ private:
|
||||
Constructs a group's element holding the group done handler.
|
||||
The \a handler is invoked whenever the group finishes with success.
|
||||
Depending on the group's workflow policy, this handler may also be called
|
||||
when the running group is stopped (e.g. when optional element was used).
|
||||
when the running group is stopped (e.g. when finishAllAndDone element was used).
|
||||
|
||||
When the \a handler is invoked, all of the group's child tasks are already finished.
|
||||
|
||||
@@ -256,7 +256,7 @@ const TaskItem continueOnError = workflowPolicy(WorkflowPolicy::ContinueOnError)
|
||||
const TaskItem stopOnDone = workflowPolicy(WorkflowPolicy::StopOnDone);
|
||||
const TaskItem continueOnDone = workflowPolicy(WorkflowPolicy::ContinueOnDone);
|
||||
const TaskItem stopOnFinished = workflowPolicy(WorkflowPolicy::StopOnFinished);
|
||||
const TaskItem optional = workflowPolicy(WorkflowPolicy::Optional);
|
||||
const TaskItem finishAllAndDone = workflowPolicy(WorkflowPolicy::FinishAllAndDone);
|
||||
|
||||
static TaskAction toTaskAction(bool success)
|
||||
{
|
||||
@@ -720,7 +720,7 @@ TaskContainer::RuntimeData::~RuntimeData()
|
||||
|
||||
bool TaskContainer::RuntimeData::updateSuccessBit(bool success)
|
||||
{
|
||||
if (m_constData.m_workflowPolicy == WorkflowPolicy::Optional)
|
||||
if (m_constData.m_workflowPolicy == WorkflowPolicy::FinishAllAndDone)
|
||||
return m_successBit;
|
||||
if (m_constData.m_workflowPolicy == WorkflowPolicy::StopOnFinished) {
|
||||
m_successBit = success;
|
||||
@@ -1394,7 +1394,7 @@ void TaskNode::invokeEndHandler(bool success)
|
||||
In sequential mode, only the first task is started, and when finished,
|
||||
the group finishes too, so the other tasks are ignored.
|
||||
\row
|
||||
\li optional
|
||||
\li finishAllAndDone
|
||||
\li The group executes all tasks and ignores their return state. When all
|
||||
tasks finish, the group finishes with success.
|
||||
\endtable
|
||||
|
||||
@@ -99,7 +99,7 @@ private:
|
||||
// b) On first done - continue executing all children and report done afterwards.
|
||||
// 3. Stops on first finished child. In sequential mode it will never run other children then the first one.
|
||||
// Useful only in parallel mode.
|
||||
// 4. Always run all children, ignore their result and report done afterwards.
|
||||
// 4. Always run all children, let them finish, ignore their results and report done afterwards.
|
||||
|
||||
enum class WorkflowPolicy {
|
||||
StopOnError, // 1a - Reports error on first child error, otherwise done (if all children were done).
|
||||
@@ -107,7 +107,7 @@ enum class WorkflowPolicy {
|
||||
StopOnDone, // 2a - Reports done on first child done, otherwise error (if all children were error).
|
||||
ContinueOnDone, // 2b - The same, but children execution continues. Reports error when no children.
|
||||
StopOnFinished, // 3 - Stops on first finished child and report its result.
|
||||
Optional // 4 - Reports done after all children finished.
|
||||
FinishAllAndDone // 4 - Reports done after all children finished.
|
||||
};
|
||||
|
||||
enum class TaskAction
|
||||
@@ -248,7 +248,7 @@ TASKING_EXPORT extern const TaskItem continueOnError;
|
||||
TASKING_EXPORT extern const TaskItem stopOnDone;
|
||||
TASKING_EXPORT extern const TaskItem continueOnDone;
|
||||
TASKING_EXPORT extern const TaskItem stopOnFinished;
|
||||
TASKING_EXPORT extern const TaskItem optional;
|
||||
TASKING_EXPORT extern const TaskItem finishAllAndDone;
|
||||
|
||||
class TASKING_EXPORT Storage : public TaskItem
|
||||
{
|
||||
|
||||
@@ -347,7 +347,7 @@ void TestRunner::runTestsHelper()
|
||||
std::unique_ptr<TestOutputReader> m_outputReader;
|
||||
};
|
||||
|
||||
QList<TaskItem> tasks{optional};
|
||||
QList<TaskItem> tasks{finishAllAndDone};
|
||||
|
||||
for (ITestConfiguration *config : m_selectedTests) {
|
||||
QTC_ASSERT(config, continue);
|
||||
@@ -442,7 +442,7 @@ void TestRunner::runTestsHelper()
|
||||
}
|
||||
};
|
||||
const Group group {
|
||||
optional,
|
||||
finishAllAndDone,
|
||||
Storage(storage),
|
||||
onGroupSetup(onSetup),
|
||||
ProcessTask(onProcessSetup, onProcessDone, onProcessDone)
|
||||
|
||||
@@ -186,7 +186,7 @@ TaskItem clangToolTask(const AnalyzeInputData &input,
|
||||
Storage(storage),
|
||||
onGroupSetup(onSetup),
|
||||
Group {
|
||||
optional,
|
||||
finishAllAndDone,
|
||||
ProcessTask(onProcessSetup, onProcessDone, onProcessError)
|
||||
}
|
||||
};
|
||||
|
||||
@@ -209,7 +209,7 @@ void DocumentClangToolRunner::run()
|
||||
return !m_document->isModified() || isVFSOverlaySupported(executable);
|
||||
};
|
||||
const auto outputHandler = [this](const AnalyzeOutputData &output) { onDone(output); };
|
||||
tasks.append(Group{optional, clangToolTask(input, setupHandler, outputHandler)});
|
||||
tasks.append(Group{finishAllAndDone, clangToolTask(input, setupHandler, outputHandler)});
|
||||
};
|
||||
addClangTool(ClangToolType::Tidy);
|
||||
addClangTool(ClangToolType::Clazy);
|
||||
|
||||
@@ -470,7 +470,7 @@ void LocatorMatcher::start()
|
||||
for (const LocatorMatcherTask &task : std::as_const(d->m_tasks)) {
|
||||
const auto storage = task.storage;
|
||||
const Group group {
|
||||
optional,
|
||||
finishAllAndDone,
|
||||
Storage(storage),
|
||||
onGroupSetup(onSetup(storage, index)),
|
||||
onGroupDone(onDone(storage)),
|
||||
|
||||
@@ -388,7 +388,7 @@ void Locator::refresh(const QList<ILocatorFilter *> &filters)
|
||||
continue;
|
||||
|
||||
const Group group {
|
||||
optional,
|
||||
finishAllAndDone,
|
||||
*task,
|
||||
onGroupDone([this, filter] { m_refreshingFilters.removeOne(filter); })
|
||||
};
|
||||
|
||||
@@ -128,7 +128,7 @@ DiffFilesController::DiffFilesController(IDocument *document)
|
||||
outputList->resize(inputList.size());
|
||||
|
||||
using namespace std::placeholders;
|
||||
QList<TaskItem> tasks {parallel, optional};
|
||||
QList<TaskItem> tasks {parallel, finishAllAndDone};
|
||||
for (int i = 0; i < inputList.size(); ++i) {
|
||||
tasks.append(AsyncTask<FileData>(std::bind(setupDiff, _1, inputList.at(i)),
|
||||
std::bind(onDiffDone, _1, i)));
|
||||
|
||||
@@ -465,11 +465,11 @@ ShowController::ShowController(IDocument *document, const QString &id)
|
||||
parallel,
|
||||
onGroupSetup([this] { setStartupFile(VcsBase::source(this->document()).toString()); }),
|
||||
Group {
|
||||
optional,
|
||||
finishAllAndDone,
|
||||
ProcessTask(setupDescription, onDescriptionDone),
|
||||
Group {
|
||||
parallel,
|
||||
optional,
|
||||
finishAllAndDone,
|
||||
onGroupSetup(desciptionDetailsSetup),
|
||||
ProcessTask(setupBranches, onBranchesDone, onBranchesError),
|
||||
ProcessTask(setupPrecedes, onPrecedesDone, onPrecedesError),
|
||||
|
||||
@@ -223,7 +223,7 @@ TaskItem QnxDeployQtLibrariesDialogPrivate::chmodTree()
|
||||
if (file.isExecutable())
|
||||
filesToChmod << file;
|
||||
}
|
||||
QList<TaskItem> chmodList{optional, parallelLimit(MaxConcurrentStatCalls)};
|
||||
QList<TaskItem> chmodList{finishAllAndDone, parallelLimit(MaxConcurrentStatCalls)};
|
||||
for (const DeployableFile &file : std::as_const(filesToChmod)) {
|
||||
QTC_ASSERT(file.isValid(), continue);
|
||||
chmodList.append(chmodTask(file));
|
||||
@@ -263,7 +263,7 @@ Group QnxDeployQtLibrariesDialogPrivate::deployRecipe()
|
||||
const Group root {
|
||||
onGroupSetup(setupHandler),
|
||||
Group {
|
||||
optional,
|
||||
finishAllAndDone,
|
||||
checkDirTask()
|
||||
},
|
||||
Group {
|
||||
|
||||
@@ -179,7 +179,7 @@ TaskItem GenericDirectUploadStep::statTree(const TreeStorage<UploadStorage> &sto
|
||||
const auto setupHandler = [=](TaskTree &tree) {
|
||||
UploadStorage *storagePtr = storage.activeStorage();
|
||||
const QList<DeployableFile> files = filesToStat(storagePtr);
|
||||
QList<TaskItem> statList{optional, parallelLimit(MaxConcurrentStatCalls)};
|
||||
QList<TaskItem> statList{finishAllAndDone, parallelLimit(MaxConcurrentStatCalls)};
|
||||
for (const DeployableFile &file : std::as_const(files)) {
|
||||
QTC_ASSERT(file.isValid(), continue);
|
||||
statList.append(statTask(storagePtr, file, statEndHandler));
|
||||
@@ -256,7 +256,7 @@ TaskItem GenericDirectUploadStep::chmodTree(const TreeStorage<UploadStorage> &st
|
||||
if (file.isExecutable())
|
||||
filesToChmod << file;
|
||||
}
|
||||
QList<TaskItem> chmodList{optional, parallelLimit(MaxConcurrentStatCalls)};
|
||||
QList<TaskItem> chmodList{finishAllAndDone, parallelLimit(MaxConcurrentStatCalls)};
|
||||
for (const DeployableFile &file : std::as_const(filesToChmod)) {
|
||||
QTC_ASSERT(file.isValid(), continue);
|
||||
chmodList.append(chmodTask(file));
|
||||
|
||||
@@ -131,7 +131,7 @@ TaskItem GenericLinuxDeviceTesterPrivate::unameTask() const
|
||||
emit q->errorMessage(Tr::tr("uname failed.") + '\n');
|
||||
};
|
||||
return Group {
|
||||
optional,
|
||||
finishAllAndDone,
|
||||
ProcessTask(setup, done, error)
|
||||
};
|
||||
}
|
||||
@@ -159,7 +159,7 @@ TaskItem GenericLinuxDeviceTesterPrivate::gathererTask() const
|
||||
};
|
||||
|
||||
return Group {
|
||||
optional,
|
||||
finishAllAndDone,
|
||||
DeviceUsedPortsGathererTask(setup, done, error)
|
||||
};
|
||||
}
|
||||
|
||||
@@ -204,7 +204,7 @@ SubversionDiffEditorController::SubversionDiffEditorController(IDocument *docume
|
||||
Storage(diffInputStorage),
|
||||
parallel,
|
||||
Group {
|
||||
optional,
|
||||
finishAllAndDone,
|
||||
ProcessTask(setupDescription, onDescriptionDone, onDescriptionError)
|
||||
},
|
||||
Group {
|
||||
|
||||
@@ -654,7 +654,7 @@ void tst_Tasking::testTree_data()
|
||||
const Group root5 = createRoot(WorkflowPolicy::StopOnFinished);
|
||||
QTest::newRow("EmptyStopOnFinished") << TestData{storage, root5, log, 0, OnDone::Success};
|
||||
|
||||
const Group root6 = createRoot(WorkflowPolicy::Optional);
|
||||
const Group root6 = createRoot(WorkflowPolicy::FinishAllAndDone);
|
||||
QTest::newRow("EmptyOptional") << TestData{storage, root6, log, 0, OnDone::Success};
|
||||
}
|
||||
|
||||
@@ -691,7 +691,7 @@ void tst_Tasking::testTree_data()
|
||||
const Group root5 = createRoot(WorkflowPolicy::StopOnFinished);
|
||||
QTest::newRow("DoneStopOnFinished") << TestData{storage, root5, log, 1, OnDone::Success};
|
||||
|
||||
const Group root6 = createRoot(WorkflowPolicy::Optional);
|
||||
const Group root6 = createRoot(WorkflowPolicy::FinishAllAndDone);
|
||||
QTest::newRow("DoneOptional") << TestData{storage, root6, log, 1, OnDone::Success};
|
||||
}
|
||||
|
||||
@@ -734,7 +734,7 @@ void tst_Tasking::testTree_data()
|
||||
const Group root5 = createRoot(WorkflowPolicy::StopOnFinished);
|
||||
QTest::newRow("ErrorStopOnFinished") << TestData{storage, root5, log, 1, OnDone::Failure};
|
||||
|
||||
const Group root6 = createRoot(WorkflowPolicy::Optional);
|
||||
const Group root6 = createRoot(WorkflowPolicy::FinishAllAndDone);
|
||||
QTest::newRow("ErrorOptional") << TestData{storage, root6, optionalLog, 1, OnDone::Success};
|
||||
}
|
||||
|
||||
@@ -799,7 +799,7 @@ void tst_Tasking::testTree_data()
|
||||
QTest::newRow("StopRootWithStopOnFinished")
|
||||
<< TestData{storage, root5, errorErrorLog, 2, OnDone::Failure};
|
||||
|
||||
const Group root6 = createRoot(WorkflowPolicy::Optional);
|
||||
const Group root6 = createRoot(WorkflowPolicy::FinishAllAndDone);
|
||||
QTest::newRow("StopRootWithOptional")
|
||||
<< TestData{storage, root6, doneLog, 2, OnDone::Success};
|
||||
}
|
||||
@@ -883,7 +883,7 @@ void tst_Tasking::testTree_data()
|
||||
QTest::newRow("StopRootAfterDoneWithStopOnFinished")
|
||||
<< TestData{storage, root5, doneErrorLog, 3, OnDone::Success};
|
||||
|
||||
const Group root6 = createRoot(WorkflowPolicy::Optional);
|
||||
const Group root6 = createRoot(WorkflowPolicy::FinishAllAndDone);
|
||||
QTest::newRow("StopRootAfterDoneWithOptional")
|
||||
<< TestData{storage, root6, doneDoneLog, 3, OnDone::Success};
|
||||
}
|
||||
@@ -947,7 +947,7 @@ void tst_Tasking::testTree_data()
|
||||
QTest::newRow("StopGroupWithStopOnFinished")
|
||||
<< TestData{storage, root5, errorLog, 2, OnDone::Failure};
|
||||
|
||||
const Group root6 = createRoot(WorkflowPolicy::Optional);
|
||||
const Group root6 = createRoot(WorkflowPolicy::FinishAllAndDone);
|
||||
QTest::newRow("StopGroupWithOptional")
|
||||
<< TestData{storage, root6, doneLog, 2, OnDone::Failure};
|
||||
}
|
||||
@@ -1025,7 +1025,7 @@ void tst_Tasking::testTree_data()
|
||||
QTest::newRow("StopGroupAfterDoneWithStopOnFinished")
|
||||
<< TestData{storage, root5, shortDoneLog, 3, OnDone::Failure};
|
||||
|
||||
const Group root6 = createRoot(WorkflowPolicy::Optional);
|
||||
const Group root6 = createRoot(WorkflowPolicy::FinishAllAndDone);
|
||||
QTest::newRow("StopGroupAfterDoneWithOptional")
|
||||
<< TestData{storage, root6, longDoneLog, 3, OnDone::Failure};
|
||||
}
|
||||
@@ -1103,7 +1103,7 @@ void tst_Tasking::testTree_data()
|
||||
QTest::newRow("StopGroupAfterErrorWithStopOnFinished")
|
||||
<< TestData{storage, root5, shortErrorLog, 3, OnDone::Failure};
|
||||
|
||||
const Group root6 = createRoot(WorkflowPolicy::Optional);
|
||||
const Group root6 = createRoot(WorkflowPolicy::FinishAllAndDone);
|
||||
QTest::newRow("StopGroupAfterErrorWithOptional")
|
||||
<< TestData{storage, root6, doneLog, 3, OnDone::Failure};
|
||||
}
|
||||
@@ -1216,7 +1216,7 @@ void tst_Tasking::testTree_data()
|
||||
{
|
||||
const Group root {
|
||||
Storage(storage),
|
||||
optional,
|
||||
finishAllAndDone,
|
||||
createFailingTask(1),
|
||||
createFailingTask(2),
|
||||
groupDone(0),
|
||||
|
||||
@@ -101,7 +101,7 @@ int main(int argc, char *argv[])
|
||||
task_4_4->setBusyTime(3);
|
||||
|
||||
groupTask_1->setWorkflowPolicy(Tasking::WorkflowPolicy::ContinueOnDone);
|
||||
groupTask_4->setWorkflowPolicy(Tasking::WorkflowPolicy::Optional);
|
||||
groupTask_4->setWorkflowPolicy(Tasking::WorkflowPolicy::FinishAllAndDone);
|
||||
groupTask_4_3->setExecuteMode(ExecuteMode::Parallel);
|
||||
groupTask_4_3->setWorkflowPolicy(Tasking::WorkflowPolicy::StopOnError);
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@ GroupWidget::GroupWidget()
|
||||
m_workflowCombo->addItem("Cont On Error", (int)Tasking::WorkflowPolicy::ContinueOnError);
|
||||
m_workflowCombo->addItem("Stop On Done", (int)Tasking::WorkflowPolicy::StopOnDone);
|
||||
m_workflowCombo->addItem("Cont On Done", (int)Tasking::WorkflowPolicy::ContinueOnDone);
|
||||
m_workflowCombo->addItem("Optional", (int)Tasking::WorkflowPolicy::Optional);
|
||||
m_workflowCombo->addItem("Optional", (int)Tasking::WorkflowPolicy::FinishAllAndDone);
|
||||
updateWorkflowPolicy();
|
||||
connect(m_workflowCombo, &QComboBox::currentIndexChanged, this, [this](int index) {
|
||||
m_workflowPolicy = (Tasking::WorkflowPolicy)m_workflowCombo->itemData(index).toInt();
|
||||
|
||||
Reference in New Issue
Block a user