|
| 1 | +This directory contains an infrastructure for [`just`](https://github.com/casey/just) |
| 2 | +recipes that can be used throughout this and the internal repository. In particular we |
| 3 | +have common verbs (`build`, `test`, `format`, `lint`, `generate`) that individual parts |
| 4 | +of the project can implement, and some common functionality that can be used to that |
| 5 | +effect. |
| 6 | + |
| 7 | +# Forwarding |
| 8 | + |
| 9 | +The core of the functionality is given by forwarding. The idea is that: |
| 10 | + |
| 11 | +- if you are in the directory where a verb is implemented, you will get that as per |
| 12 | + standard `just` behaviour (possibly using fallback). |
| 13 | +- if on the other hand you are beneath it, and you run something like |
| 14 | + `just test ql/rust/ql/test/{a,b}`, then a forwarder script finds a common justfile |
| 15 | + implementing the verb for all the positional arguments passed there, and then retries |
| 16 | + calling `just test` from there. So if `test` is implemented beneath that (in that case, |
| 17 | + it is in `rust/ql/test`), it uses that recipe. |
| 18 | +- even if there isn't a recipe that is common to all the positional arguments, the |
| 19 | + forwarder will still group the arguments in batches using the same recipe. So |
| 20 | + `just build ql/rust ql/java`, or |
| 21 | + `just test ql/rust/ql/test/some/language/test ql/rust/ql/integration-test/some/integration/test` |
| 22 | + will also work, with corresponding recipes run sequentially. |
| 23 | + |
| 24 | +Another point is how launching QL tests can be tweaked: |
| 25 | + |
| 26 | +- by default, the corresponding CLI is built from the internal repo (nothing is done if |
| 27 | + working in `codeql` standalone), and no additional database or consistency checks are |
| 28 | + made |
| 29 | +- `--codeql=built` can be passed to skip the build step (if no changes were made to the |
| 30 | + CLI/extractors). This is consistent with the same pytest option |
| 31 | +- you can add the additional checks that CI does with `--all-checks` or the `+` |
| 32 | + abbreviation. These additional checks are configured in justfiles per language, and |
| 33 | + correspond to all the additional checks that CI adds (but that a dev might not want to |
| 34 | + run by default). |
| 35 | + |
| 36 | +Some caveats: |
| 37 | + |
| 38 | +- passing arguments with spaces generally doesn't work, although setting arguments with |
| 39 | + spaces in `justfile`s (for the base arguments) is supported using escaping as in `\\`. |
| 40 | + This is a known limitation of just (see |
| 41 | + <https://github.com/casey/just/issues/1988>) |
| 42 | +- when running different recipes for the same verb, non-positional arguments need to be |
| 43 | + supported by all recipes involved. For example, this will work ok for `--learn` or |
| 44 | + `--codeql` options in language and integration tests |
0 commit comments