Initial build tools for linux

This commit is contained in:
JustArchi 2017-06-26 05:14:44 +02:00
parent c787beb655
commit fb59a37346
2 changed files with 27 additions and 51 deletions

54
cc.sh
View file

@ -1,16 +1,15 @@
#!/bin/bash
set -eu
PROJECT="ArchiSteamFarm"
OUT="out"
MSBUILD_ARGS=("/nologo")
BUILD="Release"
AOT=0
CLEAN=0
XBUILD_ARGS=("/nologo")
BINARIES=("ArchiSteamFarm/bin/Release/ArchiSteamFarm.exe")
SOLUTION="ArchiSteamFarm.sln"
PRINT_USAGE() {
echo "Usage: $0 [--clean] [--aot] [debug/release]"
echo "Usage: $0 [--clean] [debug/release]"
exit 1
}
@ -18,57 +17,34 @@ for ARG in "$@"; do
case "$ARG" in
release|Release) BUILD="Release" ;;
debug|Debug) BUILD="Debug" ;;
--aot) AOT=1 ;;
--clean) CLEAN=1 ;;
*) PRINT_USAGE
esac
done
XBUILD_ARGS+=("/p:Configuration=$BUILD")
if ! hash dotnet &>/dev/null; then
echo "ERROR: dotnet CLI tools are not installed!"
exit 1
fi
cd "$(dirname "$(readlink -f "$0")")"
if [[ -f "mono_envsetup.sh" ]]; then
set +u
source "mono_envsetup.sh"
set -u
fi
if [[ -d ".git" ]] && hash git &>/dev/null; then
git pull || true
fi
if [[ ! -f "$SOLUTION" ]]; then
echo "ERROR: $SOLUTION could not be found!"
if [[ ! -f "${PROJECT}.sln" ]]; then
echo "ERROR: ${PROJECT}.sln could not be found!"
exit 1
fi
# Not needed for ASF, we have packages in-tree
#if hash nuget &>/dev/null; then
# nuget restore "$SOLUTION" || true
#fi
if [[ "$CLEAN" -eq 1 ]]; then
rm -rf out
xbuild "${XBUILD_ARGS[@]}" "/t:Clean" "$SOLUTION"
dotnet clean -c "$BUILD" -o "$OUT"
rm -rf "$OUT"
fi
xbuild "${XBUILD_ARGS[@]}" "$SOLUTION"
if [[ ! -f "${BINARIES[0]}" ]]; then
echo "ERROR: ${BINARIES[0]} binary could not be found!"
fi
# Use Mono AOT for output binaries if needed
if [[ "$AOT" -eq 1 && "$BUILD" = "Release" ]]; then
for BINARY in "${BINARIES[@]}"; do
if [[ ! -f "$BINARY" ]]; then
continue
fi
mono --aot "$BINARY"
done
fi
dotnet restore
dotnet build -c "$BUILD" -o "$OUT" "${MSBUILD_ARGS[@]}"
echo
echo "Compilation finished successfully! :)"

24
run.sh
View file

@ -1,11 +1,13 @@
#!/bin/bash
set -eu
BUILD="Release"
UNTIL_CLEAN_EXIT=0
PROJECT="ArchiSteamFarm"
OUT="out"
BINARY="${OUT}/${PROJECT}.dll"
ASF_ARGS=("")
BUILD="Release"
UNTIL_CLEAN_EXIT=0
PRINT_USAGE() {
echo "Usage: $0 [--until-clean-exit] [--cryptkey=] [--path=] [--server] [debug/release]"
@ -24,15 +26,12 @@ for ARG in "$@"; do
esac
done
cd "$(dirname "$(readlink -f "$0")")"
if [[ -f "mono_envsetup.sh" ]]; then
set +u
source "mono_envsetup.sh"
set -u
if ! hash dotnet &>/dev/null; then
echo "ERROR: dotnet CLI tools are not installed!"
exit 1
fi
BINARY="ArchiSteamFarm/bin/$BUILD/ArchiSteamFarm.exe"
cd "$(dirname "$(readlink -f "$0")")"
if [[ ! -f "$BINARY" ]]; then
echo "ERROR: $BINARY could not be found!"
@ -40,13 +39,14 @@ if [[ ! -f "$BINARY" ]]; then
fi
if [[ "$UNTIL_CLEAN_EXIT" -eq 0 ]]; then
mono "$BINARY" "${ASF_ARGS[@]}"
dotnet exec "$BINARY" "${ASF_ARGS[@]}"
exit $?
fi
while [[ -f "$BINARY" ]]; do
if mono "$BINARY" "${ASF_ARGS[@]}"; then
if dotnet exec "$BINARY" "${ASF_ARGS[@]}"; then
break
fi
sleep 1
done