2016-03-29 20:58:18 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -eu
|
|
|
|
|
2017-06-26 03:14:44 +00:00
|
|
|
PROJECT="ArchiSteamFarm"
|
2017-08-31 05:54:07 +00:00
|
|
|
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
|
2017-08-31 05:54:07 +00:00
|
|
|
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
|
|
|
|
2017-08-31 05:54:07 +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
|
2016-07-15 19:48:39 +00:00
|
|
|
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
|
2017-08-31 05:54:07 +00:00
|
|
|
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
|
2017-08-31 05:54:07 +00:00
|
|
|
|
|
|
|
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! :)"
|