-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathjustfile
More file actions
136 lines (109 loc) · 4.33 KB
/
justfile
File metadata and controls
136 lines (109 loc) · 4.33 KB
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
# Justfile for the Ferrous Systems Rust Exercises
#
# Copyright (c) Ferrous Systems, 2025
set windows-shell := ["powershell.exe", "-NoLogo", "-Command"]
package_list := " \
exercise-solutions \
exercise-solutions/connected-mailbox\
exercise-solutions/multi-threaded-mailbox\
exercise-templates \
qemu-code/uart-driver\
nrf52-code/boards/dk \
nrf52-code/boards/dk-solution \
nrf52-code/boards/dongle \
nrf52-code/radio-app \
nrf52-code/usb-app \
nrf52-code/usb-app-solutions \
nrf52-code/consts \
nrf52-code/puzzle-fw \
nrf52-code/loopback-fw \
nrf52-code/usb-lib-solutions/complete \
nrf52-code/usb-lib-solutions/get-descriptor-config \
nrf52-code/usb-lib-solutions/get-device \
nrf52-code/usb-lib-solutions/set-config \
xtask \
tools/tcp-client \
"
default:
@just --choose
everything: test-mdbook build-mdbook test-exercise-templates test-exercise-solutions test-connected-mailbox test-multi-threaded-mailbox build-qemu-uart-driver build-qemu-uart-driver-ferrocene build-radio-app build-usb-app test-usb-lib build-puzzle-fw build-loopback-fw format
format-check: format-check-rust
format: format-rust
clean: clean-rust
rm -rf ./exercise-book/book
serve:
cd exercise-book && mdbook serve
build-mdbook:
cd exercise-book && RUST_LOG=info mdbook build
test-mdbook:
cd exercise-book && RUST_LOG=info mdbook test
test-exercise-templates:
cd exercise-templates && cargo build
cd exercise-templates && cargo test
test-exercise-solutions:
cd exercise-solutions && cargo build
cd exercise-solutions && cargo test
test-connected-mailbox:
cd exercise-solutions/connected-mailbox && cargo build
cd exercise-solutions/connected-mailbox && cargo test
test-multi-threaded-mailbox:
cd exercise-solutions/multi-threaded-mailbox && cargo build
cd exercise-solutions/multi-threaded-mailbox && cargo test
build-qemu-uart-driver:
cd qemu-code/uart-driver && cargo +nightly build --release
build-qemu-uart-driver-ferrocene:
cd qemu-code/uart-driver && criticalup install && criticalup run cargo build --release
build-radio-app:
cd nrf52-code/radio-app && cargo build --release
build-hal-app:
cd nrf52-code/hal-app && cargo build --release
build-usb-app:
cd nrf52-code/usb-app && cargo build --release
cd nrf52-code/usb-app-solutions && cargo build --release
test-usb-lib:
cd nrf52-code/usb-lib && cargo build --release
cd nrf52-code/usb-lib-solutions/complete && cargo build --release
cd nrf52-code/usb-lib-solutions/get-descriptor-config && cargo build --release
cd nrf52-code/usb-lib-solutions/get-device && cargo build --release
cd nrf52-code/usb-lib-solutions/set-config && cargo build --release
build-puzzle-fw:
cd nrf52-code/puzzle-fw && cargo build --release
build-loopback-fw:
cd nrf52-code/loopback-fw && cargo build --release
build-nrf52-code: build-radio-app build-usb-app test-usb-lib build-puzzle-fw build-loopback-fw build-hal-app
assemble version:
echo "Making ./rust-exercises-{{ version }}..."
rm -rf ./rust-exercises-{{ version }}
mkdir -p ./rust-exercises-{{ version }}/exercise-book
mv ./exercise-book/book ./rust-exercises-{{ version }}/exercise-book/html
cp -r ./exercise-templates ./rust-exercises-{{ version }}
cp -r ./exercise-solutions ./rust-exercises-{{ version }}
cp -r ./nrf52-code ./rust-exercises-{{ version }}
cp -r ./qemu-code ./rust-exercises-{{ version }}
cp -r ./xtask ./rust-exercises-{{ version }}
cp -r ./.cargo ./rust-exercises-{{ version }}
cp -r ./tools ./rust-exercises-{{ version }}
cp ./nrf52-code/puzzle-fw/target/thumbv7em-none-eabihf/release/puzzle-fw "./rust-exercises-{{ version }}/nrf52-code/boards/dongle-fw/puzzle-fw"
cp ./nrf52-code/loopback-fw/target/thumbv7em-none-eabihf/release/loopback-fw "./rust-exercises-{{ version }}/nrf52-code/boards/dongle-fw/loopback-fw"
echo "Compressing ./rust-exercises-{{ version }}.zip..."
zip -r ./rust-exercises-{{ version }}.zip ./rust-exercises-{{ version }}
format-check-rust:
#!/bin/sh
FAIL=0
for package in {{ package_list }}; do
echo "Checking ${package}..."
( cd ${package} && cargo fmt --check ) || FAIL=1
done
if [[ "$FAIL" == 1 ]]; then exit 1; else echo "Formatting all OK"; fi
format-rust:
#!/bin/sh
for package in {{ package_list }}; do
echo "Formatting ${package}..."
( cd ${package} && cargo fmt )
done
clean-rust:
#!/bin/sh
for package in {{ package_list }}; do
echo "Cleaning ${package}..."
( cd ${package} && cargo clean )
done