-
Notifications
You must be signed in to change notification settings - Fork 20
/
justfile
124 lines (97 loc) · 4 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
default: debug
# runs all CI checks in parallel where possible
ci:
#!/usr/bin/env bash
set -e # Exit immediately if any command fails
# Start background processes and save their PIDs
just fmt & fmt_pid=$!
just unused-deps & unused_pid=$!
just deny & deny_pid=$!
# Wait for all background processes and check their exit status
wait $fmt_pid || exit 1
wait $unused_pid || exit 1
wait $deny_pid || exit 1
# Only continue if all background processes succeeded
just lint
just test
just doc-once
project_root := `git rev-parse --show-toplevel`
arch := `uname -m`
fds := "32768"
# builds in release mode
build:
cargo build --release
# cargo clippy
lint:
cargo clippy --all-targets --all-features -- -D warnings
lint-fix:
cargo clippy --fix --all-targets --all-features --allow-dirty --allow-staged -- -D warnings
# cargo nextest
test:
cargo nextest run
# cargo miri
miri:
# only run if test prefixed with "miri"
MIRIFLAGS='-Zmiri-tree-borrows -Zmiri-ignore-leaks' cargo miri nextest run miri
# cargo fmt
fmt:
cargo fmt
proxy:
ulimit -Sn {{fds}} && cargo run --profile release-full --bin hyperion-proxy
proof-of-concept:
cargo run --bin proof-of-concept --release
proof-of-concept-full:
cargo run --bin proof-of-concept --profile release-full
# cargo machete
unused-deps:
cargo machete
# cargo deny
deny:
cargo deny check
# Watch and rebuild release version
watch-proof-of-concept:
RUN_MODE="release-{{arch}}" cargo watch \
--postpone \
--no-vcs-ignores \
-w {{project_root}}/.trigger-release \
-s './target/release/proof-of-concept'
# Watch Hyperion changes and rebuild
watch:
cargo watch \
-w '{{project_root}}/crates/hyperion' \
-w '{{project_root}}/events/proof-of-concept' \
-s 'cargo check -p proof-of-concept && cargo build --release -p proof-of-concept' \
-s 'touch {{project_root}}/.trigger-release'
# run in debug mode with tracy; auto-restarts on changes
debug:
#!/usr/bin/env -S parallel --shebang --ungroup --jobs 3
RUST_BACKTRACE=full RUN_MODE=debug-{{arch}} cargo watch --postpone --no-vcs-ignores -w {{project_root}}/.trigger-debug -s './target/debug/proof-of-concept'
RUST_BACKTRACE=full ulimit -Sn {{fds}} && cargo run --bin hyperion-proxy --release
cargo watch -w '{{project_root}}/crates/hyperion' -w '{{project_root}}/events/proof-of-concept' -s 'cargo check -p proof-of-concept && cargo build -p proof-of-concept' -s 'touch {{project_root}}/.trigger-debug'
# run in release mode with tracy; auto-restarts on changes
release:
#!/usr/bin/env -S parallel --shebang --ungroup --jobs 3
RUN_MODE=release-{{arch}} cargo watch --postpone --no-vcs-ignores -w {{project_root}}/.trigger-release -s './target/release/proof-of-concept'
ulimit -Sn {{fds}} && cargo run --profile release-full --bin hyperion-proxy
cargo watch -w '{{project_root}}/crates/hyperion' -w '{{project_root}}/events/proof-of-concept' -s 'cargo check -p proof-of-concept && cargo build --release -p proof-of-concept' -s 'touch {{project_root}}/.trigger-release'
release-full:
#!/usr/bin/env -S parallel --shebang --ungroup --jobs 2
RUN_MODE=release-f-{{arch}} cargo run --profile release-full -p proof-of-concept'
ulimit -Sn {{fds}} && cargo run --bin hyperion-proxy --profile release-full
# run a given number of bots to connect to hyperion
bots ip='127.0.0.1:25565' count='1000':
cargo install -q --git https://github.com/andrewgazelka/rust-mc-bot --branch optimize
ulimit -Sn {{fds}} && rust-mc-bot {{ip}} {{count}} 4
# run in release mode with tracy
run:
cargo run --release -- -t
doc-once:
cargo doc --workspace --no-deps --all-features
doc:
cargo watch -x 'doc --workspace --no-deps --all-features'
# Run the data extractor and save generated data to `/extracted`.
extract:
mkdir -p extractor/run
echo 'eula=true' > extractor/run/eula.txt
cd extractor && sh gradlew runServer
cp extractor/run/extractor_output/* extracted/