Commit Graph

26 Commits

Author SHA1 Message Date
Jarek Kobus
5bcb24cb71 TaskTree: Fix continuation when synchronous stop appeared
It may potentially crash when continuation unwinds on
synchronous stop. It's a similar fix to
567216bb49, this time it
fixes the continuation when not directly coming from
TaskTree::start().

The follow up commit adds a test for crashing case.

Change-Id: Idd936e42b567ff4bddab717267c62f0104bf3b62
Reviewed-by: hjk <hjk@qt.io>
2023-01-27 14:15:20 +00:00
Jarek Kobus
bd9f4c3b8f TaskTree: Init with member initializer list
Make more members const for clarity.

Change-Id: Ie2f5451fc578a88b473231348465d40aece6a634
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2023-01-25 16:01:13 +00:00
Jarek Kobus
8e35048782 TaskTree: Remove TaskNode's start guard
Simplify internals a bit. Inline some simple getters.

Change-Id: I5f9ad63383acad9a16dd5f41f48b028abd9650a8
Reviewed-by: hjk <hjk@qt.io>
2023-01-25 16:00:07 +00:00
Jarek Kobus
567216bb49 TaskTree: Fix continuation of group with parallel limit
Change-Id: I10c40d06c21a0446187b8227b526ee903c569307
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-01-24 13:15:54 +00:00
Jarek Kobus
817553f3e5 TaskTree: Merge DynamicSetup with OnGroupSetup
Don't define 2 separate group setup items. Make OnGroupSetup
be able to handle also dynamic setup - like it's done with
CustomTask's setup handler.

Change-Id: I43e135f268ea96419b44ef5a4325707a124b4921
Reviewed-by: hjk <hjk@qt.io>
2023-01-23 08:07:36 +00:00
Jarek Kobus
ec28990dd5 TaskTree: Clear old storages on root setup
Change-Id: Ic32dedb1f427b238427df675e9c882c15d359da4
Reviewed-by: hjk <hjk@qt.io>
2023-01-20 14:19:01 +00:00
Jarek Kobus
98ff1d32f9 TaskTree: Remove GroupConfig / GroupAction
Use TaskAction for dynamic group setup. Get rid of possibility
of selecting group's children to be started inside group setup.
Use dynamic children's setup instead, so that each individual child
may decide itself whether it wants to be started or not.

Change-Id: Ie31f707791db0dc26be92663ca6238b8e49c3b98
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-01-20 14:18:56 +00:00
Jarek Kobus
6269c2cec8 TaskTree: Unwind execution properly on synchronous done
When task or group setup handler finishes synchronously
we may end up with mismatched execution order or may
grow call stack considerably. The fix is to detect
synchronous finishes and leave handling to the synchronous
caller.

Change-Id: Id72cf8cc98e2f53ff601a5e5226cd203a8470aaf
Reviewed-by: hjk <hjk@qt.io>
2023-01-20 09:20:03 +00:00
Jarek Kobus
e6ca18e194 TaskTree: Implement dynamic setup for tasks
Before it was possible to dynamically setup groups only.
This functionalily is probably good enough to replace
Group's DynamicSetup, as it seems much more convenient.

Change-Id: I56080f0ffa844847ca955cf52ccb07f3b4e4c731
Reviewed-by: hjk <hjk@qt.io>
2023-01-20 09:19:49 +00:00
Jarek Kobus
b6208ab34a TaskTree: Introduce ParallelLimit
The parallel limit constrains the number of parallel tasks
run in the same time. So, if e.g. a group contains 10 children
and the parallel limit is 6, only first 6 tasks are being started
on the beginning and the rest 4 are being postponed until some
running tasks are finished. So, when the one of 6 running tasks
finishes the group starts the 7th task and so on.

Setting parallel limit to 1 means sequential invocation in fact.

The value of 0 means there is no limit and all tasks are run at once.

Remove the ExecuteMode enum, as this is modelled now by the
parallelLimit.

Change-Id: Ice59318be0915401f05bb5a5804078bdc591d09f
Reviewed-by: hjk <hjk@qt.io>
2023-01-06 15:28:19 +00:00
Kai Köhne
56baf8c058 Remove GPL-3.0+ from license identifiers
Since we also license under GPL-3.0 WITH Qt-GPL-exception-1.0,
this applies only to a hypothetical newer version of GPL, that doesn't
exist yet. If such a version emerges, we can still decide to relicense...

While at it, replace (deprecated) GPL-3.0 with more explicit GPL-3.0-only

Change was done by running

  find . -type f -exec perl -pi -e "s/LicenseRef-Qt-Commercial OR GPL-3.0\+ OR GPL-3.0 WITH Qt-GPL-exception-1.0/LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0/g" {} \;

Change-Id: I5097e6ce8d10233993ee30d7e25120e2659eb10b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-01-06 11:15:13 +00:00
hjk
1f4b6837ba Utils: Make TreeStorageBase related qHash and comparison hidden friends
Also, inline the hashing.

