Files
ArchiSteamFarm/cc.sh

51 lines
862 B
Bash
Raw Normal View History

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