forked from pls-rs/pls
-
Notifications
You must be signed in to change notification settings - Fork 0
/
justfile
80 lines (63 loc) · 1.65 KB
/
justfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
set dotenv-load := false
# Show all available recipes
# Show all available recipes, also recurses inside nested justfiles.
@_default:
just --list --unsorted
printf "\nExamples:\n"
printf "=========\n"
just examples/
printf "\nDocs:\n"
printf "=====\n"
just docs/
#########
# Setup #
#########
# Install dependencies for sub-projects.
install:
# Cargo does not need an install step.
just docs/install
just examples/install
# Download pre-commits and install Git hooks.
pre-commit version="3.8.0":
curl \
--output pre-commit.pyz \
--location \
"https://github.com/pre-commit/pre-commit/releases/download/v{{ version }}/pre-commit-{{ version }}.pyz"
python3 pre-commit.pyz install
# Run pre-commit to lint and format files.
lint hook="" *files="":
python3 pre-commit.pyz run {{ hook }} {{ if files == "" { "--all-files" } else { "--files" } }} {{ files }}
###########
# Recipes #
###########
# Run the program.
run *args:
cargo run -- {{ args }}
# Run the program with debug logging.
debug *args:
env RUST_LOG=debug just run {{ args }}
# Run tests.
test *args:
cargo test {{ args }}
###########
# Release #
###########
# Build the release binary.
release:
cargo build --release
# Install `cross`, if it does not already exist.
get-cross:
[ -x "$(command -v cross)" ] || cargo install cross
# Build a release binary for the given target with `cross`.
cross target:
cross build --release --verbose --target {{ target }}
###########
# Aliases #
###########
alias i := install
alias p := pre-commit
alias l := lint
alias r := run
alias d := debug
alias t := test
alias R := release