Document when dependencies run in readme (#2103)
This commit is contained in:
parent
cc731f46ea
commit
a045cf0c6a
84
README.md
84
README.md
@ -2203,7 +2203,87 @@ foo $bar:
|
|||||||
echo $bar
|
echo $bar
|
||||||
```
|
```
|
||||||
|
|
||||||
### Running Recipes at the End of a Recipe
|
### Dependencies
|
||||||
|
|
||||||
|
Dependencies run before recipes that depend on them:
|
||||||
|
|
||||||
|
```just
|
||||||
|
a: b
|
||||||
|
@echo A
|
||||||
|
|
||||||
|
b:
|
||||||
|
@echo B
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
$ just a
|
||||||
|
B
|
||||||
|
A
|
||||||
|
```
|
||||||
|
|
||||||
|
In a given invocation of `just`, a recipe with the same arguments will only run
|
||||||
|
once, regardless of how many times it appears in the command-line invocation,
|
||||||
|
or how many times it appears as a dependency:
|
||||||
|
|
||||||
|
```just
|
||||||
|
a:
|
||||||
|
@echo A
|
||||||
|
|
||||||
|
b: a
|
||||||
|
@echo B
|
||||||
|
|
||||||
|
c: a
|
||||||
|
@echo C
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
$ just a a a a a
|
||||||
|
A
|
||||||
|
$ just b c
|
||||||
|
A
|
||||||
|
B
|
||||||
|
C
|
||||||
|
```
|
||||||
|
|
||||||
|
Multiple recipes may depend on a recipe that performs some kind of setup, and
|
||||||
|
when those recipes run, that setup will only be performed once:
|
||||||
|
|
||||||
|
```just
|
||||||
|
build:
|
||||||
|
cc main.c
|
||||||
|
|
||||||
|
test-foo: build
|
||||||
|
./a.out --test foo
|
||||||
|
|
||||||
|
test-bar: build
|
||||||
|
./a.out --test bar
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
$ just test-foo test-bar
|
||||||
|
cc main.c
|
||||||
|
./a.out --test foo
|
||||||
|
./a.out --test bar
|
||||||
|
```
|
||||||
|
|
||||||
|
Recipes in a given run are only skipped when they receive the same arguments:
|
||||||
|
|
||||||
|
```just
|
||||||
|
build:
|
||||||
|
cc main.c
|
||||||
|
|
||||||
|
test TEST: build
|
||||||
|
./a.out --test {{TEST}}
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
$ just test foo test bar
|
||||||
|
cc main.c
|
||||||
|
./a.out --test foo
|
||||||
|
./a.out --test bar
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Running Recipes at the End of a Recipe
|
||||||
|
|
||||||
Normal dependencies of a recipes always run before a recipe starts. That is to
|
Normal dependencies of a recipes always run before a recipe starts. That is to
|
||||||
say, the dependee always runs before the depender. These dependencies are
|
say, the dependee always runs before the depender. These dependencies are
|
||||||
@ -2240,7 +2320,7 @@ echo 'D!'
|
|||||||
D!
|
D!
|
||||||
```
|
```
|
||||||
|
|
||||||
### Running Recipes in the Middle of a Recipe
|
#### Running Recipes in the Middle of a Recipe
|
||||||
|
|
||||||
`just` doesn't support running recipes in the middle of another recipe, but you
|
`just` doesn't support running recipes in the middle of another recipe, but you
|
||||||
can call `just` recursively in the middle of a recipe. Given the following
|
can call `just` recursively in the middle of a recipe. Given the following
|
||||||
|
Loading…
Reference in New Issue
Block a user