forked from knurling-rs/app-template
-
Notifications
You must be signed in to change notification settings - Fork 11
/
ci.sh
executable file
·48 lines (35 loc) · 1.14 KB
/
ci.sh
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
#!/bin/sh
set -e
project="test-app"
cleanup() {
echo "Cleaning up"
mv Cargo.toml.tmp Cargo.toml
mv .cargo/config.toml.tmp .cargo/config.toml
}
if [ "$1" = "cleanup" ]; then
cleanup
exit 1
fi
echo "Installing necessary tools"
cargo install flip-link sd
echo "Cleaning up old project"
rm -rf "$project"
echo "Creating new project"
# cargo generate -p . --name "$project"
mkdir -p "$project"
cp -r Cargo.toml LICENSE-* src/ rust-toolchain.toml .cargo/ "$project"
echo "Storing current config so that the child project will compile."
mv Cargo.toml Cargo.toml.tmp
mv .cargo/config.toml .cargo/config.toml.tmp
cd "$project"
echo "Performing steps"
sd -s -- '--chip $CHIP' '--chip nRF52840_xxAA' .cargo/config.toml
sd -s '# target = "thumbv7em-none-eabihf"' 'target = "thumbv7em-none-eabihf"' .cargo/config.toml
sd -s '$RTIC_BACKEND' 'thumbv7-backend' Cargo.toml
sd -s 'some-hal = "1.2.3"' 'nrf52840-hal = "0.16.0"' Cargo.toml
sd -s 'use some_hal as _;' 'use nrf52840_hal as _;' src/lib.rs
sd -s 'some_hal::pac' 'nrf52840_hal::pac' src/bin/minimal.rs
sd -s 'FreeInterrupt1, ...' 'SWI0_EGU0' src/bin/minimal.rs
cargo bbr minimal
cd ..
cleanup