Ensure the For loop iterates even when the loop's body is empty.
Simplify internals a bit.
Change-Id: I4a269d61fa324a9c36109e95e74a992e915a72b0
Reviewed-by: hjk <hjk@qt.io>
Improve code readability by requiring iteratable Group
to be named For.
The For's c'tor requires an iterator element as a first arg.
The For's c'tor allows for passing exactly one iterator element.
It's not possible to place iterators inside Group element anymore.
Change-Id: I9dfe2c0da058abac161f66c4e336da2417c383f1
Reviewed-by: hjk <hjk@qt.io>
They are useful in conditional statements to influence
the workflow of a group.
Add tests for nullItem, successItem and errorItem.
Fix some comments in tests.
Change-Id: If0faa579e256d5a943d22cf66fe5208d60a63e0d
Reviewed-by: hjk <hjk@qt.io>
Introduce AND and OR operators for ExecutableItem
taking DoneResult.
The "task || DoneResult::Success" is an eqivalent to
tweaking the task's done result into success unconditionally.
The "task && DoneResult::Error" is an eqivalent to
tweaking the task's done result into error unconditionally.
Change-Id: Ib9213a786697c1434c37e99e726641baab550523
Reviewed-by: hjk <hjk@qt.io>
Introduce operator&& and operator|| taking ExecutableItem
as a second arg.
Both tasks (first and second) execute in sequence.
AND:
- If the 1st task finishes with Error, the 2nd task is skipped
and the returned item reports Error.
- Otherwise, the 2nd task is executed
and the returned item reports the 2nd task's result.
OR:
- If the 1st task finishes with Success, the 2nd task is skipped
and the returned item reports Success.
- Otherwise, the 2nd task is executed
and the returned item reports the 2nd task's result.
Change-Id: Ib7874a82bd86eeb57fa5d3691b4a9e63a158772f
Reviewed-by: hjk <hjk@qt.io>
Introduce ExecutableItem operator!(const ExecutableItem &item).
This operator returns a copy of this executable item
with DoneResult tweaked by negation.
If this item reports DoneResult::Success, the returned item reports
DoneResult::Error.
If this item reports DoneResult::Error, the returned item reports
DoneResult::Success.
Change-Id: Ie609938e92bbc38ddcc66f5bc3244f864e3e59c7
Reviewed-by: hjk <hjk@qt.io>
This patch addresses the 38th point in the bugreport below.
Add tests for it.
Adapt docs and warning messages accordingly.
Task-number: QTCREATORBUG-28741
Change-Id: I276d2d4c3a514147f67252dc5073d79fed94b9ff
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
If the onGroupDone() handler returned DoneResult,
this result was ignored by the running task tree.
Fix it so that the optional DoneResult takes
priority over group's workflow policy.
Add tests for it.
Change-Id: I7ffdef2af08337d7214f2c3d4b68153cddaad425
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
In parallel mode the done handlers may be invoked in a
different order than the corresponding setup handlers.
Change-Id: Ib3df668491054501d250fef9c499d127fe98626d
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Add tests for it.
This addresses the 35th point in the bugreport below.
Task-number: QTCREATORBUG-28741
Change-Id: Id35d51155e0bfd413c06b3a2c5bb57b8bcea8487
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This is quite crucial test checking the right internal behavior.
The expected asyncCount numbers were added to these tests after
processing each recipe by hand and deducing the expected scenario
and the number of times each recipe should return the control to
the main event loop before the task tree finished.
Be very careful when correcting any of these numbers - this might
mean the internal change inside the task tree forcing the asyncCount
adjustment may break the task tree architecture.
Change-Id: Ia3acfbf3cb232ed95df97fe5822305df98e2271a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
This might be useful when using conditional operator.
Might also be used in place of the default c'tor for GroupItem.
Add a test for it.
Change-Id: I622e5d3d94f7020dc294cf5bca643c53a0813d8a
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Fix also a case when parent iteration isn't progressive.
Add a test for it.
Amends e059b62421
Change-Id: Ic2f8c047d413ab2e2b98af4592f7cb60185bea06
Reviewed-by: hjk <hjk@qt.io>
Advance the progress value by the group's children count when
LoopUntil handler returns false on the first iteration.
Add a test for it.
Change-Id: I3783dd295dfaa16c09c5eda299f365ff981b3be7
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 better corresponds to done handlers called
in this case with DoneWith::Cancel.
By the way, get rid of unused LocatorFilter::stop().
Change-Id: Ie4246b8d888fff95940a2ed41367d2817bd6339c
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
If a task or task's adapter sends done() signal directly
from the destructor (which isn't really desired),
ensure we disconnect from this signal beforehand,
otherwise this may start invoking normal handling of task done()
and interfere with the destruction.
Fix NetworkQuery d'tor.
Add a test for it.
Add some TODO items.
Fixes: QTCREATORBUG-30204
Change-Id: I56a34d0f00c961c15bd1bcffef45520a4be5bce0
Reviewed-by: hjk <hjk@qt.io>
When a number of repeats is known in advance,
make the progress reporting aware of it.
Add a test for it.
Change-Id: I676a4aa9eb469cfe40a2729d231c706dff3ca07c
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reset internal data after a call to stop().
Add a test for restarting the task tree.
Change-Id: Iedf11d97c33c9001c818078abc816e3c483c42b8
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Make it possible to run a nested task tree containing
the common storage from the outer task tree's handler.
This means we need to manage the stack of active storages
per thread.
Add a test for it.
This addresses the 4th point in the report below.
Task-number: QTCREATORBUG-29103
Change-Id: Ib0f925048197625a0eb9f83f262c7256a5756cc8
Reviewed-by: hjk <hjk@qt.io>
This addresses the 20th point in the master task below.
Task-number: QTCREATORBUG-28741
Change-Id: I696beda87430fbe637abba8054012fb77516e220
Reviewed-by: hjk <hjk@qt.io>
Rename storage internals.
This addresses the 20th point in the master task below.
Task-number: QTCREATORBUG-28741
Change-Id: I1ed42472060de6180d4665d6504598adb57828fe
Reviewed-by: hjk <hjk@qt.io>
Make the c'tor of the GroupItem taking the TreeStorageBase
public instead.
This addresses the 20th point in the master task below.
Task-number: QTCREATORBUG-28741
Change-Id: I78320ec24b4e4b915ab549135fb93b45c658b9f2
Reviewed-by: hjk <hjk@qt.io>
Make ordering separate for each thread.
Add stress test for it.
Change-Id: Idb42ce2511b18c0e9dd4dcb216ca39b35b5c980e
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Change the argument of TaskInterface::done() signal
from bool into DoneResult. Make it consistent with
other TaskTree API.
Introduce toDoneResult(bool success) helper.
Change-Id: I7b3041d7c1ed0317c76adbc1fd37448231e85f82
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
Instead of using ambiguous bool.
Reuse it in place of OnDone enum in tests.
Change-Id: Ie83e82d9debb88ca19f71ecab40f8ad081293f41
Reviewed-by: hjk <hjk@qt.io>
This addresses the 15th point in the master task below.
Task-number: QTCREATORBUG-28741
Change-Id: I9d449a6ce1538071f300b68b2929bcd437d1bb0f
Reviewed-by: hjk <hjk@qt.io>
Run the same recipe concurrently. Test whether handling the same
storage concurrently works properly.
This addresses the 24th point in the master task below.
Task-number: QTCREATORBUG-28741
Change-Id: Ic3358bef335b96b7dc2b88ad8102c440db5dafbf
Reviewed-by: hjk <hjk@qt.io>
Make it possible to have the same storage instance
placed in different groups.
When the same storage is placed in two nested groups,
implement storage shadowing so that when the inner group
is activated it activates only the innermost storage
and shadows any possible the same storages in parent groups.
Keep placing the same storage twice in one group forbidden.
This functionality is required to implement the task tree loops
(see 3rd point in the master task below).
This addresses the 23th point in the master task below.
Task-number: QTCREATORBUG-28741
Change-Id: Iba00bc32319430136a794974c14a1ab65272eaa9
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>