Commit Graph

24 Commits

Author SHA1 Message Date
Jarek Kobus
06dda40ccc TaskTree: Add synchronous invocation (Tasking::Sync)
Make it possible to mix synchronous and asynchronous calls
inside task tree.

Basically, it's a shortcut for:

bool syncMethod();
Group {
    OnGroupSetup([syncMethod] { return syncMethod()
                                ? TaskAction::StopWithDone
                                : TaskAction::StopWithError; })
}

Please note: similarly to Group, Sync isn't counted as a task
inside taskCount() and doesn't emit TaskTree::progressValueChanged()
when finished. It's being considered as a simple handler
that doesn't last long and shouldn't block the GUI thread.
Otherwise, use AsyncTask instead.

Change-Id: If71c5da2f9b202a69c41a555cc93d314476952f4
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-02-10 10:50:47 +00:00
Jarek Kobus
45d72db1b4 TaskTree: Add 2 more variants of NestedParallelError test
Variant 2:
Inside this test the process 2 should finish first, then synchonously:
- process 3 should exit setup with error
- process 1 should be stopped as a consequence of error inside the group
- processes 4 and 5 should be skipped

Variant 3:
This test ensures process 1 doesn't invoke its done handler,
being ready while sleeping in process 2 done handler.
Inside this test the process 2 should finish first, then synchonously:
- process 3 should exit setup with error
- process 1 should be stopped as a consequence of error inside the group
- process 4 should be skipped
- the first child group of root should finish with error
- process 5 should be started (because of root's continueOnError policy)

Change-Id: Ie34737244c7da4334a6cbbae4f0ddba99503d09c
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-02-01 13:10:06 +00:00
Jarek Kobus
f8d4e485c2 TaskTree: Add a test for running empty tree with group handlers
Change-Id: Ia8c31928f07bec7a91937e0a1798d99ac761d0e2
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-02-01 13:10:00 +00:00
Jarek Kobus
0f19fd6d0d TaskTree: Add tests for proper continuation unwinding
Change-Id: I79a077277328033b99fab6b2503621f3209c63be
Reviewed-by: hjk <hjk@qt.io>
2023-01-27 14:15:25 +00:00
Jarek Kobus
6b11e1d572 TaskTree: Revamp tests
Get rid of std::bind.

Enclose each data tag of processTree inside its own block,
so that "root" and "log" names are unique within each block.
This makes each block look like a pattern with filled data up.

Introduce TestData structure, so that it's harder now to mix
the order of test data in new rows.

Introduce some enums instead of bools to make more meaning
on the returned data.

Change-Id: Iffe49cf1c7f912378467ab9f9c1256003dba7b9c
Reviewed-by: hjk <hjk@qt.io>
2023-01-27 14:15:14 +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
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
9dfd72017c TaskTree: Add more tests for recently added fixes
Change-Id: Ia71fa174380b484cbe07a23f8b641755c5edcc65
Reviewed-by: hjk <hjk@qt.io>
2023-01-20 09:20:14 +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
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
Jarek Kobus
4ff34cf47f TaskTree test: Use storage for getting the result from task tree
Remove storage() test case, as Storage functionality is fully
tested in processTree().

Change-Id: I05c199cf4cfa2a77493ce54df267b8ed1c2804bc
Reviewed-by: hjk <hjk@qt.io>
2022-12-09 12:09:23 +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
cb8d4797b7 TaskTree: Add TreeStorageBase::operator==
Change-Id: I50144978b86f2e5fa89fc35c687b64ed102803e6
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-12-09 11:42:49 +00:00
Jarek Kobus
8d6d51ec3e tst_TaskTree: Increase the timeout
Change-Id: I8306aeb3719feb295a27339736209159f688a734
Reviewed-by: hjk <hjk@qt.io>
2022-12-01 15:18:40 +00:00
Jarek Kobus
d29fa0f3ba TaskTree test: Detect test timeout
Detect, if test has timed out before checking other results.
When the test timed out, the task tree may still be running.
This helps in analyzing the test failures inside precheck
button.

Change-Id: Iccad85dbb8b3d621165ab8b0c5a1b82a1d6808cb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-11-29 15:23:30 +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
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
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