This repository has been archived by the owner on Jul 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbuild.sh
50 lines (37 loc) · 1.5 KB
/
build.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
#!/usr/bin/env bash
NOINIT=0
BUILD_ARGUMENTS=()
for i in "$@"; do
case $(echo $1 | awk '{print tolower($0)}') in
-noinit) NOINIT=1;;
*) BUILD_ARGUMENTS+=("$1") ;;
esac
shift
done
set -eo pipefail
SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
###########################################################################
# CONFIGURATION
###########################################################################
NUGET_VERSION="latest"
SOLUTION_DIRECTORY="$SCRIPT_DIR/../AirBender"
BUILD_PROJECT_FILE="$SCRIPT_DIR/./build/.build.csproj"
BUILD_EXE_FILE="$SCRIPT_DIR/./build/bin/Debug/.build.exe"
TEMP_DIRECTORY="$SCRIPT_DIR/.tmp"
NUGET_URL="https://dist.nuget.org/win-x86-commandline/$NUGET_VERSION/nuget.exe"
NUGET_FILE="$TEMP_DIRECTORY/nuget.exe"
export NUGET_EXE="$NUGET_FILE"
###########################################################################
# PREPARE BUILD
###########################################################################
if ! ((NOINIT)); then
mkdir -p "$TEMP_DIRECTORY"
if [ ! -f "$NUGET_FILE" ]; then curl -Lsfo "$NUGET_FILE" $NUGET_URL;
elif [ $NUGET_VERSION == "latest" ]; then mono "$NUGET_FILE" update -Self; fi
mono "$NUGET_FILE" restore "$BUILD_PROJECT_FILE" -SolutionDirectory $SOLUTION_DIRECTORY
fi
msbuild "$BUILD_PROJECT_FILE"
###########################################################################
# EXECUTE BUILD
###########################################################################
mono "$BUILD_EXE_FILE" ${BUILD_ARGUMENTS[@]}