Add a dependsOn option for tasks and projects
Is your feature request related to a problem? Please describe
I like the fact that you can run tasks in parallel. However, to complement this without running into issues a dependsOn option can be used to sort tasks and projects to make sure they only run when their parents have been run. So yes things run in parallel, but tasks/projects with dependsOn are sorted and paused as long their parents have not finished/been run (and as long as they are in the list of tasks to be run).
Then on project level, it also does the same thing, only it makes sure the task being run for the projects, it sorts the projects in a way that makes dependants run at the end of their parents.
This is useful when, say building apps that don't work when their libs are not build before them. So these apps will have to wait for the libs to finish building first.
Describe the solution you'd like
tasks:
# Command name [required]
simple-1:
cmd: |
echo "hello world"
desc: simple command 1
# Short-form for a command
simple-2: echo "hello world"
dependsOn: simple-1
# Short-form for a command
simple-3: echo "hello world"
When this is run in parallel, it doesn't matter which task starts first, simple-2 will have to wait for simple-1 to finish. simple 1/3 wait for nobody and will be run in parallel.
projects:
api:
path: applications/backend/good-api
dependsOn: plugger
app:
path: applications/frontend/good-app
dependsOn: plugger
plugger:
path: plugins/plugin-that
plog:
path: plugins/plugin-2
Same goes for the projects. a mani run build -a will build these in order without messing it up; plog & plugger will run parallel, but api and app will wait for plugger to finish before they run in parallel.
Additional context
To get around the current limitation I have to remember that I have to run these tasks on these projects before i do on these projects. When I write tasks for this, the whole configuration becomes complex as I have to disable parallel and configure and order them in the config. Instead of just telling the program that this project depends on this project, so however order you run them, as long as they are in the same list of projects to be run, always run dependents at the end and wait for their parents to finish running.
I do see a use case for it (like you mentioned), but it's a bit more complex logic and will take a bit more time to develop properly (figure out the API, ordering, etc.). I'll put it in the backlog.
This would be a great enhancement.