forked from qt-creator/qt-creator
TaskTree: Introduce GroupItems
A shortcut for QList<GroupItem>. Change-Id: I7428a5313a825e892d66964748ff4f7906378d28 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -28,7 +28,7 @@ static ExecutableItem conditionsRecipe(const QList<ConditionData> &conditions)
|
||||
{
|
||||
Storage<bool> bodyExecutedStorage;
|
||||
|
||||
QList<GroupItem> recipes;
|
||||
GroupItems recipes;
|
||||
for (const ConditionData &condition : conditions)
|
||||
recipes << conditionRecipe(bodyExecutedStorage, condition);
|
||||
|
||||
|
@@ -51,7 +51,7 @@ private:
|
||||
class TASKING_EXPORT Else
|
||||
{
|
||||
public:
|
||||
explicit Else(const QList<GroupItem> &children) : m_body({children}) {}
|
||||
explicit Else(const GroupItems &children) : m_body({children}) {}
|
||||
explicit Else(std::initializer_list<GroupItem> children) : m_body({children}) {}
|
||||
|
||||
private:
|
||||
@@ -62,7 +62,7 @@ private:
|
||||
class TASKING_EXPORT Then
|
||||
{
|
||||
public:
|
||||
explicit Then(const QList<GroupItem> &children) : m_body({children}) {}
|
||||
explicit Then(const GroupItems &children) : m_body({children}) {}
|
||||
explicit Then(std::initializer_list<GroupItem> children) : m_body({children}) {}
|
||||
|
||||
private:
|
||||
|
@@ -319,6 +319,12 @@ private:
|
||||
\sa operator->(), operator*()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\typealias GroupItems
|
||||
|
||||
Type alias for QList<GroupItem>.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\class Tasking::GroupItem
|
||||
\inheaderfile solutions/tasking/tasktree.h
|
||||
@@ -383,7 +389,7 @@ private:
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn GroupItem::GroupItem(const QList<GroupItem> &items)
|
||||
\fn GroupItem::GroupItem(const GroupItems &items)
|
||||
|
||||
Constructs a \c GroupItem element with a given list of \a items.
|
||||
|
||||
@@ -419,7 +425,7 @@ private:
|
||||
/*!
|
||||
\fn GroupItem::GroupItem(std::initializer_list<GroupItem> items)
|
||||
\overload
|
||||
\sa GroupItem(const QList<Tasking::GroupItem> &items)
|
||||
\sa GroupItem(const GroupItems &items)
|
||||
*/
|
||||
|
||||
/*!
|
||||
@@ -508,7 +514,7 @@ private:
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn Group::Group(const QList<GroupItem> &children)
|
||||
\fn Group::Group(const GroupItems &children)
|
||||
|
||||
Constructs a group with a given list of \a children.
|
||||
|
||||
@@ -518,7 +524,7 @@ private:
|
||||
\code
|
||||
const QStringList sourceList = ...;
|
||||
|
||||
QList<GroupItem> groupItems { parallel };
|
||||
GroupItems groupItems { parallel };
|
||||
|
||||
for (const QString &source : sourceList) {
|
||||
const NetworkQueryTask task(...); // use source for setup handler
|
||||
@@ -1446,7 +1452,7 @@ void *StorageBase::activeStorageVoid() const
|
||||
return m_storageData->threadData().activeStorage();
|
||||
}
|
||||
|
||||
void GroupItem::addChildren(const QList<GroupItem> &children)
|
||||
void GroupItem::addChildren(const GroupItems &children)
|
||||
{
|
||||
QT_ASSERT(m_type == Type::Group || m_type == Type::List,
|
||||
qWarning("Only Group or List may have children, skipping..."); return);
|
||||
@@ -2110,7 +2116,7 @@ void RuntimeIteration::deleteChild(RuntimeTask *task)
|
||||
}
|
||||
|
||||
static std::vector<TaskNode> createChildren(TaskTreePrivate *taskTreePrivate,
|
||||
const QList<GroupItem> &children)
|
||||
const GroupItems &children)
|
||||
{
|
||||
std::vector<TaskNode> result;
|
||||
result.reserve(children.size());
|
||||
|
@@ -18,6 +18,12 @@ class QFuture;
|
||||
|
||||
namespace Tasking {
|
||||
|
||||
class Do;
|
||||
class For;
|
||||
class Group;
|
||||
class GroupItem;
|
||||
using GroupItems = QList<GroupItem>;
|
||||
|
||||
Q_NAMESPACE_EXPORT(TASKING_EXPORT)
|
||||
|
||||
// WorkflowPolicy:
|
||||
@@ -196,10 +202,6 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
class Do;
|
||||
class For;
|
||||
class Group;
|
||||
|
||||
class TASKING_EXPORT GroupItem
|
||||
{
|
||||
public:
|
||||
@@ -214,7 +216,7 @@ public:
|
||||
, m_storageList{storage} {}
|
||||
|
||||
// TODO: Add tests.
|
||||
GroupItem(const QList<GroupItem> &children) : m_type(Type::List) { addChildren(children); }
|
||||
GroupItem(const GroupItems &children) : m_type(Type::List) { addChildren(children); }
|
||||
GroupItem(std::initializer_list<GroupItem> children) : m_type(Type::List) { addChildren(children); }
|
||||
|
||||
protected:
|
||||
@@ -262,7 +264,7 @@ protected:
|
||||
GroupItem(const TaskHandler &handler)
|
||||
: m_type(Type::TaskHandler)
|
||||
, m_taskHandler(handler) {}
|
||||
void addChildren(const QList<GroupItem> &children);
|
||||
void addChildren(const GroupItems &children);
|
||||
|
||||
static GroupItem groupHandler(const GroupHandler &handler) { return GroupItem({handler}); }
|
||||
|
||||
@@ -285,7 +287,7 @@ private:
|
||||
friend class ParallelLimitFunctor;
|
||||
friend class WorkflowPolicyFunctor;
|
||||
Type m_type = Type::Group;
|
||||
QList<GroupItem> m_children;
|
||||
GroupItems m_children;
|
||||
GroupData m_groupData;
|
||||
QList<StorageBase> m_storageList;
|
||||
TaskHandler m_taskHandler;
|
||||
@@ -329,7 +331,7 @@ private:
|
||||
class TASKING_EXPORT Group : public ExecutableItem
|
||||
{
|
||||
public:
|
||||
Group(const QList<GroupItem> &children) { addChildren(children); }
|
||||
Group(const GroupItems &children) { addChildren(children); }
|
||||
Group(std::initializer_list<GroupItem> children) { addChildren(children); }
|
||||
|
||||
// GroupData related:
|
||||
@@ -453,7 +455,7 @@ private:
|
||||
class TASKING_EXPORT Do final
|
||||
{
|
||||
public:
|
||||
explicit Do(const QList<GroupItem> &children) : m_children(children) {}
|
||||
explicit Do(const GroupItems &children) : m_children(children) {}
|
||||
explicit Do(std::initializer_list<GroupItem> children) : m_children(children) {}
|
||||
|
||||
private:
|
||||
@@ -465,7 +467,7 @@ private:
|
||||
class TASKING_EXPORT Forever final : public ExecutableItem
|
||||
{
|
||||
public:
|
||||
explicit Forever(const QList<GroupItem> &children)
|
||||
explicit Forever(const GroupItems &children)
|
||||
{ addChildren({ For (LoopForever()) >> Do { children } } ); }
|
||||
explicit Forever(std::initializer_list<GroupItem> children)
|
||||
{ addChildren({ For (LoopForever()) >> Do { children } } ); }
|
||||
|
@@ -682,7 +682,7 @@ Group ClangTool::runRecipe(const RunSettings &runSettings,
|
||||
return SetupResult::StopWithError;
|
||||
};
|
||||
|
||||
QList<GroupItem> topTasks { onGroupSetup(onTopSetup) };
|
||||
GroupItems topTasks { onGroupSetup(onTopSetup) };
|
||||
|
||||
if (buildBeforeAnalysis) {
|
||||
QPointer<RunControl> runControl(m_runControl);
|
||||
|
@@ -193,7 +193,7 @@ void DocumentClangToolRunner::run()
|
||||
vfso().update();
|
||||
const ClangDiagnosticConfig config = diagnosticConfig(runSettings.diagnosticConfigId());
|
||||
const Environment env = projectBuildEnvironment(project);
|
||||
QList<GroupItem> tasks;
|
||||
GroupItems tasks;
|
||||
const auto addClangTool = [this, &runSettings, &config, &env, &tasks](ClangToolType tool) {
|
||||
if (!toolEnabled(tool, config, runSettings))
|
||||
return;
|
||||
|
@@ -402,7 +402,7 @@ void Locator::refresh(const QList<ILocatorFilter *> &filters)
|
||||
saveSettings();
|
||||
};
|
||||
|
||||
QList<GroupItem> tasks{parallel};
|
||||
GroupItems tasks{parallel};
|
||||
for (ILocatorFilter *filter : std::as_const(m_refreshingFilters)) {
|
||||
const auto task = filter->refreshRecipe();
|
||||
if (!task.has_value())
|
||||
|
@@ -72,7 +72,7 @@ void CppProjectUpdater::update(const ProjectUpdateInfo &projectUpdateInfo,
|
||||
if (async.isResultAvailable())
|
||||
storage->projectInfo = async.result();
|
||||
};
|
||||
QList<GroupItem> tasks{parallel};
|
||||
GroupItems tasks{parallel};
|
||||
tasks.append(AsyncTask<ProjectInfo::ConstPtr>(onInfoGeneratorSetup, onInfoGeneratorDone,
|
||||
CallDoneIf::Success));
|
||||
for (QPointer<ExtraCompiler> compiler : compilers) {
|
||||
|
@@ -762,10 +762,10 @@ void BuildManager::startBuildQueue()
|
||||
const GroupItem abortPolicy
|
||||
= projectExplorerSettings().abortBuildAllOnError ? stopOnError : continueOnError;
|
||||
|
||||
QList<GroupItem> topLevel { abortPolicy, ParserAwaiterTask(onAwaiterSetup) };
|
||||
GroupItems topLevel { abortPolicy, ParserAwaiterTask(onAwaiterSetup) };
|
||||
Project *lastProject = nullptr;
|
||||
Target *lastTarget = nullptr;
|
||||
QList<GroupItem> targetTasks;
|
||||
GroupItems targetTasks;
|
||||
d->m_progress = 0;
|
||||
d->m_maxProgress = 0;
|
||||
|
||||
|
@@ -154,7 +154,7 @@ GroupItem GenericDirectUploadStep::statTree(const Storage<UploadStorage> &storag
|
||||
const auto onSetup = [this, storage, filesToStat, statEndHandler](TaskTree &tree) {
|
||||
UploadStorage *storagePtr = storage.activeStorage();
|
||||
const QList<DeployableFile> files = filesToStat(storagePtr);
|
||||
QList<GroupItem> statList{finishAllAndSuccess, parallelLimit(MaxConcurrentStatCalls)};
|
||||
GroupItems statList{finishAllAndSuccess, parallelLimit(MaxConcurrentStatCalls)};
|
||||
for (const DeployableFile &file : std::as_const(files)) {
|
||||
QTC_ASSERT(file.isValid(), continue);
|
||||
statList.append(statTask(storagePtr, file, statEndHandler));
|
||||
|
@@ -46,7 +46,7 @@ public:
|
||||
LinuxDevice::Ptr m_device;
|
||||
TaskTreeRunner m_taskTreeRunner;
|
||||
QStringList m_extraCommands;
|
||||
QList<GroupItem> m_extraTests;
|
||||
GroupItems m_extraTests;
|
||||
};
|
||||
|
||||
QStringList GenericLinuxDeviceTesterPrivate::commandsToTest() const
|
||||
@@ -306,7 +306,7 @@ void GenericLinuxDeviceTester::setExtraCommandsToTest(const QStringList &extraCo
|
||||
d->m_extraCommands = extraCommands;
|
||||
}
|
||||
|
||||
void GenericLinuxDeviceTester::setExtraTests(const QList<GroupItem> &extraTests)
|
||||
void GenericLinuxDeviceTester::setExtraTests(const GroupItems &extraTests)
|
||||
{
|
||||
d->m_extraTests = extraTests;
|
||||
}
|
||||
|
@@ -2735,7 +2735,7 @@ void tst_Tasking::testTree_data()
|
||||
}
|
||||
|
||||
{
|
||||
const QList<GroupItem> successItems {
|
||||
const GroupItems successItems {
|
||||
storage,
|
||||
createSuccessTask(1),
|
||||
createSuccessTask(2)
|
||||
@@ -2786,7 +2786,7 @@ void tst_Tasking::testTree_data()
|
||||
{2, Handler::Success}
|
||||
};
|
||||
|
||||
const QList<GroupItem> errorItems {
|
||||
const GroupItems errorItems {
|
||||
storage,
|
||||
createSuccessTask(1),
|
||||
createFailingTask(2)
|
||||
@@ -2871,7 +2871,7 @@ void tst_Tasking::testTree_data()
|
||||
};
|
||||
};
|
||||
|
||||
const QList<GroupItem> items {
|
||||
const GroupItems items {
|
||||
storage,
|
||||
TestTask(onSetupContinue(1), onDone(1)),
|
||||
TestTask(onSetupStop(2), onDone(2))
|
||||
@@ -3982,7 +3982,7 @@ void tst_Tasking::testInThread()
|
||||
QCOMPARE(result.executeCount, s_loopCount);
|
||||
};
|
||||
|
||||
QList<GroupItem> tasks = { parallel };
|
||||
GroupItems tasks = { parallel };
|
||||
for (int i = 0; i < s_threadCount; ++i)
|
||||
tasks.append(ConcurrentCallTask<TestResult>(onSetup, onDone));
|
||||
|
||||
|
Reference in New Issue
Block a user