forked from radixdlt/radixdlt-scrypto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
format.sh
executable file
·39 lines (32 loc) · 1.41 KB
/
format.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
#!/bin/bash
set -e
cd "$(dirname "$0")"
# Format all main package crates
(set -x; cargo fmt)
# Format the simulator crate
(set -x; cd simulator; cargo fmt)
# We use a globally loaded scrypto CLI so that this script works even if the code doesn't compile at present
# It's also a little faster. If you wish to use the local version instead, swap out the below line.
# scrypto="cargo run --manifest-path $PWD/simulator/Cargo.toml --bin scrypto $@ --"
scrypto="scrypto"
(
find "assets/blueprints" -mindepth 2 -maxdepth 2 -type f \( -name Cargo.toml \) -print \
| awk '{print substr($1, 1, length($1)-length("Cargo.toml"))}' \
| xargs -n1 -I '{}' bash -c "set -x; $scrypto fmt --path {}"
)
(
find "examples" -mindepth 2 -maxdepth 2 -type f \( -name Cargo.toml \) -print \
| awk '{print substr($1, 1, length($1)-length("Cargo.toml"))}' \
| xargs -n1 -I '{}' bash -c "set -x; $scrypto fmt --path {}"
)
(
find "radix-engine/tests/blueprints" -mindepth 2 -maxdepth 2 -type f \( -name Cargo.toml \) -print \
| awk '{print substr($1, 1, length($1)-length("Cargo.toml"))}' \
| xargs -n1 -I '{}' bash -c "set -x; $scrypto fmt --path {}"
)
(
find "simulator/tests" -mindepth 2 -maxdepth 2 -type f \( -name Cargo.toml \) -print \
| awk '{print substr($1, 1, length($1)-length("Cargo.toml"))}' \
| xargs -n1 -I '{}' bash -c "set -x; $scrypto fmt --path {}"
)
echo "All packages have been formatted."