-
Notifications
You must be signed in to change notification settings - Fork 1
/
Justfile
84 lines (74 loc) · 3.49 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
cortexm_core := 'cortexm3_r2p0'
tisl_mcu := 'cc2538'
export DRONE_RUSTFLAGS := '--cfg cortexm_core="' + cortexm_core + '" ' + '--cfg tisl_mcu="' + tisl_mcu + '"'
target := 'thumbv7em-none-eabihf'
features := 'gpio ioc sysctrl tim uart'
# Install dependencies
deps:
rustup target add {{target}}
rustup component add clippy
rustup component add rustfmt
type cargo-readme >/dev/null || cargo +stable install cargo-readme
# Reformat the source code
fmt:
cargo fmt
# Check the source code for mistakes
lint:
cargo clippy --package drone-tisl-map-svd
drone env {{target}} -- cargo clippy --features "{{features}}" --all --exclude drone-tisl-map-svd
# Build the documentation
doc:
cargo doc --package drone-tisl-map-svd
drone env {{target}} -- cargo doc --features "{{features}}" --package drone-tisl-map
# Open the documentation in a browser
doc-open: doc
drone env {{target}} -- cargo doc --features "{{features}}" --package drone-tisl-map --open
# Run the tests
test:
drone env -- cargo test --features "{{features}} std" --package drone-tisl-map
# Test all MCUs
test-all:
DRONE_RUSTFLAGS='--cfg cortexm_core="cortexm3_r2p0" --cfg tisl_mcu="cc2538"' drone env -- cargo test --package drone-tisl-map --features "{{features}} std"
# Update README.md
readme:
cargo readme -o README.md
# Bump the versions
version-bump version drone-core-version drone-cortexm-version drone-svd-version:
sed -i '/\[.*\]/h;/version = ".*"/{x;s/\[package\]/version = "{{version}}"/;t;x}' \
Cargo.toml src/pieces/*/Cargo.toml src/pieces/Cargo.toml src/periph/*/Cargo.toml svd/Cargo.toml
sed -i '/\[.*\]/h;/version = "=.*"/{x;s/\[.*drone-tisl-map-.*\]/version = "={{version}}"/;t;x}' \
Cargo.toml src/pieces/*/Cargo.toml src/pieces/Cargo.toml src/periph/*/Cargo.toml
sed -i '/\[.*\]/h;/version = ".*"/{x;s/\[.*drone-core\]/version = "{{drone-core-version}}"/;t;x}' \
Cargo.toml src/pieces/*/Cargo.toml src/pieces/Cargo.toml src/periph/*/Cargo.toml
sed -i '/\[.*\]/h;/version = ".*"/{x;s/\[.*drone-cortexm\]/version = "{{drone-cortexm-version}}"/;t;x}' \
Cargo.toml src/pieces/*/Cargo.toml src/pieces/Cargo.toml src/periph/*/Cargo.toml
sed -i '/\[.*\]/h;/version = ".*"/{x;s/\[.*drone-svd\]/version = "{{drone-svd-version}}"/;t;x}' \
svd/Cargo.toml
sed -i 's/\(drone-tisl-map.*\)version = "[^"]\+"/\1version = "{{version}}"/' \
src/lib.rs
# Publish to crates.io
publish:
cd svd && cargo publish
sleep 30
cd src/pieces/1 && drone env {{target}} -- cargo publish
cd src/pieces/2 && drone env {{target}} -- cargo publish
cd src/pieces/3 && drone env {{target}} -- cargo publish
cd src/pieces/4 && drone env {{target}} -- cargo publish
cd src/pieces/5 && drone env {{target}} -- cargo publish
cd src/pieces/6 && drone env {{target}} -- cargo publish
cd src/pieces/7 && drone env {{target}} -- cargo publish
cd src/pieces/8 && drone env {{target}} -- cargo publish
cd src/pieces/9 && drone env {{target}} -- cargo publish
cd src/pieces/10 && drone env {{target}} -- cargo publish
cd src/pieces/11 && drone env {{target}} -- cargo publish
cd src/pieces/12 && drone env {{target}} -- cargo publish
sleep 30
cd src/pieces && drone env {{target}} -- cargo publish
sleep 30
cd src/periph/gpio && drone env {{target}} -- cargo publish
cd src/periph/ioc && drone env {{target}} -- cargo publish
cd src/periph/sysctrl && drone env {{target}} -- cargo publish
cd src/periph/tim && drone env {{target}} -- cargo publish
cd src/periph/uart && drone env {{target}} -- cargo publish
sleep 30
drone env {{target}} -- cargo publish --features "{{features}}"