ArchiSteamFarm/cc.sh

56 lines
1 KiB
Bash
Raw Normal View History

2016-03-29 20:58:18 +00:00
#!/bin/bash
set -eu
2017-06-26 03:14:44 +00:00
PROJECT="ArchiSteamFarm"
OUT="out/source"
SOLUTION="${PROJECT}.sln"
CONFIGURATION="Release"
2017-06-26 03:14:44 +00:00
2016-03-29 20:58:18 +00:00
CLEAN=0
PRINT_USAGE() {
2017-06-26 03:14:44 +00:00
echo "Usage: $0 [--clean] [debug/release]"
2016-03-29 20:58:18 +00:00
exit 1
}
for ARG in "$@"; do
case "$ARG" in
release|Release) CONFIGURATION="Release" ;;
debug|Debug) CONFIGURATION="Debug" ;;
2016-03-29 20:58:18 +00:00
--clean) CLEAN=1 ;;
*) PRINT_USAGE
esac
done
2017-06-26 03:14:44 +00:00
if ! hash dotnet &>/dev/null; then
echo "ERROR: dotnet CLI tools are not installed!"
exit 1
fi
2016-03-29 20:58:18 +00:00
dotnet --info
2016-03-29 20:58:18 +00:00
cd "$(dirname "$(readlink -f "$0")")"
2016-03-29 21:32:12 +00:00
if [[ -d ".git" ]] && hash git &>/dev/null; then
git pull || true
2016-03-29 20:58:18 +00:00
fi
2017-08-31 05:54:25 +00:00
if [[ ! -f "$SOLUTION" ]]; then
echo "ERROR: $SOLUTION could not be found!"
2016-03-29 20:58:18 +00:00
exit 1
fi
if [[ "$CLEAN" -eq 1 ]]; then
dotnet clean -c "$CONFIGURATION" -o "$OUT"
rm -rf "ArchiSteamFarm/${OUT}" "ArchiSteamFarm.Tests/${OUT}"
2016-03-29 20:58:18 +00:00
fi
2017-06-26 03:14:44 +00:00
dotnet restore
dotnet build -c "$CONFIGURATION" -o "$OUT" --no-restore /nologo
dotnet test ArchiSteamFarm.Tests -c "$CONFIGURATION" -o "$OUT" --no-build --no-restore
2016-03-29 20:58:18 +00:00
echo
echo "Compilation finished successfully! :)"