/
Justfile
163 lines (119 loc) · 4.73 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# ============================================================================ #
#
# Think of this as a `Makefile' except you run `just <TARGET>' instead
# of `make <TARGET>'.
#
# The difference between `just' and `make' is that `just' does not check
# timestamps to determine if files are stale; so in that sense you can imagine
# it as `make' except "all targets are `.PHONY' targets".
#
#
# ---------------------------------------------------------------------------- #
nix_options := "--extra-experimental-features nix-command \
--extra-experimental-features flakes"
PKGDB_BIN := "${PWD}/pkgdb/bin/pkgdb"
FLOX_BIN := "${PWD}/cli/target/debug/flox"
LD_FLOXLIB := "${PWD}/pkgdb/lib/ld-floxlib.so"
cargo_test_invocation := "PKGDB_BIN=${PKGDB_BIN} cargo test --workspace"
# ---------------------------------------------------------------------------- #
@_default:
just --list --unsorted
# ---------------------------------------------------------------------------- #
# Print the paths of all of the binaries
@bins:
echo "{{PKGDB_BIN}}"
echo "{{FLOX_BIN}}"
echo "{{LD_FLOXLIB}}"
# ---------------------------------------------------------------------------- #
# Build the compilation database
build-cdb:
@make -C pkgdb -j 8 -s cdb
# Build only pkgdb
@build-pkgdb:
make -C pkgdb -j 8;
# Build pkgdb with debug symbols
@build-pkgdb-debug:
# Note that you need to clean pkgdb first
make -C pkgdb -j 8 -s DEBUG=1
# Clean the pkgdb build cache
@clean-pkgdb:
make -C pkgdb -j 8 -s clean
# Build only flox
@build-cli: build-pkgdb
pushd cli; cargo build -q
# Build the binaries
build: build-cli
# ---------------------------------------------------------------------------- #
# Run the pkgdb tests
@test-pkgdb: build-pkgdb
make -C pkgdb -j 8 tests;
make -C pkgdb check;
# Run the end-to-end test suite
@functional-tests +bats_args="": build
flox-tests --pkgdb "{{PKGDB_BIN}}" \
--flox "{{FLOX_BIN}}" --ld-floxlib "{{LD_FLOXLIB}}" {{bats_args}}
# Run the CLI integration test suite
@integ-tests +bats_args="": build
flox-cli-tests \
--pkgdb "{{PKGDB_BIN}}" \
--flox "{{FLOX_BIN}}" \
--ld-floxlib "{{LD_FLOXLIB}}" \
{{bats_args}}
# Run a specific CLI integration test file by name (not path)
@integ-file +bats_args="": build
flox-cli-tests --pkgdb "{{PKGDB_BIN}}" \
--flox "{{FLOX_BIN}}" --ld-floxlib "{{LD_FLOXLIB}}" {{bats_args}}
# Run the CLI unit tests
@unit-tests regex="": build
pushd cli; \
{{cargo_test_invocation}} {{regex}}
# Run the CLI unit tests, including impure tests
@impure-tests regex="": build
pushd cli; \
{{cargo_test_invocation}} {{regex}} --features "extra-tests"
# Run the entire CLI test suite
test-cli: impure-tests integ-tests
# Run the entire test suite, including impure unit tests
test-all: test-pkgdb impure-tests integ-tests functional-tests
# ---------------------------------------------------------------------------- #
# Enters the Rust development environment
@work:
# Note that this command is only really useful if you have
# `just` installed outside of the `flox` environment already
nix {{nix_options}} develop
# ---------------------------------------------------------------------------- #
# Bump all flake dependencies and commit with a descriptive message
@bump-all:
nix {{nix_options}} flake update --commit-lock-file \
--commit-lockfile-summary "chore: flake bump";
# Bump a specific flake input and commit with a descriptive message
@bump input:
nix {{nix_options}} flake lock --update-input {{input}} \
--commit-lock-file --commit-lockfile-summary \
"chore: bump '{{input}}' flake input";
# ---------------------------------------------------------------------------- #
# Output licenses of all dependency crates
@license:
pushd cli; \
cargo metadata --format-version 1 \
|jq -r '.packages[]|[.name,.license]|@csv';
# ---------------------------------------------------------------------------- #
# Run a `flox` command
@flox +args="": build
cli/target/debug/flox {{args}}
# Run a `flox` command using the catalog
@catalog-flox +args="": build
FLOX_FEATURES_USE_CATALOG=true cli/target/debug/flox {{args}}
# Run a `pkgdb` command
@pkgdb +args="": build-pkgdb
pkgdb/bin/pkgdb {{args}}
# ---------------------------------------------------------------------------- #
# Clean ( remove ) built artifacts
@clean:
pushd cli; cargo clean;
make -C pkgdb clean;
# ---------------------------------------------------------------------------- #
#
#
#
# ============================================================================ #