You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's come up a few times that people would like to run recipes after another recipe. If there's a good way to do this that isn't weird and doesn't have surprising behavior, I think this would be a good feature.
There are a few open questions:
Should a post-dependency run if it has already been run in the current just invocation? Normal recipes and dependencies will run at most once, even if multiple recipes run that have them as a dependency. However, from the feature requests asking to be able to run recipes after another recipe, people seem to want post-dependencies to always run, so that's what I'm leaning for. I'm thinking of treating each post-dependency invocation as an independent just invocation.
Should a post-dependency run if the recipe fails? I'm thinking that at first it shouldn't, but we can add syntax later that will make a recipe run after another recipe, even if that recipe fails.
An idea for the syntax is to appropriate && and || from sh:
foo:
echo foo
# foo only runs after bar if it succeeds
bar: && foo
echo bar
# foo runs after baz regardless of whether or not it succeeds
baz: || foo
echo qux
# foo runs after qux if it succeeds, bar runs after foo regardless
qux: && foo || bar
echo qux
Downsides:
It is terse and cryptic
&& and || require a little bit of thought to understand why they work how they do
Upsides:
It is terse and cryptic
If you're used to it from shell/perl/python/whatever, it makes a lot of sense
The text was updated successfully, but these errors were encountered:
I started working on this and calling them "subsequents". If recipes are allowed to have themselves as subsequents, this allows recursion, which is a step on the way towards making Just turing complete. (#792)
It's come up a few times that people would like to run recipes after another recipe. If there's a good way to do this that isn't weird and doesn't have surprising behavior, I think this would be a good feature.
There are a few open questions:
Should a post-dependency run if it has already been run in the current just invocation? Normal recipes and dependencies will run at most once, even if multiple recipes run that have them as a dependency. However, from the feature requests asking to be able to run recipes after another recipe, people seem to want post-dependencies to always run, so that's what I'm leaning for. I'm thinking of treating each post-dependency invocation as an independent just invocation.
Should a post-dependency run if the recipe fails? I'm thinking that at first it shouldn't, but we can add syntax later that will make a recipe run after another recipe, even if that recipe fails.
What should the syntax be? This is yet another case that I wish we had Add extensible recipe and justfile annotations #604, since then we could make it an annotation at first and punt on the syntax.
An idea for the syntax is to appropriate
&&
and||
fromsh
:Downsides:
&&
and||
require a little bit of thought to understand why they work how they doUpsides:
The text was updated successfully, but these errors were encountered: