Add contrib/justfile

Add a `justfile` containing useful development workflow commands.

Just recipes can be run by symlinking `contrib/justfile` into the
repository root:

    ln -s contrib/justfile justfile

And running:

    just RECIPE

Also add `/justfile` to `.gitignore`, to ignore symlinks.

`just` is command runner with make-like syntax. It is not a build
system, and only serves as convenient way of saving and running
commands. It is available here:

    https://github.com/casey/just/

Added in `contrib/justfile`, since `just` is a large, unreviewed
dependency. Developers considering using `just` should make sure to take
this into consideration.
This commit is contained in:
Casey Rodarmor 2024-11-14 12:56:53 -08:00
parent 2d944e982c
commit ccea33e080
2 changed files with 31 additions and 0 deletions

3
.gitignore vendored
View file

@ -21,3 +21,6 @@ test/lint/test_runner/target/
/guix-build-*
/ci/scratch/
# ignore so users can symlink `contrib/justfile` into root
/justfile

28
contrib/justfile Normal file
View file

@ -0,0 +1,28 @@
# dependencies:
# just: https://github.com/casey/just
# watchexec: https://github.com/watchexec/watchexec
set positional-arguments
n := num_cpus()
build: configure
cmake --build build -j {{ n }}
configure:
@[[ -d build ]] || cmake -B build
clean:
rm -rf build
d *args:
./build/src/bitcoind -regtest "$@"
cli *args:
./build/src/bitcoin-cli -regtest "$@"
test: build
ctest --test-dir build -j {{ n }}
watch:
watchexec 'just build'