Change-Id: I75859ad5481ab673d6c6f233c6fe67a96f9cda45
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2023-01-06 09:57:01 +00:00
Jarek Kobus
7fc9933969 TaskTree: Add a possibility to setup storage handlers
Storage handlers make it possible to pass initial data
into task tree and make it possible to retrieve the output
data from task tree after the task tree finished.

Change-Id: I0bcc12f5e552f55c1d5d89b81521ae9cb7b8b124
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-12-09 11:47:52 +00:00
Jarek Kobus
dfdeb4d630 TaskTree: Ensure the same storage isn't added twice
Change-Id: I780d61091fea39a4542b4f743593b5062a784ba5
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-12-09 11:45:26 +00:00
Jarek Kobus
8aa7ec1072 TaskTree: Add hash function for TreeStorageBase
Change-Id: Ia9242e3ca90ab13ee93fa42ebf86d03cc04fb669
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-12-09 11:44:22 +00:00
Jarek Kobus
1dbf3ad120 TaskTree: Fix some clazy warnings
Change-Id: Ibd0931d1298489345f4055b43610f3a0747e05bc
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2022-11-30 09:11:42 +00:00
Jarek Kobus
dfd06ec175 TaskTree: Fix destruction of running task tree
Delete all storages that were created before.

Change-Id: I8cbeb571424086b77fa7b19611c5b3f6cc1f4db1
Reviewed-by: hjk <hjk@qt.io>
2022-11-23 12:59:29 +00:00
Jarek Kobus
3468cd20ca TaskTree: Introduce Storage item
The Storage item makes it possible to define the whole
subtree as a self-contained, full-functional recipe, without a need
for passing (together with recipe) a one-use only (disposable)
pointer to storage object.

That's the last closing element of making the idea of pure,
value-based recipe real. It makes the TaskTree machinery ultimately
powerful.

Change-Id: Icd81bdd3e94251e8b241b2b550957d566fa4ab75
Reviewed-by: hjk <hjk@qt.io>
2022-11-23 12:59:18 +00:00
Jarek Kobus
1667b06236 TaskTree: Introduce TreeStorage class
TreeStorage enables delayed creation of instances of
StorageStruct. It encapsutates recipe on how create / delete
instance of StorageStruct. It doesn't create any instance
of StorageStruct when TreeStorage is created. These instances
will be created later, by TaskTree.

It will enable getting StorageStruct instance inside task / group
handlers (passed by lambda argument).

Change-Id: Id707353f196aa5ba3e7876d6c601e04ca08d6e63
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-11-23 12:58:57 +00:00
Jarek Kobus
4e4176a3d3 TaskTree: Add task tree adapter for task tree
Now it's possible to nest TaskTrees. A nested TaskTree
is seen as one, singular task inside parent tree.

Change-Id: Iad95de39c7b79580e0b589c222594de91d5b51a1
Reviewed-by: hjk <hjk@qt.io>
2022-11-18 15:31:03 +00:00
Jarek Kobus
0a2213d359 TaskTree: Add default c'tor and setupRoot() method
Make it possible to setup root later, after TaskTree
was already constructed.

Change-Id: I59e8e6a12102f9b8ed0f40357ab12e47d67572c2
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-11-17 15:08:11 +00:00
Jarek Kobus
7ab95906b9 TaskItem: Move enums outside of TaskItem
Change-Id: If8a2b285bf9d9bd5a5b7222c13772c1a873daf23
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-11-17 15:07:59 +00:00
Jarek Kobus
a4b7e10861 TaskTree: Implement simple progress reporting
The progressMaximum is the number of tasks in tree.
The progressValueChanged signal is emitted whenever task is done
(advance by one) or when some number of tasks were skipped or stopped
due to workflow policy or dynamic setup group handler.

Change-Id: I403059a6466ae0534ef647c3c1c61c0318f10325
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2022-11-17 15:07:47 +00:00
Jarek Kobus
e38db06203 TaskTree: Add taskCount() getter
Will be helpful when implementing progressMaximum.

Change-Id: I9204b53425054a01c96f3b926b595f7888f81e3a
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2022-11-17 15:07:34 +00:00
Jarek Kobus
234b3d1e6f TaskTree: Add DynamicSetup handler for groups
DynamicSetup enables finishing group (with Done or Error)
immediately before the group was even started.
The handler is invoked dynamically, just before starting
the group. The handler may also allow for running only
selected children and omitting others, so it may serve as
dynamic condition or dynamic multiplexer. This can be achieved
by modifying QSet<int> childrenToRun field inside returned
GroupConfig and setting the policy to ContinueSelected.

Change-Id: I15bddbb866a89ae9f783c59cc4bca89dd6a81c75
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2022-11-17 15:07:22 +00:00
Jarek Kobus
c49de14c9d Utils: Introduce TaskTree and Tasking namespace
The TaskTree class is responsible for running async task tree
structure defined in a declarative way.

Change-Id: Ieaf706c7d2efdc8b431a17b2db8b28bf4b7c38e5
Reviewed-by: hjk <hjk@qt.io>
2022-11-09 17:06:31 +00:00