-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdo.it
More file actions
60 lines (57 loc) · 1.37 KB
/
Copy pathdo.it
File metadata and controls
60 lines (57 loc) · 1.37 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
@ Project builder
build {
@ Build the current project.
opt -r @ Compile optimized release build
$ cargo build --color=always $@
}
release {
@ Build a release version and then pack it
$ cargo build -r --color=always && doit pack
}
clean {
@ Clean Project
$ cargo clean
}
test {
@ Test project
$ cargo test --color=always $@
}
lint {
@ Test project
$ cargo clippy --all-targets --all-features -- -D warnings $@
}
commit {
@ Run all required steps before comitting
$ doit test
$ doit lint
$ git commit
}
pack {
@ Pack the binaries into a zip and tarball
$$$
VER=`./target/release/doit --version | tr '.' '_'`
ZIP="pack/doit_$$VER.elf64.zip"
TAR="pack/doit_$$VER.elf64.tar.gz"
if [ ! -e "./target/release/doit" ] ; then
echo "Please run: \e[93mcargo build -r\e[0m"
exit 1
fi
if [ ! -$$(which zip) ] ; then
echo "Please install Zip: \e[93mapt install zip\e[0m"
exit 1
fi
echo Packing './target/release'
if [ -e ./target/pack ]; then
rm -R ./target/pack
fi
mkdir ./target/pack
cd ./target/release
echo "Zip: \e[93m./target/$$ZIP\e[0m"
zip "../$$ZIP" doit > /dev/null
echo "Tar: \e[93m./target/$$TAR\e[0m"
tar -zcf "../$$TAR" doit > /dev/null
cd - > /dev/null
$$$
}
# Adding the "|| exit" on the end causes the script to propogate the error from the previous command to our script result
tryit:$ cargo build && ./target/debug/doit -t test-files/do.it $@ || exit