-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·46 lines (36 loc) · 899 Bytes
/
build.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
#!/bin/bash
set -eo pipefail
USAGE="Usage: $0 [OPTIONS]
Build the Rust playlist tool.
OPTIONS: All options are optional
--help
Display these instructions.
--verbose
Display commands being executed."
# Import common functions
DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=./common.sh
source "$DIR/common.sh"
while [ $# -gt 0 ]; do
case "$1" in
--help)
echo "$USAGE"
exit 1
;;
--verbose)
set -x
;;
esac
shift
done
if [ -z "$(command -v cargo)" ]; then
print_error_and_exit "Cargo not found in path. Maybe install rustup?"
fi
cd "$REPO_ROOT"
cargo build --release
executable=$(get_rust_executable_name)
echo "executable: $executable"
rm -f "$executable"
mv ./target/release/"$executable" "$executable"
./"$executable" --version
./"$executable" -h || :