Skip to content
This repository was archived by the owner on Feb 1, 2024. It is now read-only.

Commit 156d8c3

Browse files
committed
Backport justfile from main to 1-3
This justfile contains 'build', 'lint', 'fix', and 'clean', which currently only function for the Rust code. Signed-off-by: Shawn T. Amundson <amundson@bitwise.io>
1 parent 2315d30 commit 156d8c3

File tree

1 file changed

+114
-0
lines changed

1 file changed

+114
-0
lines changed

justfile

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# Copyright 2018-2020 Cargill Incorporated
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
16+
crates := '\
17+
validator \
18+
adm \
19+
perf/sawtooth_perf \
20+
perf/smallbank_workload \
21+
perf/intkey_workload \
22+
perf/sawtooth_workload \
23+
families/settings/sawtooth_settings \
24+
families/identity/sawtooth_identity \
25+
families/battleship \
26+
families/block_info/sawtooth_block_info \
27+
families/smallbank/smallbank_rust \
28+
'
29+
30+
features := '\
31+
--features=experimental \
32+
--features=stable \
33+
--features=default \
34+
--no-default-features \
35+
'
36+
37+
build:
38+
#!/usr/bin/env sh
39+
set -e
40+
for feature in $(echo {{features}})
41+
do
42+
for crate in $(echo {{crates}})
43+
do
44+
cmd="cargo build --tests --manifest-path=$crate/Cargo.toml $feature"
45+
echo "\033[1m$cmd\033[0m"
46+
$cmd
47+
done
48+
done
49+
echo "\n\033[92mBuild Success\033[0m\n"
50+
51+
clean:
52+
#!/usr/bin/env sh
53+
set -e
54+
for crate in $(echo {{crates}})
55+
do
56+
cmd="cargo clean --manifest-path=$crate/Cargo.toml"
57+
echo "\033[1m$cmd\033[0m"
58+
$cmd
59+
cmd="rm -f $crate/Cargo.lock"
60+
echo "\033[1m$cmd\033[0m"
61+
$cmd
62+
done
63+
64+
fix:
65+
#!/usr/bin/env sh
66+
set -e
67+
for crate in $(echo {{crates}})
68+
do
69+
for feature in $(echo {{features}})
70+
do
71+
cmd="cargo fix --manifest-path=$crate/Cargo.toml $feature"
72+
echo "\033[1m$cmd\033[0m"
73+
$cmd
74+
done
75+
done
76+
echo "\n\033[92mFix Success\033[0m\n"
77+
78+
lint:
79+
#!/usr/bin/env sh
80+
set -e
81+
for crate in $(echo {{crates}})
82+
do
83+
cmd="cargo fmt --manifest-path=$crate/Cargo.toml -- --check"
84+
echo "\033[1m$cmd\033[0m"
85+
$cmd
86+
done
87+
for crate in $(echo {{crates}})
88+
do
89+
for feature in $(echo {{features}})
90+
do
91+
cmd="cargo clippy --manifest-path=$crate/Cargo.toml $feature -- -D warnings"
92+
echo "\033[1m$cmd\033[0m"
93+
$cmd
94+
done
95+
done
96+
echo "\n\033[92mLint Success\033[0m\n"
97+
98+
99+
test:
100+
#!/usr/bin/env sh
101+
set -e
102+
for feature in $(echo {{features}})
103+
do
104+
for crate in $(echo {{crates}})
105+
do
106+
cmd="cargo build --tests --manifest-path=$crate/Cargo.toml $feature"
107+
echo "\033[1m$cmd\033[0m"
108+
$cmd
109+
cmd="cd $crate && cargo test $feature"
110+
echo "\033[1m$cmd\033[0m"
111+
(eval $cmd)
112+
done
113+
done
114+
echo "\n\033[92mTest Success\033[0m\n"

0 commit comments

Comments
 (0)