forked from JustArchiNET/ArchiSteamFarm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcc.sh
executable file
·55 lines (41 loc) · 1.01 KB
/
cc.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
49
50
51
52
53
54
55
#!/bin/bash
set -eu
PROJECT="ArchiSteamFarm"
OUT="out/source"
SOLUTION="${PROJECT}.sln"
CONFIGURATION="Release"
CLEAN=0
PRINT_USAGE() {
echo "Usage: $0 [--clean] [debug/release]"
exit 1
}
for ARG in "$@"; do
case "$ARG" in
release|Release) CONFIGURATION="Release" ;;
debug|Debug) CONFIGURATION="Debug" ;;
--clean) CLEAN=1 ;;
*) PRINT_USAGE
esac
done
if ! hash dotnet &>/dev/null; then
echo "ERROR: dotnet CLI tools are not installed!"
exit 1
fi
dotnet --info
cd "$(dirname "$(readlink -f "$0")")"
if [[ -d ".git" ]] && hash git &>/dev/null; then
git pull || true
fi
if [[ ! -f "$SOLUTION" ]]; then
echo "ERROR: $SOLUTION could not be found!"
exit 1
fi
if [[ "$CLEAN" -eq 1 ]]; then
dotnet clean -c "$CONFIGURATION" -o "$OUT"
rm -rf "ArchiSteamFarm/${OUT}" "ArchiSteamFarm.Tests/${OUT}"
fi
dotnet restore
dotnet build -c "$CONFIGURATION" -o "$OUT" --no-restore /nologo
dotnet test ArchiSteamFarm.Tests -c "$CONFIGURATION" -o "$OUT" --no-build --no-restore
echo
echo "Compilation finished successfully! :)"