diff --git a/src/libs/solutions/tasking/tasktree.cpp b/src/libs/solutions/tasking/tasktree.cpp index 540342ac8ff..054647752af 100644 --- a/src/libs/solutions/tasking/tasktree.cpp +++ b/src/libs/solutions/tasking/tasktree.cpp @@ -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 diff --git a/src/libs/solutions/tasking/tasktree.h b/src/libs/solutions/tasking/tasktree.h index 1754e092631..872bce2ed86 100644 --- a/src/libs/solutions/tasking/tasktree.h +++ b/src/libs/solutions/tasking/tasktree.h @@ -99,15 +99,15 @@ 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). - ContinueOnError, // 1b - The same, but children execution continues. Reports done when no children. - 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. + StopOnError, // 1a - Reports error on first child error, otherwise done (if all children were done). + ContinueOnError, // 1b - The same, but children execution continues. Reports done when no children. + 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. + 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 { diff --git a/src/plugins/autotest/testrunner.cpp b/src/plugins/autotest/testrunner.cpp index 206dca8da41..5c53d742e65 100644 --- a/src/plugins/autotest/testrunner.cpp +++ b/src/plugins/autotest/testrunner.cpp @@ -347,7 +347,7 @@ void TestRunner::runTestsHelper() std::unique_ptr m_outputReader; }; - QList tasks{optional}; + QList 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) diff --git a/src/plugins/clangtools/clangtoolrunner.cpp b/src/plugins/clangtools/clangtoolrunner.cpp index 40cbf75d47e..3e2c7a6c111 100644 --- a/src/plugins/clangtools/clangtoolrunner.cpp +++ b/src/plugins/clangtools/clangtoolrunner.cpp @@ -186,7 +186,7 @@ TaskItem clangToolTask(const AnalyzeInputData &input, Storage(storage), onGroupSetup(onSetup), Group { - optional, + finishAllAndDone, ProcessTask(onProcessSetup, onProcessDone, onProcessError) } }; diff --git a/src/plugins/clangtools/documentclangtoolrunner.cpp b/src/plugins/clangtools/documentclangtoolrunner.cpp index 178022a91a6..3de2c6d55cf 100644 --- a/src/plugins/clangtools/documentclangtoolrunner.cpp +++ b/src/plugins/clangtools/documentclangtoolrunner.cpp @@ -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); diff --git a/src/plugins/coreplugin/locator/ilocatorfilter.cpp b/src/plugins/coreplugin/locator/ilocatorfilter.cpp index f6b39996d8f..3a84a0b548b 100644 --- a/src/plugins/coreplugin/locator/ilocatorfilter.cpp +++ b/src/plugins/coreplugin/locator/ilocatorfilter.cpp @@ -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)), diff --git a/src/plugins/coreplugin/locator/locator.cpp b/src/plugins/coreplugin/locator/locator.cpp index 55b82920329..2deaef9fe09 100644 --- a/src/plugins/coreplugin/locator/locator.cpp +++ b/src/plugins/coreplugin/locator/locator.cpp @@ -388,7 +388,7 @@ void Locator::refresh(const QList &filters) continue; const Group group { - optional, + finishAllAndDone, *task, onGroupDone([this, filter] { m_refreshingFilters.removeOne(filter); }) }; diff --git a/src/plugins/diffeditor/diffeditorplugin.cpp b/src/plugins/diffeditor/diffeditorplugin.cpp index fe4c4f9a6a5..99ceef2f0ab 100644 --- a/src/plugins/diffeditor/diffeditorplugin.cpp +++ b/src/plugins/diffeditor/diffeditorplugin.cpp @@ -128,7 +128,7 @@ DiffFilesController::DiffFilesController(IDocument *document) outputList->resize(inputList.size()); using namespace std::placeholders; - QList tasks {parallel, optional}; + QList tasks {parallel, finishAllAndDone}; for (int i = 0; i < inputList.size(); ++i) { tasks.append(AsyncTask(std::bind(setupDiff, _1, inputList.at(i)), std::bind(onDiffDone, _1, i))); diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index f0427e08268..dd335dcc650 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -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), diff --git a/src/plugins/qnx/qnxdeployqtlibrariesdialog.cpp b/src/plugins/qnx/qnxdeployqtlibrariesdialog.cpp index 0b6e74dca8b..a5cc9cdad86 100644 --- a/src/plugins/qnx/qnxdeployqtlibrariesdialog.cpp +++ b/src/plugins/qnx/qnxdeployqtlibrariesdialog.cpp @@ -223,7 +223,7 @@ TaskItem QnxDeployQtLibrariesDialogPrivate::chmodTree() if (file.isExecutable()) filesToChmod << file; } - QList chmodList{optional, parallelLimit(MaxConcurrentStatCalls)}; + QList 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 { diff --git a/src/plugins/remotelinux/genericdirectuploadstep.cpp b/src/plugins/remotelinux/genericdirectuploadstep.cpp index 9179ac87519..6074eaabaaf 100644 --- a/src/plugins/remotelinux/genericdirectuploadstep.cpp +++ b/src/plugins/remotelinux/genericdirectuploadstep.cpp @@ -179,7 +179,7 @@ TaskItem GenericDirectUploadStep::statTree(const TreeStorage &sto const auto setupHandler = [=](TaskTree &tree) { UploadStorage *storagePtr = storage.activeStorage(); const QList files = filesToStat(storagePtr); - QList statList{optional, parallelLimit(MaxConcurrentStatCalls)}; + QList 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 &st if (file.isExecutable()) filesToChmod << file; } - QList chmodList{optional, parallelLimit(MaxConcurrentStatCalls)}; + QList chmodList{finishAllAndDone, parallelLimit(MaxConcurrentStatCalls)}; for (const DeployableFile &file : std::as_const(filesToChmod)) { QTC_ASSERT(file.isValid(), continue); chmodList.append(chmodTask(file)); diff --git a/src/plugins/remotelinux/linuxdevicetester.cpp b/src/plugins/remotelinux/linuxdevicetester.cpp index ecb4296262d..37aea361123 100644 --- a/src/plugins/remotelinux/linuxdevicetester.cpp +++ b/src/plugins/remotelinux/linuxdevicetester.cpp @@ -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) }; } diff --git a/src/plugins/subversion/subversionclient.cpp b/src/plugins/subversion/subversionclient.cpp index 3146f066d6e..ac664a69b88 100644 --- a/src/plugins/subversion/subversionclient.cpp +++ b/src/plugins/subversion/subversionclient.cpp @@ -204,7 +204,7 @@ SubversionDiffEditorController::SubversionDiffEditorController(IDocument *docume Storage(diffInputStorage), parallel, Group { - optional, + finishAllAndDone, ProcessTask(setupDescription, onDescriptionDone, onDescriptionError) }, Group { diff --git a/tests/auto/solutions/tasking/tst_tasking.cpp b/tests/auto/solutions/tasking/tst_tasking.cpp index e86c135066c..9ddcbc0cbde 100644 --- a/tests/auto/solutions/tasking/tst_tasking.cpp +++ b/tests/auto/solutions/tasking/tst_tasking.cpp @@ -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), diff --git a/tests/manual/tasktree/main.cpp b/tests/manual/tasktree/main.cpp index ac5df4b0f6c..3976e3308dc 100644 --- a/tests/manual/tasktree/main.cpp +++ b/tests/manual/tasktree/main.cpp @@ -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); diff --git a/tests/manual/tasktree/taskwidget.cpp b/tests/manual/tasktree/taskwidget.cpp index e969dbf2d73..ddc56aa77e2 100644 --- a/tests/manual/tasktree/taskwidget.cpp +++ b/tests/manual/tasktree/taskwidget.cpp @@ -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();