forked from qt-creator/qt-creator
TaskTree: Rename TaskItem into GroupItem
Not all classes derived from TaskItem are tasks, but the common denominator is that all may be placed inside a group: thus GroupItem sounds more appropriate. Addresses the 10th point in the bugreport below. Task-number: QTCREATORBUG-28741 Change-Id: I94d728a8e39ec732810f2e5bbe6b9a76f3bc387c Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -43,11 +43,11 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class Tasking::TaskItem
|
\class Tasking::GroupItem
|
||||||
\inheaderfile solutions/tasking/tasktree.h
|
\inheaderfile solutions/tasking/tasktree.h
|
||||||
\inmodule QtCreator
|
\inmodule QtCreator
|
||||||
\ingroup mainclasses
|
\ingroup mainclasses
|
||||||
\brief The TaskItem class represents the basic element for composing nested tree structures.
|
\brief The GroupItem class represents the basic element for composing nested tree structures.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -246,7 +246,7 @@ private:
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\typealias TaskItem::GroupSetupHandler
|
\typealias GroupItem::GroupSetupHandler
|
||||||
|
|
||||||
Type alias for \c std::function<TaskAction()>.
|
Type alias for \c std::function<TaskAction()>.
|
||||||
|
|
||||||
@@ -277,7 +277,7 @@ private:
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\typealias TaskItem::GroupEndHandler
|
\typealias GroupItem::GroupEndHandler
|
||||||
|
|
||||||
Type alias for \c std::function\<void()\>.
|
Type alias for \c std::function\<void()\>.
|
||||||
|
|
||||||
@@ -290,13 +290,14 @@ private:
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn template <typename SetupHandler> TaskItem onGroupSetup(SetupHandler &&handler)
|
\fn template <typename SetupHandler> GroupItem onGroupSetup(SetupHandler &&handler)
|
||||||
|
|
||||||
Constructs a group's element holding the group setup handler.
|
Constructs a group's element holding the group setup handler.
|
||||||
The \a handler is invoked whenever the group starts.
|
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<TaskAction()> or \c std::function<void()>
|
||||||
type. For more information on possible argument type, refer to \l {TaskItem::GroupSetupHandler}.
|
type. For more information on possible argument type, refer to
|
||||||
|
\l {GroupItem::GroupSetupHandler}.
|
||||||
|
|
||||||
When the \a handler is invoked, none of the group's child tasks are running yet.
|
When the \a handler is invoked, none of the group's child tasks are running yet.
|
||||||
|
|
||||||
@@ -304,7 +305,7 @@ private:
|
|||||||
after the storages are constructed, so that the \a handler may already
|
after the storages are constructed, so that the \a handler may already
|
||||||
perform some initial modifications to the active storages.
|
perform some initial modifications to the active storages.
|
||||||
|
|
||||||
\sa TaskItem::GroupSetupHandler, onGroupDone, onGroupError
|
\sa GroupItem::GroupSetupHandler, onGroupDone, onGroupError
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -319,9 +320,9 @@ private:
|
|||||||
before the storages are destructed, so that the \a handler may still
|
before the storages are destructed, so that the \a handler may still
|
||||||
perform a last read of the active storages' data.
|
perform a last read of the active storages' data.
|
||||||
|
|
||||||
\sa TaskItem::GroupEndHandler, onGroupSetup, onGroupError
|
\sa GroupItem::GroupEndHandler, onGroupSetup, onGroupError
|
||||||
*/
|
*/
|
||||||
TaskItem onGroupDone(const TaskItem::GroupEndHandler &handler)
|
GroupItem onGroupDone(const GroupItem::GroupEndHandler &handler)
|
||||||
{
|
{
|
||||||
return Group::onGroupDone(handler);
|
return Group::onGroupDone(handler);
|
||||||
}
|
}
|
||||||
@@ -338,9 +339,9 @@ TaskItem onGroupDone(const TaskItem::GroupEndHandler &handler)
|
|||||||
before the storages are destructed, so that the \a handler may still
|
before the storages are destructed, so that the \a handler may still
|
||||||
perform a last read of the active storages' data.
|
perform a last read of the active storages' data.
|
||||||
|
|
||||||
\sa TaskItem::GroupEndHandler, onGroupSetup, onGroupDone
|
\sa GroupItem::GroupEndHandler, onGroupSetup, onGroupDone
|
||||||
*/
|
*/
|
||||||
TaskItem onGroupError(const TaskItem::GroupEndHandler &handler)
|
GroupItem onGroupError(const GroupItem::GroupEndHandler &handler)
|
||||||
{
|
{
|
||||||
return Group::onGroupError(handler);
|
return Group::onGroupError(handler);
|
||||||
}
|
}
|
||||||
@@ -386,7 +387,7 @@ TaskItem onGroupError(const TaskItem::GroupEndHandler &handler)
|
|||||||
|
|
||||||
\sa sequential, parallel
|
\sa sequential, parallel
|
||||||
*/
|
*/
|
||||||
TaskItem parallelLimit(int limit)
|
GroupItem parallelLimit(int limit)
|
||||||
{
|
{
|
||||||
return Group::parallelLimit(qMax(limit, 0));
|
return Group::parallelLimit(qMax(limit, 0));
|
||||||
}
|
}
|
||||||
@@ -399,21 +400,21 @@ TaskItem parallelLimit(int limit)
|
|||||||
\sa stopOnError, continueOnError, stopOnDone, continueOnDone, stopOnFinished, finishAllAndDone,
|
\sa stopOnError, continueOnError, stopOnDone, continueOnDone, stopOnFinished, finishAllAndDone,
|
||||||
finishAllAndError, WorkflowPolicy
|
finishAllAndError, WorkflowPolicy
|
||||||
*/
|
*/
|
||||||
TaskItem workflowPolicy(WorkflowPolicy policy)
|
GroupItem workflowPolicy(WorkflowPolicy policy)
|
||||||
{
|
{
|
||||||
return Group::workflowPolicy(policy);
|
return Group::workflowPolicy(policy);
|
||||||
}
|
}
|
||||||
|
|
||||||
const TaskItem sequential = parallelLimit(1);
|
const GroupItem sequential = parallelLimit(1);
|
||||||
const TaskItem parallel = parallelLimit(0);
|
const GroupItem parallel = parallelLimit(0);
|
||||||
|
|
||||||
const TaskItem stopOnError = workflowPolicy(WorkflowPolicy::StopOnError);
|
const GroupItem stopOnError = workflowPolicy(WorkflowPolicy::StopOnError);
|
||||||
const TaskItem continueOnError = workflowPolicy(WorkflowPolicy::ContinueOnError);
|
const GroupItem continueOnError = workflowPolicy(WorkflowPolicy::ContinueOnError);
|
||||||
const TaskItem stopOnDone = workflowPolicy(WorkflowPolicy::StopOnDone);
|
const GroupItem stopOnDone = workflowPolicy(WorkflowPolicy::StopOnDone);
|
||||||
const TaskItem continueOnDone = workflowPolicy(WorkflowPolicy::ContinueOnDone);
|
const GroupItem continueOnDone = workflowPolicy(WorkflowPolicy::ContinueOnDone);
|
||||||
const TaskItem stopOnFinished = workflowPolicy(WorkflowPolicy::StopOnFinished);
|
const GroupItem stopOnFinished = workflowPolicy(WorkflowPolicy::StopOnFinished);
|
||||||
const TaskItem finishAllAndDone = workflowPolicy(WorkflowPolicy::FinishAllAndDone);
|
const GroupItem finishAllAndDone = workflowPolicy(WorkflowPolicy::FinishAllAndDone);
|
||||||
const TaskItem finishAllAndError = workflowPolicy(WorkflowPolicy::FinishAllAndError);
|
const GroupItem finishAllAndError = workflowPolicy(WorkflowPolicy::FinishAllAndError);
|
||||||
|
|
||||||
static TaskAction toTaskAction(bool success)
|
static TaskAction toTaskAction(bool success)
|
||||||
{
|
{
|
||||||
@@ -483,11 +484,11 @@ void TreeStorageBase::activateStorage(int id) const
|
|||||||
m_storageData->m_activeStorage = id;
|
m_storageData->m_activeStorage = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TaskItem::addChildren(const QList<TaskItem> &children)
|
void GroupItem::addChildren(const QList<GroupItem> &children)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_type == Type::Group, qWarning("Only Group may have children, skipping...");
|
QTC_ASSERT(m_type == Type::Group, qWarning("Only Group may have children, skipping...");
|
||||||
return);
|
return);
|
||||||
for (const TaskItem &child : children) {
|
for (const GroupItem &child : children) {
|
||||||
switch (child.m_type) {
|
switch (child.m_type) {
|
||||||
case Type::Group:
|
case Type::Group:
|
||||||
m_children.append(child);
|
m_children.append(child);
|
||||||
@@ -534,7 +535,7 @@ void TaskItem::addChildren(const QList<TaskItem> &children)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TaskItem::setTaskSetupHandler(const TaskSetupHandler &handler)
|
void GroupItem::setTaskSetupHandler(const TaskSetupHandler &handler)
|
||||||
{
|
{
|
||||||
if (!handler) {
|
if (!handler) {
|
||||||
qWarning("Setting empty Setup Handler is no-op, skipping...");
|
qWarning("Setting empty Setup Handler is no-op, skipping...");
|
||||||
@@ -545,7 +546,7 @@ void TaskItem::setTaskSetupHandler(const TaskSetupHandler &handler)
|
|||||||
m_taskHandler.m_setupHandler = handler;
|
m_taskHandler.m_setupHandler = handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TaskItem::setTaskDoneHandler(const TaskEndHandler &handler)
|
void GroupItem::setTaskDoneHandler(const TaskEndHandler &handler)
|
||||||
{
|
{
|
||||||
if (!handler) {
|
if (!handler) {
|
||||||
qWarning("Setting empty Done Handler is no-op, skipping...");
|
qWarning("Setting empty Done Handler is no-op, skipping...");
|
||||||
@@ -556,7 +557,7 @@ void TaskItem::setTaskDoneHandler(const TaskEndHandler &handler)
|
|||||||
m_taskHandler.m_doneHandler = handler;
|
m_taskHandler.m_doneHandler = handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TaskItem::setTaskErrorHandler(const TaskEndHandler &handler)
|
void GroupItem::setTaskErrorHandler(const TaskEndHandler &handler)
|
||||||
{
|
{
|
||||||
if (!handler) {
|
if (!handler) {
|
||||||
qWarning("Setting empty Error Handler is no-op, skipping...");
|
qWarning("Setting empty Error Handler is no-op, skipping...");
|
||||||
@@ -567,7 +568,7 @@ void TaskItem::setTaskErrorHandler(const TaskEndHandler &handler)
|
|||||||
m_taskHandler.m_errorHandler = handler;
|
m_taskHandler.m_errorHandler = handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskItem TaskItem::withTimeout(const TaskItem &item, milliseconds timeout,
|
GroupItem GroupItem::withTimeout(const GroupItem &item, milliseconds timeout,
|
||||||
const GroupEndHandler &handler)
|
const GroupEndHandler &handler)
|
||||||
{
|
{
|
||||||
const TimeoutTask::EndHandler taskHandler = handler
|
const TimeoutTask::EndHandler taskHandler = handler
|
||||||
@@ -640,7 +641,7 @@ class TaskContainer
|
|||||||
Q_DISABLE_COPY_MOVE(TaskContainer)
|
Q_DISABLE_COPY_MOVE(TaskContainer)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TaskContainer(TaskTreePrivate *taskTreePrivate, const TaskItem &task,
|
TaskContainer(TaskTreePrivate *taskTreePrivate, const GroupItem &task,
|
||||||
TaskNode *parentNode, TaskContainer *parentContainer)
|
TaskNode *parentNode, TaskContainer *parentContainer)
|
||||||
: m_constData(taskTreePrivate, task, parentNode, parentContainer, this) {}
|
: m_constData(taskTreePrivate, task, parentNode, parentContainer, this) {}
|
||||||
TaskAction start();
|
TaskAction start();
|
||||||
@@ -653,7 +654,7 @@ public:
|
|||||||
bool isStarting() const { return isRunning() && m_runtimeData->m_startGuard.isLocked(); }
|
bool isStarting() const { return isRunning() && m_runtimeData->m_startGuard.isLocked(); }
|
||||||
|
|
||||||
struct ConstData {
|
struct ConstData {
|
||||||
ConstData(TaskTreePrivate *taskTreePrivate, const TaskItem &task, TaskNode *parentNode,
|
ConstData(TaskTreePrivate *taskTreePrivate, const GroupItem &task, TaskNode *parentNode,
|
||||||
TaskContainer *parentContainer, TaskContainer *thisContainer);
|
TaskContainer *parentContainer, TaskContainer *thisContainer);
|
||||||
~ConstData() { qDeleteAll(m_children); }
|
~ConstData() { qDeleteAll(m_children); }
|
||||||
TaskTreePrivate * const m_taskTreePrivate = nullptr;
|
TaskTreePrivate * const m_taskTreePrivate = nullptr;
|
||||||
@@ -662,7 +663,7 @@ public:
|
|||||||
|
|
||||||
const int m_parallelLimit = 1;
|
const int m_parallelLimit = 1;
|
||||||
const WorkflowPolicy m_workflowPolicy = WorkflowPolicy::StopOnError;
|
const WorkflowPolicy m_workflowPolicy = WorkflowPolicy::StopOnError;
|
||||||
const TaskItem::GroupHandler m_groupHandler;
|
const GroupItem::GroupHandler m_groupHandler;
|
||||||
const QList<TreeStorageBase> m_storageList;
|
const QList<TreeStorageBase> m_storageList;
|
||||||
const QList<TaskNode *> m_children;
|
const QList<TaskNode *> m_children;
|
||||||
const int m_taskCount = 0;
|
const int m_taskCount = 0;
|
||||||
@@ -693,7 +694,7 @@ class TaskNode
|
|||||||
Q_DISABLE_COPY_MOVE(TaskNode)
|
Q_DISABLE_COPY_MOVE(TaskNode)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TaskNode(TaskTreePrivate *taskTreePrivate, const TaskItem &task,
|
TaskNode(TaskTreePrivate *taskTreePrivate, const GroupItem &task,
|
||||||
TaskContainer *parentContainer)
|
TaskContainer *parentContainer)
|
||||||
: m_taskHandler(task.taskHandler())
|
: m_taskHandler(task.taskHandler())
|
||||||
, m_container(taskTreePrivate, task, this, parentContainer)
|
, m_container(taskTreePrivate, task, this, parentContainer)
|
||||||
@@ -711,7 +712,7 @@ public:
|
|||||||
TaskTree *taskTree() const { return m_container.m_constData.m_taskTreePrivate->q; }
|
TaskTree *taskTree() const { return m_container.m_constData.m_taskTreePrivate->q; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const TaskItem::TaskHandler m_taskHandler;
|
const GroupItem::TaskHandler m_taskHandler;
|
||||||
TaskContainer m_container;
|
TaskContainer m_container;
|
||||||
std::unique_ptr<TaskInterface> m_task;
|
std::unique_ptr<TaskInterface> m_task;
|
||||||
};
|
};
|
||||||
@@ -831,16 +832,16 @@ ReturnType invokeHandler(TaskContainer *container, Handler &&handler, Args &&...
|
|||||||
}
|
}
|
||||||
|
|
||||||
static QList<TaskNode *> createChildren(TaskTreePrivate *taskTreePrivate, TaskContainer *container,
|
static QList<TaskNode *> createChildren(TaskTreePrivate *taskTreePrivate, TaskContainer *container,
|
||||||
const TaskItem &task)
|
const GroupItem &task)
|
||||||
{
|
{
|
||||||
QList<TaskNode *> result;
|
QList<TaskNode *> result;
|
||||||
const QList<TaskItem> &children = task.children();
|
const QList<GroupItem> &children = task.children();
|
||||||
for (const TaskItem &child : children)
|
for (const GroupItem &child : children)
|
||||||
result.append(new TaskNode(taskTreePrivate, child, container));
|
result.append(new TaskNode(taskTreePrivate, child, container));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskContainer::ConstData::ConstData(TaskTreePrivate *taskTreePrivate, const TaskItem &task,
|
TaskContainer::ConstData::ConstData(TaskTreePrivate *taskTreePrivate, const GroupItem &task,
|
||||||
TaskNode *parentNode, TaskContainer *parentContainer,
|
TaskNode *parentNode, TaskContainer *parentContainer,
|
||||||
TaskContainer *thisContainer)
|
TaskContainer *thisContainer)
|
||||||
: m_taskTreePrivate(taskTreePrivate)
|
: m_taskTreePrivate(taskTreePrivate)
|
||||||
@@ -1035,7 +1036,7 @@ void TaskContainer::stop()
|
|||||||
|
|
||||||
void TaskContainer::invokeEndHandler()
|
void TaskContainer::invokeEndHandler()
|
||||||
{
|
{
|
||||||
const TaskItem::GroupHandler &groupHandler = m_constData.m_groupHandler;
|
const GroupItem::GroupHandler &groupHandler = m_constData.m_groupHandler;
|
||||||
if (m_runtimeData->m_successBit && groupHandler.m_doneHandler)
|
if (m_runtimeData->m_successBit && groupHandler.m_doneHandler)
|
||||||
invokeHandler(this, groupHandler.m_doneHandler);
|
invokeHandler(this, groupHandler.m_doneHandler);
|
||||||
else if (!m_runtimeData->m_successBit && groupHandler.m_errorHandler)
|
else if (!m_runtimeData->m_successBit && groupHandler.m_errorHandler)
|
||||||
@@ -1539,7 +1540,7 @@ void TaskNode::invokeEndHandler(bool success)
|
|||||||
static QByteArray load(const QString &fileName) { ... }
|
static QByteArray load(const QString &fileName) { ... }
|
||||||
static void save(const QString &fileName, const QByteArray &array) { ... }
|
static void save(const QString &fileName, const QByteArray &array) { ... }
|
||||||
|
|
||||||
static TaskItem copyRecipe(const QString &source, const QString &destination)
|
static GroupItem copyRecipe(const QString &source, const QString &destination)
|
||||||
{
|
{
|
||||||
struct CopyStorage { // [1] custom inter-task struct
|
struct CopyStorage { // [1] custom inter-task struct
|
||||||
QByteArray content; // [2] custom inter-task data
|
QByteArray content; // [2] custom inter-task data
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ enum class TaskAction
|
|||||||
};
|
};
|
||||||
Q_ENUM_NS(TaskAction);
|
Q_ENUM_NS(TaskAction);
|
||||||
|
|
||||||
class TASKING_EXPORT TaskItem
|
class TASKING_EXPORT GroupItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// Internal, provided by QTC_DECLARE_CUSTOM_TASK
|
// Internal, provided by QTC_DECLARE_CUSTOM_TASK
|
||||||
@@ -156,7 +156,7 @@ public:
|
|||||||
std::optional<WorkflowPolicy> m_workflowPolicy = {};
|
std::optional<WorkflowPolicy> m_workflowPolicy = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
QList<TaskItem> children() const { return m_children; }
|
QList<GroupItem> children() const { return m_children; }
|
||||||
GroupData groupData() const { return m_groupData; }
|
GroupData groupData() const { return m_groupData; }
|
||||||
QList<TreeStorageBase> storageList() const { return m_storageList; }
|
QList<TreeStorageBase> storageList() const { return m_storageList; }
|
||||||
TaskHandler taskHandler() const { return m_taskHandler; }
|
TaskHandler taskHandler() const { return m_taskHandler; }
|
||||||
@@ -169,58 +169,58 @@ protected:
|
|||||||
TaskHandler
|
TaskHandler
|
||||||
};
|
};
|
||||||
|
|
||||||
TaskItem() = default;
|
GroupItem() = default;
|
||||||
TaskItem(const GroupData &data)
|
GroupItem(const GroupData &data)
|
||||||
: m_type(Type::GroupData)
|
: m_type(Type::GroupData)
|
||||||
, m_groupData(data) {}
|
, m_groupData(data) {}
|
||||||
TaskItem(const TreeStorageBase &storage)
|
GroupItem(const TreeStorageBase &storage)
|
||||||
: m_type(Type::Storage)
|
: m_type(Type::Storage)
|
||||||
, m_storageList{storage} {}
|
, m_storageList{storage} {}
|
||||||
TaskItem(const TaskHandler &handler)
|
GroupItem(const TaskHandler &handler)
|
||||||
: m_type(Type::TaskHandler)
|
: m_type(Type::TaskHandler)
|
||||||
, m_taskHandler(handler) {}
|
, m_taskHandler(handler) {}
|
||||||
void addChildren(const QList<TaskItem> &children);
|
void addChildren(const QList<GroupItem> &children);
|
||||||
|
|
||||||
void setTaskSetupHandler(const TaskSetupHandler &handler);
|
void setTaskSetupHandler(const TaskSetupHandler &handler);
|
||||||
void setTaskDoneHandler(const TaskEndHandler &handler);
|
void setTaskDoneHandler(const TaskEndHandler &handler);
|
||||||
void setTaskErrorHandler(const TaskEndHandler &handler);
|
void setTaskErrorHandler(const TaskEndHandler &handler);
|
||||||
static TaskItem groupHandler(const GroupHandler &handler) { return TaskItem({handler}); }
|
static GroupItem groupHandler(const GroupHandler &handler) { return GroupItem({handler}); }
|
||||||
static TaskItem parallelLimit(int limit) { return TaskItem({{}, limit}); }
|
static GroupItem parallelLimit(int limit) { return GroupItem({{}, limit}); }
|
||||||
static TaskItem workflowPolicy(WorkflowPolicy policy) { return TaskItem({{}, {}, policy}); }
|
static GroupItem workflowPolicy(WorkflowPolicy policy) { return GroupItem({{}, {}, policy}); }
|
||||||
static TaskItem withTimeout(const TaskItem &item, std::chrono::milliseconds timeout,
|
static GroupItem withTimeout(const GroupItem &item, std::chrono::milliseconds timeout,
|
||||||
const GroupEndHandler &handler = {});
|
const GroupEndHandler &handler = {});
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Type m_type = Type::Group;
|
Type m_type = Type::Group;
|
||||||
QList<TaskItem> m_children;
|
QList<GroupItem> m_children;
|
||||||
GroupData m_groupData;
|
GroupData m_groupData;
|
||||||
QList<TreeStorageBase> m_storageList;
|
QList<TreeStorageBase> m_storageList;
|
||||||
TaskHandler m_taskHandler;
|
TaskHandler m_taskHandler;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TASKING_EXPORT Group : public TaskItem
|
class TASKING_EXPORT Group : public GroupItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Group(const QList<TaskItem> &children) { addChildren(children); }
|
Group(const QList<GroupItem> &children) { addChildren(children); }
|
||||||
Group(std::initializer_list<TaskItem> children) { addChildren(children); }
|
Group(std::initializer_list<GroupItem> children) { addChildren(children); }
|
||||||
|
|
||||||
// GroupData related:
|
// GroupData related:
|
||||||
template <typename SetupHandler>
|
template <typename SetupHandler>
|
||||||
static TaskItem onGroupSetup(SetupHandler &&handler) {
|
static GroupItem onGroupSetup(SetupHandler &&handler) {
|
||||||
return groupHandler({wrapGroupSetup(std::forward<SetupHandler>(handler))});
|
return groupHandler({wrapGroupSetup(std::forward<SetupHandler>(handler))});
|
||||||
}
|
}
|
||||||
static TaskItem onGroupDone(const GroupEndHandler &handler) {
|
static GroupItem onGroupDone(const GroupEndHandler &handler) {
|
||||||
return groupHandler({{}, handler});
|
return groupHandler({{}, handler});
|
||||||
}
|
}
|
||||||
static TaskItem onGroupError(const GroupEndHandler &handler) {
|
static GroupItem onGroupError(const GroupEndHandler &handler) {
|
||||||
return groupHandler({{}, {}, handler});
|
return groupHandler({{}, {}, handler});
|
||||||
}
|
}
|
||||||
using TaskItem::parallelLimit; // Default: 1 (sequential). 0 means unlimited (parallel).
|
using GroupItem::parallelLimit; // Default: 1 (sequential). 0 means unlimited (parallel).
|
||||||
using TaskItem::workflowPolicy; // Default: WorkflowPolicy::StopOnError.
|
using GroupItem::workflowPolicy; // Default: WorkflowPolicy::StopOnError.
|
||||||
|
|
||||||
TaskItem withTimeout(std::chrono::milliseconds timeout,
|
GroupItem withTimeout(std::chrono::milliseconds timeout,
|
||||||
const GroupEndHandler &handler = {}) const {
|
const GroupEndHandler &handler = {}) const {
|
||||||
return TaskItem::withTimeout(*this, timeout, handler);
|
return GroupItem::withTimeout(*this, timeout, handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -244,31 +244,31 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <typename SetupHandler>
|
template <typename SetupHandler>
|
||||||
static TaskItem onGroupSetup(SetupHandler &&handler)
|
static GroupItem onGroupSetup(SetupHandler &&handler)
|
||||||
{
|
{
|
||||||
return Group::onGroupSetup(std::forward<SetupHandler>(handler));
|
return Group::onGroupSetup(std::forward<SetupHandler>(handler));
|
||||||
}
|
}
|
||||||
|
|
||||||
TASKING_EXPORT TaskItem onGroupDone(const TaskItem::GroupEndHandler &handler);
|
TASKING_EXPORT GroupItem onGroupDone(const GroupItem::GroupEndHandler &handler);
|
||||||
TASKING_EXPORT TaskItem onGroupError(const TaskItem::GroupEndHandler &handler);
|
TASKING_EXPORT GroupItem onGroupError(const GroupItem::GroupEndHandler &handler);
|
||||||
TASKING_EXPORT TaskItem parallelLimit(int limit);
|
TASKING_EXPORT GroupItem parallelLimit(int limit);
|
||||||
TASKING_EXPORT TaskItem workflowPolicy(WorkflowPolicy policy);
|
TASKING_EXPORT GroupItem workflowPolicy(WorkflowPolicy policy);
|
||||||
|
|
||||||
TASKING_EXPORT extern const TaskItem sequential;
|
TASKING_EXPORT extern const GroupItem sequential;
|
||||||
TASKING_EXPORT extern const TaskItem parallel;
|
TASKING_EXPORT extern const GroupItem parallel;
|
||||||
|
|
||||||
TASKING_EXPORT extern const TaskItem stopOnError;
|
TASKING_EXPORT extern const GroupItem stopOnError;
|
||||||
TASKING_EXPORT extern const TaskItem continueOnError;
|
TASKING_EXPORT extern const GroupItem continueOnError;
|
||||||
TASKING_EXPORT extern const TaskItem stopOnDone;
|
TASKING_EXPORT extern const GroupItem stopOnDone;
|
||||||
TASKING_EXPORT extern const TaskItem continueOnDone;
|
TASKING_EXPORT extern const GroupItem continueOnDone;
|
||||||
TASKING_EXPORT extern const TaskItem stopOnFinished;
|
TASKING_EXPORT extern const GroupItem stopOnFinished;
|
||||||
TASKING_EXPORT extern const TaskItem finishAllAndDone;
|
TASKING_EXPORT extern const GroupItem finishAllAndDone;
|
||||||
TASKING_EXPORT extern const TaskItem finishAllAndError;
|
TASKING_EXPORT extern const GroupItem finishAllAndError;
|
||||||
|
|
||||||
class TASKING_EXPORT Storage : public TaskItem
|
class TASKING_EXPORT Storage : public GroupItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Storage(const TreeStorageBase &storage) : TaskItem(storage) { }
|
Storage(const TreeStorageBase &storage) : GroupItem(storage) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
// Synchronous invocation. Similarly to Group - isn't counted as a task inside taskCount()
|
// Synchronous invocation. Similarly to Group - isn't counted as a task inside taskCount()
|
||||||
@@ -281,7 +281,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
template<typename Function>
|
template<typename Function>
|
||||||
static QList<TaskItem> init(Function &&function) {
|
static QList<GroupItem> init(Function &&function) {
|
||||||
constexpr bool isInvocable = std::is_invocable_v<std::decay_t<Function>>;
|
constexpr bool isInvocable = std::is_invocable_v<std::decay_t<Function>>;
|
||||||
static_assert(isInvocable,
|
static_assert(isInvocable,
|
||||||
"Sync element: The synchronous function can't take any arguments.");
|
"Sync element: The synchronous function can't take any arguments.");
|
||||||
@@ -310,16 +310,16 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <typename Adapter>
|
template <typename Adapter>
|
||||||
class CustomTask : public TaskItem
|
class CustomTask : public GroupItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using Task = typename Adapter::Type;
|
using Task = typename Adapter::Type;
|
||||||
using EndHandler = std::function<void(const Task &)>;
|
using EndHandler = std::function<void(const Task &)>;
|
||||||
static Adapter *createAdapter() { return new Adapter; }
|
static Adapter *createAdapter() { return new Adapter; }
|
||||||
CustomTask() : TaskItem({&createAdapter}) {}
|
CustomTask() : GroupItem({&createAdapter}) {}
|
||||||
template <typename SetupFunction>
|
template <typename SetupFunction>
|
||||||
CustomTask(SetupFunction &&function, const EndHandler &done = {}, const EndHandler &error = {})
|
CustomTask(SetupFunction &&function, const EndHandler &done = {}, const EndHandler &error = {})
|
||||||
: TaskItem({&createAdapter, wrapSetup(std::forward<SetupFunction>(function)),
|
: GroupItem({&createAdapter, wrapSetup(std::forward<SetupFunction>(function)),
|
||||||
wrapEnd(done), wrapEnd(error)}) {}
|
wrapEnd(done), wrapEnd(error)}) {}
|
||||||
|
|
||||||
template <typename SetupFunction>
|
template <typename SetupFunction>
|
||||||
@@ -336,14 +336,14 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskItem withTimeout(std::chrono::milliseconds timeout,
|
GroupItem withTimeout(std::chrono::milliseconds timeout,
|
||||||
const GroupEndHandler &handler = {}) const {
|
const GroupEndHandler &handler = {}) const {
|
||||||
return TaskItem::withTimeout(*this, timeout, handler);
|
return GroupItem::withTimeout(*this, timeout, handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template<typename SetupFunction>
|
template<typename SetupFunction>
|
||||||
static TaskItem::TaskSetupHandler wrapSetup(SetupFunction &&function) {
|
static GroupItem::TaskSetupHandler wrapSetup(SetupFunction &&function) {
|
||||||
static constexpr bool isDynamic = std::is_same_v<TaskAction,
|
static constexpr bool isDynamic = std::is_same_v<TaskAction,
|
||||||
std::invoke_result_t<std::decay_t<SetupFunction>, typename Adapter::Type &>>;
|
std::invoke_result_t<std::decay_t<SetupFunction>, typename Adapter::Type &>>;
|
||||||
constexpr bool isVoid = std::is_same_v<void,
|
constexpr bool isVoid = std::is_same_v<void,
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public:
|
|||||||
void start() {
|
void start() {
|
||||||
QTC_ASSERT(!m_taskTree, return);
|
QTC_ASSERT(!m_taskTree, return);
|
||||||
|
|
||||||
const TaskItem task = m_filePath.needsDevice() ? remoteTask() : localTask();
|
const GroupItem task = m_filePath.needsDevice() ? remoteTask() : localTask();
|
||||||
m_taskTree.reset(new TaskTree({task}));
|
m_taskTree.reset(new TaskTree({task}));
|
||||||
const auto finalize = [this](bool success) {
|
const auto finalize = [this](bool success) {
|
||||||
m_taskTree.release()->deleteLater();
|
m_taskTree.release()->deleteLater();
|
||||||
@@ -49,8 +49,8 @@ protected:
|
|||||||
std::unique_ptr<TaskTree> m_taskTree;
|
std::unique_ptr<TaskTree> m_taskTree;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual TaskItem remoteTask() = 0;
|
virtual GroupItem remoteTask() = 0;
|
||||||
virtual TaskItem localTask() = 0;
|
virtual GroupItem localTask() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void localRead(QPromise<QByteArray> &promise, const FilePath &filePath)
|
static void localRead(QPromise<QByteArray> &promise, const FilePath &filePath)
|
||||||
@@ -84,7 +84,7 @@ signals:
|
|||||||
void readyRead(const QByteArray &newData);
|
void readyRead(const QByteArray &newData);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TaskItem remoteTask() final {
|
GroupItem remoteTask() final {
|
||||||
const auto setup = [this](Process &process) {
|
const auto setup = [this](Process &process) {
|
||||||
const QStringList args = {"if=" + m_filePath.path()};
|
const QStringList args = {"if=" + m_filePath.path()};
|
||||||
const FilePath dd = m_filePath.withNewPath("dd");
|
const FilePath dd = m_filePath.withNewPath("dd");
|
||||||
@@ -96,7 +96,7 @@ private:
|
|||||||
};
|
};
|
||||||
return ProcessTask(setup);
|
return ProcessTask(setup);
|
||||||
}
|
}
|
||||||
TaskItem localTask() final {
|
GroupItem localTask() final {
|
||||||
const auto setup = [this](Async<QByteArray> &async) {
|
const auto setup = [this](Async<QByteArray> &async) {
|
||||||
async.setConcurrentCallData(localRead, m_filePath);
|
async.setConcurrentCallData(localRead, m_filePath);
|
||||||
Async<QByteArray> *asyncPtr = &async;
|
Async<QByteArray> *asyncPtr = &async;
|
||||||
@@ -251,7 +251,7 @@ signals:
|
|||||||
void started();
|
void started();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TaskItem remoteTask() final {
|
GroupItem remoteTask() final {
|
||||||
const auto setup = [this](Process &process) {
|
const auto setup = [this](Process &process) {
|
||||||
m_writeBuffer = new WriteBuffer(false, &process);
|
m_writeBuffer = new WriteBuffer(false, &process);
|
||||||
connect(m_writeBuffer, &WriteBuffer::writeRequested, &process, &Process::writeRaw);
|
connect(m_writeBuffer, &WriteBuffer::writeRequested, &process, &Process::writeRaw);
|
||||||
@@ -272,7 +272,7 @@ private:
|
|||||||
};
|
};
|
||||||
return ProcessTask(setup, finalize, finalize);
|
return ProcessTask(setup, finalize, finalize);
|
||||||
}
|
}
|
||||||
TaskItem localTask() final {
|
GroupItem localTask() final {
|
||||||
const auto setup = [this](Async<void> &async) {
|
const auto setup = [this](Async<void> &async) {
|
||||||
m_writeBuffer = new WriteBuffer(isBuffered(), &async);
|
m_writeBuffer = new WriteBuffer(isBuffered(), &async);
|
||||||
async.setConcurrentCallData(localWrite, m_filePath, m_writeData, m_writeBuffer);
|
async.setConcurrentCallData(localWrite, m_filePath, m_writeData, m_writeBuffer);
|
||||||
@@ -390,7 +390,7 @@ public:
|
|||||||
StreamResult m_streamResult = StreamResult::FinishedWithError;
|
StreamResult m_streamResult = StreamResult::FinishedWithError;
|
||||||
std::unique_ptr<TaskTree> m_taskTree;
|
std::unique_ptr<TaskTree> m_taskTree;
|
||||||
|
|
||||||
TaskItem task() {
|
GroupItem task() {
|
||||||
if (m_streamerMode == StreamMode::Reader)
|
if (m_streamerMode == StreamMode::Reader)
|
||||||
return readerTask();
|
return readerTask();
|
||||||
if (m_streamerMode == StreamMode::Writer)
|
if (m_streamerMode == StreamMode::Writer)
|
||||||
@@ -399,7 +399,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TaskItem readerTask() {
|
GroupItem readerTask() {
|
||||||
const auto setup = [this](FileStreamReader &reader) {
|
const auto setup = [this](FileStreamReader &reader) {
|
||||||
m_readBuffer.clear();
|
m_readBuffer.clear();
|
||||||
reader.setFilePath(m_source);
|
reader.setFilePath(m_source);
|
||||||
@@ -409,14 +409,14 @@ private:
|
|||||||
};
|
};
|
||||||
return FileStreamReaderTask(setup);
|
return FileStreamReaderTask(setup);
|
||||||
}
|
}
|
||||||
TaskItem writerTask() {
|
GroupItem writerTask() {
|
||||||
const auto setup = [this](FileStreamWriter &writer) {
|
const auto setup = [this](FileStreamWriter &writer) {
|
||||||
writer.setFilePath(m_destination);
|
writer.setFilePath(m_destination);
|
||||||
writer.setWriteData(m_writeBuffer);
|
writer.setWriteData(m_writeBuffer);
|
||||||
};
|
};
|
||||||
return FileStreamWriterTask(setup);
|
return FileStreamWriterTask(setup);
|
||||||
}
|
}
|
||||||
TaskItem transferTask() {
|
GroupItem transferTask() {
|
||||||
const auto setup = [this](Async<void> &async) {
|
const auto setup = [this](Async<void> &async) {
|
||||||
async.setConcurrentCallData(transfer, m_source, m_destination);
|
async.setConcurrentCallData(transfer, m_source, m_destination);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -360,7 +360,7 @@ void TestCodeParser::scanForTests(const QSet<FilePath> &filePaths,
|
|||||||
|
|
||||||
using namespace Tasking;
|
using namespace Tasking;
|
||||||
|
|
||||||
QList<TaskItem> tasks{parallelLimit(std::max(QThread::idealThreadCount() / 4, 1))};
|
QList<GroupItem> tasks{parallelLimit(std::max(QThread::idealThreadCount() / 4, 1))};
|
||||||
for (const FilePath &file : filteredFiles) {
|
for (const FilePath &file : filteredFiles) {
|
||||||
const auto setup = [this, codeParsers, file](Async<TestParseResultPtr> &async) {
|
const auto setup = [this, codeParsers, file](Async<TestParseResultPtr> &async) {
|
||||||
async.setConcurrentCallData(parseFileForTests, codeParsers, file);
|
async.setConcurrentCallData(parseFileForTests, codeParsers, file);
|
||||||
|
|||||||
@@ -347,7 +347,7 @@ void TestRunner::runTestsHelper()
|
|||||||
std::unique_ptr<TestOutputReader> m_outputReader;
|
std::unique_ptr<TestOutputReader> m_outputReader;
|
||||||
};
|
};
|
||||||
|
|
||||||
QList<TaskItem> tasks{finishAllAndDone};
|
QList<GroupItem> tasks{finishAllAndDone};
|
||||||
|
|
||||||
for (ITestConfiguration *config : m_selectedTests) {
|
for (ITestConfiguration *config : m_selectedTests) {
|
||||||
QTC_ASSERT(config, continue);
|
QTC_ASSERT(config, continue);
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ void ClangToolRunWorker::start()
|
|||||||
m_filesAnalyzed.clear();
|
m_filesAnalyzed.clear();
|
||||||
m_filesNotAnalyzed.clear();
|
m_filesNotAnalyzed.clear();
|
||||||
|
|
||||||
QList<TaskItem> tasks{parallelLimit(qMax(1, m_runSettings.parallelJobs()))};
|
QList<GroupItem> tasks{parallelLimit(qMax(1, m_runSettings.parallelJobs()))};
|
||||||
for (const AnalyzeUnit &unit : std::as_const(unitsToProcess)) {
|
for (const AnalyzeUnit &unit : std::as_const(unitsToProcess)) {
|
||||||
if (!m_diagnosticConfig.isEnabled(tool)
|
if (!m_diagnosticConfig.isEnabled(tool)
|
||||||
&& !m_runSettings.hasConfigFileForSourceFile(unit.file)) {
|
&& !m_runSettings.hasConfigFileForSourceFile(unit.file)) {
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ static FilePath createOutputFilePath(const FilePath &dirPath, const FilePath &fi
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskItem clangToolTask(const AnalyzeInputData &input,
|
GroupItem clangToolTask(const AnalyzeInputData &input,
|
||||||
const AnalyzeSetupHandler &setupHandler,
|
const AnalyzeSetupHandler &setupHandler,
|
||||||
const AnalyzeOutputHandler &outputHandler)
|
const AnalyzeOutputHandler &outputHandler)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#include <utils/environment.h>
|
#include <utils/environment.h>
|
||||||
|
|
||||||
namespace Tasking { class TaskItem; }
|
namespace Tasking { class GroupItem; }
|
||||||
|
|
||||||
namespace ClangTools {
|
namespace ClangTools {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -50,7 +50,7 @@ struct AnalyzeOutputData
|
|||||||
using AnalyzeSetupHandler = std::function<bool()>;
|
using AnalyzeSetupHandler = std::function<bool()>;
|
||||||
using AnalyzeOutputHandler = std::function<void(const AnalyzeOutputData &)>;
|
using AnalyzeOutputHandler = std::function<void(const AnalyzeOutputData &)>;
|
||||||
|
|
||||||
Tasking::TaskItem clangToolTask(const AnalyzeInputData &input,
|
Tasking::GroupItem clangToolTask(const AnalyzeInputData &input,
|
||||||
const AnalyzeSetupHandler &setupHandler,
|
const AnalyzeSetupHandler &setupHandler,
|
||||||
const AnalyzeOutputHandler &outputHandler);
|
const AnalyzeOutputHandler &outputHandler);
|
||||||
|
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ void DocumentClangToolRunner::run()
|
|||||||
vfso().update();
|
vfso().update();
|
||||||
const ClangDiagnosticConfig config = diagnosticConfig(runSettings.diagnosticConfigId());
|
const ClangDiagnosticConfig config = diagnosticConfig(runSettings.diagnosticConfigId());
|
||||||
const Environment env = projectBuildEnvironment(project);
|
const Environment env = projectBuildEnvironment(project);
|
||||||
QList<TaskItem> tasks{parallel};
|
QList<GroupItem> tasks{parallel};
|
||||||
const auto addClangTool = [this, &runSettings, &config, &env, &tasks](ClangToolType tool) {
|
const auto addClangTool = [this, &runSettings, &config, &env, &tasks](ClangToolType tool) {
|
||||||
if (!toolEnabled(tool, config, runSettings))
|
if (!toolEnabled(tool, config, runSettings))
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -450,7 +450,7 @@ void LocatorMatcher::start()
|
|||||||
collectorStorage->m_collector = nullptr;
|
collectorStorage->m_collector = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
QList<TaskItem> parallelTasks {parallelLimit(d->m_parallelLimit)};
|
QList<GroupItem> parallelTasks {parallelLimit(d->m_parallelLimit)};
|
||||||
|
|
||||||
const auto onSetup = [this, collectorStorage](const TreeStorage<LocatorStorage> &storage,
|
const auto onSetup = [this, collectorStorage](const TreeStorage<LocatorStorage> &storage,
|
||||||
int index) {
|
int index) {
|
||||||
@@ -597,7 +597,7 @@ QString ILocatorFilter::shortcutString() const
|
|||||||
\internal
|
\internal
|
||||||
Sets the refresh recipe for refreshing cached data.
|
Sets the refresh recipe for refreshing cached data.
|
||||||
*/
|
*/
|
||||||
void ILocatorFilter::setRefreshRecipe(const std::optional<TaskItem> &recipe)
|
void ILocatorFilter::setRefreshRecipe(const std::optional<GroupItem> &recipe)
|
||||||
{
|
{
|
||||||
m_refreshRecipe = recipe;
|
m_refreshRecipe = recipe;
|
||||||
}
|
}
|
||||||
@@ -606,7 +606,7 @@ void ILocatorFilter::setRefreshRecipe(const std::optional<TaskItem> &recipe)
|
|||||||
Returns the refresh recipe for refreshing cached data. By default, the locator filter has
|
Returns the refresh recipe for refreshing cached data. By default, the locator filter has
|
||||||
no recipe set, so that it won't be refreshed.
|
no recipe set, so that it won't be refreshed.
|
||||||
*/
|
*/
|
||||||
std::optional<TaskItem> ILocatorFilter::refreshRecipe() const
|
std::optional<GroupItem> ILocatorFilter::refreshRecipe() const
|
||||||
{
|
{
|
||||||
return m_refreshRecipe;
|
return m_refreshRecipe;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ class CORE_EXPORT LocatorMatcherTask final
|
|||||||
public:
|
public:
|
||||||
// The main task. Initial data (searchTerm) should be taken from storage.input().
|
// The main task. Initial data (searchTerm) should be taken from storage.input().
|
||||||
// Results reporting is done via the storage.reportOutput().
|
// Results reporting is done via the storage.reportOutput().
|
||||||
Tasking::TaskItem task = Tasking::Group{};
|
Tasking::GroupItem task = Tasking::Group{};
|
||||||
|
|
||||||
// When constructing the task, don't place the storage inside the task above.
|
// When constructing the task, don't place the storage inside the task above.
|
||||||
Tasking::TreeStorage<LocatorStorage> storage;
|
Tasking::TreeStorage<LocatorStorage> storage;
|
||||||
@@ -270,8 +270,8 @@ protected:
|
|||||||
virtual void saveState(QJsonObject &object) const;
|
virtual void saveState(QJsonObject &object) const;
|
||||||
virtual void restoreState(const QJsonObject &object);
|
virtual void restoreState(const QJsonObject &object);
|
||||||
|
|
||||||
void setRefreshRecipe(const std::optional<Tasking::TaskItem> &recipe);
|
void setRefreshRecipe(const std::optional<Tasking::GroupItem> &recipe);
|
||||||
std::optional<Tasking::TaskItem> refreshRecipe() const;
|
std::optional<Tasking::GroupItem> refreshRecipe() const;
|
||||||
|
|
||||||
static bool isOldSetting(const QByteArray &state);
|
static bool isOldSetting(const QByteArray &state);
|
||||||
|
|
||||||
@@ -289,7 +289,7 @@ private:
|
|||||||
QString m_description;
|
QString m_description;
|
||||||
QString m_defaultShortcut;
|
QString m_defaultShortcut;
|
||||||
std::optional<QString> m_defaultSearchText;
|
std::optional<QString> m_defaultSearchText;
|
||||||
std::optional<Tasking::TaskItem> m_refreshRecipe;
|
std::optional<Tasking::GroupItem> m_refreshRecipe;
|
||||||
QKeySequence m_defaultKeySequence;
|
QKeySequence m_defaultKeySequence;
|
||||||
bool m_defaultIncludedByDefault = false;
|
bool m_defaultIncludedByDefault = false;
|
||||||
bool m_includedByDefault = m_defaultIncludedByDefault;
|
bool m_includedByDefault = m_defaultIncludedByDefault;
|
||||||
|
|||||||
@@ -381,7 +381,7 @@ void Locator::refresh(const QList<ILocatorFilter *> &filters)
|
|||||||
m_refreshingFilters = Utils::filteredUnique(m_refreshingFilters + filters);
|
m_refreshingFilters = Utils::filteredUnique(m_refreshingFilters + filters);
|
||||||
|
|
||||||
using namespace Tasking;
|
using namespace Tasking;
|
||||||
QList<TaskItem> tasks{parallel};
|
QList<GroupItem> tasks{parallel};
|
||||||
for (ILocatorFilter *filter : std::as_const(m_refreshingFilters)) {
|
for (ILocatorFilter *filter : std::as_const(m_refreshingFilters)) {
|
||||||
const auto task = filter->refreshRecipe();
|
const auto task = filter->refreshRecipe();
|
||||||
if (!task.has_value())
|
if (!task.has_value())
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ void CppProjectUpdater::update(const ProjectUpdateInfo &projectUpdateInfo,
|
|||||||
if (async.isResultAvailable())
|
if (async.isResultAvailable())
|
||||||
storage->projectInfo = async.result();
|
storage->projectInfo = async.result();
|
||||||
};
|
};
|
||||||
QList<TaskItem> tasks{parallel};
|
QList<GroupItem> tasks{parallel};
|
||||||
tasks.append(AsyncTask<ProjectInfo::ConstPtr>(setupInfoGenerator, onInfoGeneratorDone));
|
tasks.append(AsyncTask<ProjectInfo::ConstPtr>(setupInfoGenerator, onInfoGeneratorDone));
|
||||||
for (QPointer<ExtraCompiler> compiler : compilers) {
|
for (QPointer<ExtraCompiler> compiler : compilers) {
|
||||||
if (compiler && compiler->isDirty())
|
if (compiler && compiler->isDirty())
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ DiffFilesController::DiffFilesController(IDocument *document)
|
|||||||
outputList->resize(inputList.size());
|
outputList->resize(inputList.size());
|
||||||
|
|
||||||
using namespace std::placeholders;
|
using namespace std::placeholders;
|
||||||
QList<TaskItem> tasks {parallel, finishAllAndDone};
|
QList<GroupItem> tasks {parallel, finishAllAndDone};
|
||||||
for (int i = 0; i < inputList.size(); ++i) {
|
for (int i = 0; i < inputList.size(); ++i) {
|
||||||
tasks.append(AsyncTask<FileData>(std::bind(setupDiff, _1, inputList.at(i)),
|
tasks.append(AsyncTask<FileData>(std::bind(setupDiff, _1, inputList.at(i)),
|
||||||
std::bind(onDiffDone, _1, i)));
|
std::bind(onDiffDone, _1, i)));
|
||||||
|
|||||||
@@ -441,7 +441,7 @@ ShowController::ShowController(IDocument *document, const QString &id)
|
|||||||
};
|
};
|
||||||
|
|
||||||
using namespace std::placeholders;
|
using namespace std::placeholders;
|
||||||
QList<TaskItem> tasks {parallel, continueOnDone, onGroupError(onFollowsError)};
|
QList<GroupItem> tasks {parallel, continueOnDone, onGroupError(onFollowsError)};
|
||||||
for (int i = 0, total = parents.size(); i < total; ++i) {
|
for (int i = 0, total = parents.size(); i < total; ++i) {
|
||||||
tasks.append(ProcessTask(std::bind(setupFollow, _1, parents.at(i)),
|
tasks.append(ProcessTask(std::bind(setupFollow, _1, parents.at(i)),
|
||||||
std::bind(onFollowDone, _1, i)));
|
std::bind(onFollowDone, _1, i)));
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ QThreadPool *ExtraCompiler::extraCompilerThreadPool()
|
|||||||
return s_extraCompilerThreadPool();
|
return s_extraCompilerThreadPool();
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskItem ExtraCompiler::compileFileItem()
|
GroupItem ExtraCompiler::compileFileItem()
|
||||||
{
|
{
|
||||||
return taskItemImpl(fromFileProvider());
|
return taskItemImpl(fromFileProvider());
|
||||||
}
|
}
|
||||||
@@ -326,7 +326,7 @@ ProcessExtraCompiler::ProcessExtraCompiler(const Project *project, const FilePat
|
|||||||
ExtraCompiler(project, source, targets, parent)
|
ExtraCompiler(project, source, targets, parent)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
TaskItem ProcessExtraCompiler::taskItemImpl(const ContentProvider &provider)
|
GroupItem ProcessExtraCompiler::taskItemImpl(const ContentProvider &provider)
|
||||||
{
|
{
|
||||||
const auto setupTask = [=](Async<FileNameToContentsHash> &async) {
|
const auto setupTask = [=](Async<FileNameToContentsHash> &async) {
|
||||||
async.setThreadPool(extraCompilerThreadPool());
|
async.setThreadPool(extraCompilerThreadPool());
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class QPromise;
|
|||||||
class QThreadPool;
|
class QThreadPool;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace Tasking { class TaskItem; }
|
namespace Tasking { class GroupItem; }
|
||||||
namespace Utils { class Process; }
|
namespace Utils { class Process; }
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
@@ -49,7 +49,7 @@ public:
|
|||||||
Utils::FilePaths targets() const;
|
Utils::FilePaths targets() const;
|
||||||
void forEachTarget(std::function<void(const Utils::FilePath &)> func) const;
|
void forEachTarget(std::function<void(const Utils::FilePath &)> func) const;
|
||||||
|
|
||||||
Tasking::TaskItem compileFileItem();
|
Tasking::GroupItem compileFileItem();
|
||||||
void compileFile();
|
void compileFile();
|
||||||
bool isDirty() const;
|
bool isDirty() const;
|
||||||
void block();
|
void block();
|
||||||
@@ -75,7 +75,7 @@ private:
|
|||||||
void compileContent(const QByteArray &content);
|
void compileContent(const QByteArray &content);
|
||||||
void compileImpl(const ContentProvider &provider);
|
void compileImpl(const ContentProvider &provider);
|
||||||
void compileIfDirty();
|
void compileIfDirty();
|
||||||
virtual Tasking::TaskItem taskItemImpl(const ContentProvider &provider) = 0;
|
virtual Tasking::GroupItem taskItemImpl(const ContentProvider &provider) = 0;
|
||||||
|
|
||||||
const std::unique_ptr<ExtraCompilerPrivate> d;
|
const std::unique_ptr<ExtraCompilerPrivate> d;
|
||||||
};
|
};
|
||||||
@@ -101,7 +101,7 @@ protected:
|
|||||||
virtual Tasks parseIssues(const QByteArray &stdErr);
|
virtual Tasks parseIssues(const QByteArray &stdErr);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Tasking::TaskItem taskItemImpl(const ContentProvider &provider) final;
|
Tasking::GroupItem taskItemImpl(const ContentProvider &provider) final;
|
||||||
void runInThread(QPromise<FileNameToContentsHash> &promise,
|
void runInThread(QPromise<FileNameToContentsHash> &promise,
|
||||||
const Utils::FilePath &cmd, const Utils::FilePath &workDir,
|
const Utils::FilePath &cmd, const Utils::FilePath &workDir,
|
||||||
const QStringList &args, const ContentProvider &provider,
|
const QStringList &args, const ContentProvider &provider,
|
||||||
|
|||||||
@@ -330,7 +330,7 @@ void QMakeStep::doRun()
|
|||||||
emit buildConfiguration()->buildDirectoryInitialized();
|
emit buildConfiguration()->buildDirectoryInitialized();
|
||||||
};
|
};
|
||||||
|
|
||||||
QList<TaskItem> processList = {ProcessTask(setupQMake, onProcessDone, onProcessError)};
|
QList<GroupItem> processList = {ProcessTask(setupQMake, onProcessDone, onProcessError)};
|
||||||
if (m_runMakeQmake)
|
if (m_runMakeQmake)
|
||||||
processList << ProcessTask(setupMakeQMake, onProcessDone, onProcessError);
|
processList << ProcessTask(setupMakeQMake, onProcessDone, onProcessError);
|
||||||
processList << onGroupDone(onDone);
|
processList << onGroupDone(onDone);
|
||||||
|
|||||||
@@ -90,11 +90,11 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Group deployRecipe();
|
Group deployRecipe();
|
||||||
TaskItem checkDirTask();
|
GroupItem checkDirTask();
|
||||||
TaskItem removeDirTask();
|
GroupItem removeDirTask();
|
||||||
TaskItem uploadTask();
|
GroupItem uploadTask();
|
||||||
TaskItem chmodTask(const DeployableFile &file);
|
GroupItem chmodTask(const DeployableFile &file);
|
||||||
TaskItem chmodTree();
|
GroupItem chmodTree();
|
||||||
|
|
||||||
enum class CheckResult { RemoveDir, SkipRemoveDir, Abort };
|
enum class CheckResult { RemoveDir, SkipRemoveDir, Abort };
|
||||||
CheckResult m_checkResult = CheckResult::Abort;
|
CheckResult m_checkResult = CheckResult::Abort;
|
||||||
@@ -117,7 +117,7 @@ QList<DeployableFile> collectFilesToUpload(const DeployableFile &deployable)
|
|||||||
return collected;
|
return collected;
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskItem QnxDeployQtLibrariesDialogPrivate::checkDirTask()
|
GroupItem QnxDeployQtLibrariesDialogPrivate::checkDirTask()
|
||||||
{
|
{
|
||||||
const auto setupHandler = [this](Process &process) {
|
const auto setupHandler = [this](Process &process) {
|
||||||
m_deployLogWindow->appendPlainText(Tr::tr("Checking existence of \"%1\"")
|
m_deployLogWindow->appendPlainText(Tr::tr("Checking existence of \"%1\"")
|
||||||
@@ -145,7 +145,7 @@ TaskItem QnxDeployQtLibrariesDialogPrivate::checkDirTask()
|
|||||||
return ProcessTask(setupHandler, doneHandler, errorHandler);
|
return ProcessTask(setupHandler, doneHandler, errorHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskItem QnxDeployQtLibrariesDialogPrivate::removeDirTask()
|
GroupItem QnxDeployQtLibrariesDialogPrivate::removeDirTask()
|
||||||
{
|
{
|
||||||
const auto setupHandler = [this](Process &process) {
|
const auto setupHandler = [this](Process &process) {
|
||||||
if (m_checkResult != CheckResult::RemoveDir)
|
if (m_checkResult != CheckResult::RemoveDir)
|
||||||
@@ -162,7 +162,7 @@ TaskItem QnxDeployQtLibrariesDialogPrivate::removeDirTask()
|
|||||||
return ProcessTask(setupHandler, {}, errorHandler);
|
return ProcessTask(setupHandler, {}, errorHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskItem QnxDeployQtLibrariesDialogPrivate::uploadTask()
|
GroupItem QnxDeployQtLibrariesDialogPrivate::uploadTask()
|
||||||
{
|
{
|
||||||
const auto setupHandler = [this](FileTransfer &transfer) {
|
const auto setupHandler = [this](FileTransfer &transfer) {
|
||||||
if (m_deployableFiles.isEmpty()) {
|
if (m_deployableFiles.isEmpty()) {
|
||||||
@@ -196,7 +196,7 @@ TaskItem QnxDeployQtLibrariesDialogPrivate::uploadTask()
|
|||||||
return FileTransferTask(setupHandler, {}, errorHandler);
|
return FileTransferTask(setupHandler, {}, errorHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskItem QnxDeployQtLibrariesDialogPrivate::chmodTask(const DeployableFile &file)
|
GroupItem QnxDeployQtLibrariesDialogPrivate::chmodTask(const DeployableFile &file)
|
||||||
{
|
{
|
||||||
const auto setupHandler = [=](Process &process) {
|
const auto setupHandler = [=](Process &process) {
|
||||||
process.setCommand({m_device->filePath("chmod"),
|
process.setCommand({m_device->filePath("chmod"),
|
||||||
@@ -215,7 +215,7 @@ TaskItem QnxDeployQtLibrariesDialogPrivate::chmodTask(const DeployableFile &file
|
|||||||
return ProcessTask(setupHandler, {}, errorHandler);
|
return ProcessTask(setupHandler, {}, errorHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskItem QnxDeployQtLibrariesDialogPrivate::chmodTree()
|
GroupItem QnxDeployQtLibrariesDialogPrivate::chmodTree()
|
||||||
{
|
{
|
||||||
const auto setupChmodHandler = [=](TaskTree &tree) {
|
const auto setupChmodHandler = [=](TaskTree &tree) {
|
||||||
QList<DeployableFile> filesToChmod;
|
QList<DeployableFile> filesToChmod;
|
||||||
@@ -223,7 +223,7 @@ TaskItem QnxDeployQtLibrariesDialogPrivate::chmodTree()
|
|||||||
if (file.isExecutable())
|
if (file.isExecutable())
|
||||||
filesToChmod << file;
|
filesToChmod << file;
|
||||||
}
|
}
|
||||||
QList<TaskItem> chmodList{finishAllAndDone, parallelLimit(MaxConcurrentStatCalls)};
|
QList<GroupItem> chmodList{finishAllAndDone, parallelLimit(MaxConcurrentStatCalls)};
|
||||||
for (const DeployableFile &file : std::as_const(filesToChmod)) {
|
for (const DeployableFile &file : std::as_const(filesToChmod)) {
|
||||||
QTC_ASSERT(file.isValid(), continue);
|
QTC_ASSERT(file.isValid(), continue);
|
||||||
chmodList.append(chmodTask(file));
|
chmodList.append(chmodTask(file));
|
||||||
|
|||||||
@@ -75,13 +75,13 @@ public:
|
|||||||
using FilesToStat = std::function<QList<DeployableFile>(UploadStorage *)>;
|
using FilesToStat = std::function<QList<DeployableFile>(UploadStorage *)>;
|
||||||
using StatEndHandler
|
using StatEndHandler
|
||||||
= std::function<void(UploadStorage *, const DeployableFile &, const QDateTime &)>;
|
= std::function<void(UploadStorage *, const DeployableFile &, const QDateTime &)>;
|
||||||
TaskItem statTask(UploadStorage *storage, const DeployableFile &file,
|
GroupItem statTask(UploadStorage *storage, const DeployableFile &file,
|
||||||
StatEndHandler statEndHandler);
|
StatEndHandler statEndHandler);
|
||||||
TaskItem statTree(const TreeStorage<UploadStorage> &storage, FilesToStat filesToStat,
|
GroupItem statTree(const TreeStorage<UploadStorage> &storage, FilesToStat filesToStat,
|
||||||
StatEndHandler statEndHandler);
|
StatEndHandler statEndHandler);
|
||||||
TaskItem uploadTask(const TreeStorage<UploadStorage> &storage);
|
GroupItem uploadTask(const TreeStorage<UploadStorage> &storage);
|
||||||
TaskItem chmodTask(const DeployableFile &file);
|
GroupItem chmodTask(const DeployableFile &file);
|
||||||
TaskItem chmodTree(const TreeStorage<UploadStorage> &storage);
|
GroupItem chmodTree(const TreeStorage<UploadStorage> &storage);
|
||||||
|
|
||||||
IncrementalDeployment m_incremental = IncrementalDeployment::NotSupported;
|
IncrementalDeployment m_incremental = IncrementalDeployment::NotSupported;
|
||||||
bool m_ignoreMissingFiles = false;
|
bool m_ignoreMissingFiles = false;
|
||||||
@@ -156,7 +156,7 @@ QDateTime GenericDirectUploadStep::timestampFromStat(const DeployableFile &file,
|
|||||||
return QDateTime::fromSecsSinceEpoch(secsSinceEpoch);
|
return QDateTime::fromSecsSinceEpoch(secsSinceEpoch);
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskItem GenericDirectUploadStep::statTask(UploadStorage *storage,
|
GroupItem GenericDirectUploadStep::statTask(UploadStorage *storage,
|
||||||
const DeployableFile &file,
|
const DeployableFile &file,
|
||||||
StatEndHandler statEndHandler)
|
StatEndHandler statEndHandler)
|
||||||
{
|
{
|
||||||
@@ -173,13 +173,13 @@ TaskItem GenericDirectUploadStep::statTask(UploadStorage *storage,
|
|||||||
return ProcessTask(setupHandler, endHandler, endHandler);
|
return ProcessTask(setupHandler, endHandler, endHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskItem GenericDirectUploadStep::statTree(const TreeStorage<UploadStorage> &storage,
|
GroupItem GenericDirectUploadStep::statTree(const TreeStorage<UploadStorage> &storage,
|
||||||
FilesToStat filesToStat, StatEndHandler statEndHandler)
|
FilesToStat filesToStat, StatEndHandler statEndHandler)
|
||||||
{
|
{
|
||||||
const auto setupHandler = [=](TaskTree &tree) {
|
const auto setupHandler = [=](TaskTree &tree) {
|
||||||
UploadStorage *storagePtr = storage.activeStorage();
|
UploadStorage *storagePtr = storage.activeStorage();
|
||||||
const QList<DeployableFile> files = filesToStat(storagePtr);
|
const QList<DeployableFile> files = filesToStat(storagePtr);
|
||||||
QList<TaskItem> statList{finishAllAndDone, parallelLimit(MaxConcurrentStatCalls)};
|
QList<GroupItem> statList{finishAllAndDone, parallelLimit(MaxConcurrentStatCalls)};
|
||||||
for (const DeployableFile &file : std::as_const(files)) {
|
for (const DeployableFile &file : std::as_const(files)) {
|
||||||
QTC_ASSERT(file.isValid(), continue);
|
QTC_ASSERT(file.isValid(), continue);
|
||||||
statList.append(statTask(storagePtr, file, statEndHandler));
|
statList.append(statTask(storagePtr, file, statEndHandler));
|
||||||
@@ -189,7 +189,7 @@ TaskItem GenericDirectUploadStep::statTree(const TreeStorage<UploadStorage> &sto
|
|||||||
return TaskTreeTask(setupHandler);
|
return TaskTreeTask(setupHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskItem GenericDirectUploadStep::uploadTask(const TreeStorage<UploadStorage> &storage)
|
GroupItem GenericDirectUploadStep::uploadTask(const TreeStorage<UploadStorage> &storage)
|
||||||
{
|
{
|
||||||
const auto setupHandler = [this, storage](FileTransfer &transfer) {
|
const auto setupHandler = [this, storage](FileTransfer &transfer) {
|
||||||
if (storage->filesToUpload.isEmpty()) {
|
if (storage->filesToUpload.isEmpty()) {
|
||||||
@@ -229,7 +229,7 @@ TaskItem GenericDirectUploadStep::uploadTask(const TreeStorage<UploadStorage> &s
|
|||||||
return FileTransferTask(setupHandler, {}, errorHandler);
|
return FileTransferTask(setupHandler, {}, errorHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskItem GenericDirectUploadStep::chmodTask(const DeployableFile &file)
|
GroupItem GenericDirectUploadStep::chmodTask(const DeployableFile &file)
|
||||||
{
|
{
|
||||||
const auto setupHandler = [=](Process &process) {
|
const auto setupHandler = [=](Process &process) {
|
||||||
process.setCommand({deviceConfiguration()->filePath("chmod"),
|
process.setCommand({deviceConfiguration()->filePath("chmod"),
|
||||||
@@ -248,7 +248,7 @@ TaskItem GenericDirectUploadStep::chmodTask(const DeployableFile &file)
|
|||||||
return ProcessTask(setupHandler, {}, errorHandler);
|
return ProcessTask(setupHandler, {}, errorHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskItem GenericDirectUploadStep::chmodTree(const TreeStorage<UploadStorage> &storage)
|
GroupItem GenericDirectUploadStep::chmodTree(const TreeStorage<UploadStorage> &storage)
|
||||||
{
|
{
|
||||||
const auto setupChmodHandler = [=](TaskTree &tree) {
|
const auto setupChmodHandler = [=](TaskTree &tree) {
|
||||||
QList<DeployableFile> filesToChmod;
|
QList<DeployableFile> filesToChmod;
|
||||||
@@ -256,7 +256,7 @@ TaskItem GenericDirectUploadStep::chmodTree(const TreeStorage<UploadStorage> &st
|
|||||||
if (file.isExecutable())
|
if (file.isExecutable())
|
||||||
filesToChmod << file;
|
filesToChmod << file;
|
||||||
}
|
}
|
||||||
QList<TaskItem> chmodList{finishAllAndDone, parallelLimit(MaxConcurrentStatCalls)};
|
QList<GroupItem> chmodList{finishAllAndDone, parallelLimit(MaxConcurrentStatCalls)};
|
||||||
for (const DeployableFile &file : std::as_const(filesToChmod)) {
|
for (const DeployableFile &file : std::as_const(filesToChmod)) {
|
||||||
QTC_ASSERT(file.isValid(), continue);
|
QTC_ASSERT(file.isValid(), continue);
|
||||||
chmodList.append(chmodTask(file));
|
chmodList.append(chmodTask(file));
|
||||||
|
|||||||
@@ -34,20 +34,20 @@ public:
|
|||||||
|
|
||||||
QStringList commandsToTest() const;
|
QStringList commandsToTest() const;
|
||||||
|
|
||||||
TaskItem echoTask(const QString &contents) const;
|
GroupItem echoTask(const QString &contents) const;
|
||||||
TaskItem unameTask() const;
|
GroupItem unameTask() const;
|
||||||
TaskItem gathererTask() const;
|
GroupItem gathererTask() const;
|
||||||
TaskItem transferTask(FileTransferMethod method,
|
GroupItem transferTask(FileTransferMethod method,
|
||||||
const TreeStorage<TransferStorage> &storage) const;
|
const TreeStorage<TransferStorage> &storage) const;
|
||||||
TaskItem transferTasks() const;
|
GroupItem transferTasks() const;
|
||||||
TaskItem commandTask(const QString &commandName) const;
|
GroupItem commandTask(const QString &commandName) const;
|
||||||
TaskItem commandTasks() const;
|
GroupItem commandTasks() const;
|
||||||
|
|
||||||
GenericLinuxDeviceTester *q = nullptr;
|
GenericLinuxDeviceTester *q = nullptr;
|
||||||
IDevice::Ptr m_device;
|
IDevice::Ptr m_device;
|
||||||
std::unique_ptr<TaskTree> m_taskTree;
|
std::unique_ptr<TaskTree> m_taskTree;
|
||||||
QStringList m_extraCommands;
|
QStringList m_extraCommands;
|
||||||
QList<TaskItem> m_extraTests;
|
QList<GroupItem> m_extraTests;
|
||||||
};
|
};
|
||||||
|
|
||||||
QStringList GenericLinuxDeviceTesterPrivate::commandsToTest() const
|
QStringList GenericLinuxDeviceTesterPrivate::commandsToTest() const
|
||||||
@@ -90,7 +90,7 @@ QStringList GenericLinuxDeviceTesterPrivate::commandsToTest() const
|
|||||||
return commands;
|
return commands;
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskItem GenericLinuxDeviceTesterPrivate::echoTask(const QString &contents) const
|
GroupItem GenericLinuxDeviceTesterPrivate::echoTask(const QString &contents) const
|
||||||
{
|
{
|
||||||
const auto setup = [this, contents](Process &process) {
|
const auto setup = [this, contents](Process &process) {
|
||||||
emit q->progressMessage(Tr::tr("Sending echo to device..."));
|
emit q->progressMessage(Tr::tr("Sending echo to device..."));
|
||||||
@@ -114,7 +114,7 @@ TaskItem GenericLinuxDeviceTesterPrivate::echoTask(const QString &contents) cons
|
|||||||
return ProcessTask(setup, done, error);
|
return ProcessTask(setup, done, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskItem GenericLinuxDeviceTesterPrivate::unameTask() const
|
GroupItem GenericLinuxDeviceTesterPrivate::unameTask() const
|
||||||
{
|
{
|
||||||
const auto setup = [this](Process &process) {
|
const auto setup = [this](Process &process) {
|
||||||
emit q->progressMessage(Tr::tr("Checking kernel version..."));
|
emit q->progressMessage(Tr::tr("Checking kernel version..."));
|
||||||
@@ -136,7 +136,7 @@ TaskItem GenericLinuxDeviceTesterPrivate::unameTask() const
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskItem GenericLinuxDeviceTesterPrivate::gathererTask() const
|
GroupItem GenericLinuxDeviceTesterPrivate::gathererTask() const
|
||||||
{
|
{
|
||||||
const auto setup = [this](DeviceUsedPortsGatherer &gatherer) {
|
const auto setup = [this](DeviceUsedPortsGatherer &gatherer) {
|
||||||
emit q->progressMessage(Tr::tr("Checking if specified ports are available..."));
|
emit q->progressMessage(Tr::tr("Checking if specified ports are available..."));
|
||||||
@@ -164,7 +164,7 @@ TaskItem GenericLinuxDeviceTesterPrivate::gathererTask() const
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskItem GenericLinuxDeviceTesterPrivate::transferTask(FileTransferMethod method,
|
GroupItem GenericLinuxDeviceTesterPrivate::transferTask(FileTransferMethod method,
|
||||||
const TreeStorage<TransferStorage> &storage) const
|
const TreeStorage<TransferStorage> &storage) const
|
||||||
{
|
{
|
||||||
const auto setup = [this, method](FileTransfer &transfer) {
|
const auto setup = [this, method](FileTransfer &transfer) {
|
||||||
@@ -216,7 +216,7 @@ TaskItem GenericLinuxDeviceTesterPrivate::transferTask(FileTransferMethod method
|
|||||||
return FileTransferTestTask(setup, done, error);
|
return FileTransferTestTask(setup, done, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskItem GenericLinuxDeviceTesterPrivate::transferTasks() const
|
GroupItem GenericLinuxDeviceTesterPrivate::transferTasks() const
|
||||||
{
|
{
|
||||||
TreeStorage<TransferStorage> storage;
|
TreeStorage<TransferStorage> storage;
|
||||||
return Group {
|
return Group {
|
||||||
@@ -231,7 +231,7 @@ TaskItem GenericLinuxDeviceTesterPrivate::transferTasks() const
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskItem GenericLinuxDeviceTesterPrivate::commandTask(const QString &commandName) const
|
GroupItem GenericLinuxDeviceTesterPrivate::commandTask(const QString &commandName) const
|
||||||
{
|
{
|
||||||
const auto setup = [this, commandName](Process &process) {
|
const auto setup = [this, commandName](Process &process) {
|
||||||
emit q->progressMessage(Tr::tr("%1...").arg(commandName));
|
emit q->progressMessage(Tr::tr("%1...").arg(commandName));
|
||||||
@@ -252,9 +252,9 @@ TaskItem GenericLinuxDeviceTesterPrivate::commandTask(const QString &commandName
|
|||||||
return ProcessTask(setup, done, error);
|
return ProcessTask(setup, done, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskItem GenericLinuxDeviceTesterPrivate::commandTasks() const
|
GroupItem GenericLinuxDeviceTesterPrivate::commandTasks() const
|
||||||
{
|
{
|
||||||
QList<TaskItem> tasks {continueOnError};
|
QList<GroupItem> tasks {continueOnError};
|
||||||
tasks.append(onGroupSetup([this] {
|
tasks.append(onGroupSetup([this] {
|
||||||
emit q->progressMessage(Tr::tr("Checking if required commands are available..."));
|
emit q->progressMessage(Tr::tr("Checking if required commands are available..."));
|
||||||
}));
|
}));
|
||||||
@@ -279,7 +279,7 @@ void GenericLinuxDeviceTester::setExtraCommandsToTest(const QStringList &extraCo
|
|||||||
d->m_extraCommands = extraCommands;
|
d->m_extraCommands = extraCommands;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenericLinuxDeviceTester::setExtraTests(const QList<TaskItem> &extraTests)
|
void GenericLinuxDeviceTester::setExtraTests(const QList<GroupItem> &extraTests)
|
||||||
{
|
{
|
||||||
d->m_extraTests = extraTests;
|
d->m_extraTests = extraTests;
|
||||||
}
|
}
|
||||||
@@ -295,7 +295,7 @@ void GenericLinuxDeviceTester::testDevice(const IDevice::Ptr &deviceConfiguratio
|
|||||||
d->m_taskTree.release()->deleteLater();
|
d->m_taskTree.release()->deleteLater();
|
||||||
};
|
};
|
||||||
|
|
||||||
QList<TaskItem> taskItems = {
|
QList<GroupItem> taskItems = {
|
||||||
d->echoTask("Hello"), // No quoting necessary
|
d->echoTask("Hello"), // No quoting necessary
|
||||||
d->echoTask("Hello Remote World!"), // Checks quoting, too.
|
d->echoTask("Hello Remote World!"), // Checks quoting, too.
|
||||||
d->unameTask(),
|
d->unameTask(),
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#include <projectexplorer/devicesupport/idevice.h>
|
#include <projectexplorer/devicesupport/idevice.h>
|
||||||
|
|
||||||
namespace Tasking { class TaskItem; }
|
namespace Tasking { class GroupItem; }
|
||||||
|
|
||||||
namespace RemoteLinux {
|
namespace RemoteLinux {
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ public:
|
|||||||
~GenericLinuxDeviceTester() override;
|
~GenericLinuxDeviceTester() override;
|
||||||
|
|
||||||
void setExtraCommandsToTest(const QStringList &extraCommands);
|
void setExtraCommandsToTest(const QStringList &extraCommands);
|
||||||
void setExtraTests(const QList<Tasking::TaskItem> &extraTests);
|
void setExtraTests(const QList<Tasking::GroupItem> &extraTests);
|
||||||
void testDevice(const ProjectExplorer::IDevice::Ptr &deviceConfiguration) override;
|
void testDevice(const ProjectExplorer::IDevice::Ptr &deviceConfiguration) override;
|
||||||
void stopTest() override;
|
void stopTest() override;
|
||||||
|
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ public:
|
|||||||
private:
|
private:
|
||||||
bool isDeploymentNecessary() const final;
|
bool isDeploymentNecessary() const final;
|
||||||
Group deployRecipe() final;
|
Group deployRecipe() final;
|
||||||
TaskItem mkdirTask();
|
GroupItem mkdirTask();
|
||||||
TaskItem transferTask();
|
GroupItem transferTask();
|
||||||
|
|
||||||
mutable FilesToTransfer m_files;
|
mutable FilesToTransfer m_files;
|
||||||
bool m_ignoreMissingFiles = false;
|
bool m_ignoreMissingFiles = false;
|
||||||
@@ -85,7 +85,7 @@ bool RsyncDeployStep::isDeploymentNecessary() const
|
|||||||
return !m_files.empty();
|
return !m_files.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskItem RsyncDeployStep::mkdirTask()
|
GroupItem RsyncDeployStep::mkdirTask()
|
||||||
{
|
{
|
||||||
const auto setupHandler = [this](Process &process) {
|
const auto setupHandler = [this](Process &process) {
|
||||||
QStringList remoteDirs;
|
QStringList remoteDirs;
|
||||||
@@ -113,7 +113,7 @@ TaskItem RsyncDeployStep::mkdirTask()
|
|||||||
return ProcessTask(setupHandler, {}, errorHandler);
|
return ProcessTask(setupHandler, {}, errorHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskItem RsyncDeployStep::transferTask()
|
GroupItem RsyncDeployStep::transferTask()
|
||||||
{
|
{
|
||||||
const auto setupHandler = [this](FileTransfer &transfer) {
|
const auto setupHandler = [this](FileTransfer &transfer) {
|
||||||
transfer.setTransferMethod(FileTransferMethod::Rsync);
|
transfer.setTransferMethod(FileTransferMethod::Rsync);
|
||||||
|
|||||||
@@ -55,8 +55,8 @@ private:
|
|||||||
QString remoteFilePath() const;
|
QString remoteFilePath() const;
|
||||||
bool isDeploymentNecessary() const final;
|
bool isDeploymentNecessary() const final;
|
||||||
Group deployRecipe() final;
|
Group deployRecipe() final;
|
||||||
TaskItem uploadTask();
|
GroupItem uploadTask();
|
||||||
TaskItem installTask();
|
GroupItem installTask();
|
||||||
|
|
||||||
FilePath m_packageFilePath;
|
FilePath m_packageFilePath;
|
||||||
};
|
};
|
||||||
@@ -71,7 +71,7 @@ bool TarPackageDeployStep::isDeploymentNecessary() const
|
|||||||
return hasLocalFileChanged(DeployableFile(m_packageFilePath, {}));
|
return hasLocalFileChanged(DeployableFile(m_packageFilePath, {}));
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskItem TarPackageDeployStep::uploadTask()
|
GroupItem TarPackageDeployStep::uploadTask()
|
||||||
{
|
{
|
||||||
const auto setupHandler = [this](FileTransfer &transfer) {
|
const auto setupHandler = [this](FileTransfer &transfer) {
|
||||||
const FilesToTransfer files {{m_packageFilePath,
|
const FilesToTransfer files {{m_packageFilePath,
|
||||||
@@ -90,7 +90,7 @@ TaskItem TarPackageDeployStep::uploadTask()
|
|||||||
return FileTransferTask(setupHandler, doneHandler, errorHandler);
|
return FileTransferTask(setupHandler, doneHandler, errorHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskItem TarPackageDeployStep::installTask()
|
GroupItem TarPackageDeployStep::installTask()
|
||||||
{
|
{
|
||||||
const auto setupHandler = [this](Process &process) {
|
const auto setupHandler = [this](Process &process) {
|
||||||
const QString cmdLine = QLatin1String("cd / && tar xvf ") + remoteFilePath()
|
const QString cmdLine = QLatin1String("cd / && tar xvf ") + remoteFilePath()
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ void UpdateInfoPlugin::startCheckForUpdates()
|
|||||||
d->m_updateOutput = process.cleanedStdOut();
|
d->m_updateOutput = process.cleanedStdOut();
|
||||||
};
|
};
|
||||||
|
|
||||||
QList<TaskItem> tasks { ProcessTask(setupUpdate, updateDone) };
|
QList<GroupItem> tasks { ProcessTask(setupUpdate, updateDone) };
|
||||||
if (d->m_settings.checkForQtVersions) {
|
if (d->m_settings.checkForQtVersions) {
|
||||||
const auto setupPackages = [doSetup](Process &process) {
|
const auto setupPackages = [doSetup](Process &process) {
|
||||||
doSetup(process, {"se", "qt[.]qt[0-9][.][0-9]+$", "-g", "*=false,ifw.package.*=true"});
|
doSetup(process, {"se", "qt[.]qt[0-9][.][0-9]+$", "-g", "*=false,ifw.package.*=true"});
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ TreeStorage<QString> VcsBaseDiffEditorController::inputStorage() const
|
|||||||
return d->m_inputStorage;
|
return d->m_inputStorage;
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskItem VcsBaseDiffEditorController::postProcessTask()
|
GroupItem VcsBaseDiffEditorController::postProcessTask()
|
||||||
{
|
{
|
||||||
const auto setupDiffProcessor = [this](Async<QList<FileData>> &async) {
|
const auto setupDiffProcessor = [this](Async<QList<FileData>> &async) {
|
||||||
const QString *storage = inputStorage().activeStorage();
|
const QString *storage = inputStorage().activeStorage();
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
Tasking::TreeStorage<QString> inputStorage() const;
|
Tasking::TreeStorage<QString> inputStorage() const;
|
||||||
Tasking::TaskItem postProcessTask();
|
Tasking::GroupItem postProcessTask();
|
||||||
|
|
||||||
void setupCommand(Utils::Process &process, const QStringList &args) const;
|
void setupCommand(Utils::Process &process, const QStringList &args) const;
|
||||||
|
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ public:
|
|||||||
TASKING_DECLARE_TASK(TickAndDoneTask, TickAndDoneTaskAdapter);
|
TASKING_DECLARE_TASK(TickAndDoneTask, TickAndDoneTaskAdapter);
|
||||||
|
|
||||||
template <typename SharedBarrierType>
|
template <typename SharedBarrierType>
|
||||||
TaskItem createBarrierAdvance(const TreeStorage<CustomStorage> &storage,
|
GroupItem createBarrierAdvance(const TreeStorage<CustomStorage> &storage,
|
||||||
const SharedBarrierType &barrier, int taskId)
|
const SharedBarrierType &barrier, int taskId)
|
||||||
{
|
{
|
||||||
return TickAndDoneTask([storage, barrier, taskId](TickAndDone &tickAndDone) {
|
return TickAndDoneTask([storage, barrier, taskId](TickAndDone &tickAndDone) {
|
||||||
@@ -253,7 +253,7 @@ void tst_Tasking::testTree_data()
|
|||||||
};
|
};
|
||||||
|
|
||||||
const auto createTask = [storage, setupTask, setupDone, setupError](
|
const auto createTask = [storage, setupTask, setupDone, setupError](
|
||||||
int taskId, bool successTask, milliseconds timeout = 0ms) -> TaskItem {
|
int taskId, bool successTask, milliseconds timeout = 0ms) -> GroupItem {
|
||||||
if (successTask)
|
if (successTask)
|
||||||
return TestTask(setupTask(taskId, timeout), setupDone(taskId), setupError(taskId));
|
return TestTask(setupTask(taskId, timeout), setupDone(taskId), setupError(taskId));
|
||||||
const Group root {
|
const Group root {
|
||||||
|
|||||||
@@ -500,7 +500,7 @@ void tst_Async::mapReduce_data()
|
|||||||
using SetupHandler = std::function<void(Async<int> &task, int input)>;
|
using SetupHandler = std::function<void(Async<int> &task, int input)>;
|
||||||
using DoneHandler = std::function<void()>;
|
using DoneHandler = std::function<void()>;
|
||||||
|
|
||||||
const auto createTask = [=](const TaskItem &executeMode,
|
const auto createTask = [=](const GroupItem &executeMode,
|
||||||
const SetupHandler &setupHandler,
|
const SetupHandler &setupHandler,
|
||||||
const DoneHandler &doneHandler) {
|
const DoneHandler &doneHandler) {
|
||||||
return Group {
|
return Group {
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ private slots:
|
|||||||
async.setConcurrentCallData(generate, parentPath, templateFile, s_treeDepth);
|
async.setConcurrentCallData(generate, parentPath, templateFile, s_treeDepth);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
QList<TaskItem> tasks {parallel};
|
QList<GroupItem> tasks {parallel};
|
||||||
for (int i = 0; i < tasksCount; ++i) {
|
for (int i = 0; i < tasksCount; ++i) {
|
||||||
const QString dirName = QString("%1%2").arg(s_dirPrefix).arg(i);
|
const QString dirName = QString("%1%2").arg(s_dirPrefix).arg(i);
|
||||||
QVERIFY(parentDir.mkdir(dirName));
|
QVERIFY(parentDir.mkdir(dirName));
|
||||||
@@ -153,7 +153,7 @@ private slots:
|
|||||||
async.setConcurrentCallData(removeTree, parentPath);
|
async.setConcurrentCallData(removeTree, parentPath);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
QList<TaskItem> tasks {parallel};
|
QList<GroupItem> tasks {parallel};
|
||||||
const int tasksCount = QThread::idealThreadCount();
|
const int tasksCount = QThread::idealThreadCount();
|
||||||
for (int i = 0; i < tasksCount; ++i) {
|
for (int i = 0; i < tasksCount; ++i) {
|
||||||
const QString dirName = QString("%1%2").arg(s_dirPrefix).arg(i);
|
const QString dirName = QString("%1%2").arg(s_dirPrefix).arg(i);
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
std::unique_ptr<TaskTree> taskTree;
|
std::unique_ptr<TaskTree> taskTree;
|
||||||
|
|
||||||
const auto createTask = [](TaskWidget *widget) -> TaskItem {
|
const auto createTask = [](TaskWidget *widget) -> GroupItem {
|
||||||
const auto setupTask = [](TaskWidget *widget) {
|
const auto setupTask = [](TaskWidget *widget) {
|
||||||
return [widget](milliseconds &taskObject) {
|
return [widget](milliseconds &taskObject) {
|
||||||
taskObject = milliseconds{widget->busyTime() * 1000};
|
taskObject = milliseconds{widget->busyTime() * 1000};
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ void GroupWidget::updateExecuteMode()
|
|||||||
m_executeCombo->setCurrentIndex(m_executeCombo->findData((int)m_executeMode));
|
m_executeCombo->setCurrentIndex(m_executeCombo->findData((int)m_executeMode));
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskItem GroupWidget::executeMode() const
|
GroupItem GroupWidget::executeMode() const
|
||||||
{
|
{
|
||||||
return m_executeMode == ExecuteMode::Sequential ? sequential : parallel;
|
return m_executeMode == ExecuteMode::Sequential ? sequential : parallel;
|
||||||
}
|
}
|
||||||
@@ -174,7 +174,7 @@ void GroupWidget::updateWorkflowPolicy()
|
|||||||
m_workflowCombo->setCurrentIndex(m_workflowCombo->findData((int)m_workflowPolicy));
|
m_workflowCombo->setCurrentIndex(m_workflowCombo->findData((int)m_workflowPolicy));
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskItem GroupWidget::workflowPolicy() const
|
GroupItem GroupWidget::workflowPolicy() const
|
||||||
{
|
{
|
||||||
return Tasking::workflowPolicy(m_workflowPolicy);
|
return Tasking::workflowPolicy(m_workflowPolicy);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,10 +62,10 @@ public:
|
|||||||
GroupWidget();
|
GroupWidget();
|
||||||
|
|
||||||
void setExecuteMode(ExecuteMode mode);
|
void setExecuteMode(ExecuteMode mode);
|
||||||
Tasking::TaskItem executeMode() const;
|
Tasking::GroupItem executeMode() const;
|
||||||
|
|
||||||
void setWorkflowPolicy(Tasking::WorkflowPolicy policy);
|
void setWorkflowPolicy(Tasking::WorkflowPolicy policy);
|
||||||
Tasking::TaskItem workflowPolicy() const;
|
Tasking::GroupItem workflowPolicy() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateExecuteMode();
|
void updateExecuteMode();
|
||||||
|
|||||||
Reference in New Issue
Block a user