-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.sh
executable file
·64 lines (56 loc) · 1.93 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
## Parameters
Target=
Configuration="Release"
Version=
# "Quiet", "Minimal", "Normal", "Verbose", "Diagnostic"
Verbosity=
ShowDescription=false
Pre=false
ScriptArgs=
>&2 echo "Preparing to run build script..."
ScriptDir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
ToolsDir="$ScriptDir/tools"
Script="$ScriptDir/build.cake"
if [[ $OSTYPE == 'darwin'* ]]; then
>&2 echo "Running on macOS!"
Runtime="osx-x64"
else
>&2 echo "Running on Linux!"
Runtime="linux-x64"
fi
if [ -z "$(which dotnet)" ]; then
>&2 echo "You must install dotnet to use this build script -- https://dotnet.microsoft.com/en-us/download"
exit 1
fi
if [ -z "$(which nuget)" ]; then
>&2 echo "You must install nuget to use this build script -- https://www.nuget.org/downloads"
exit 1
fi
## Make sure tools folder exists
if [ ! -d "$ToolsDir" ]; then
mkdir -p $ToolsDir
fi
>&2 echo "Installing Cake.Tool..."
if [ -z "$(dotnet tool list --tool-path $ToolsDir | grep cake.tool)" ]; then
dotnet tool install Cake.Tool --version 2.2.0 --tool-path "$ToolsDir"
else
>&2 echo "Cake.Tool already installed"
fi
if [ $? -ne 0 ]; then
exit $?
fi
## Build Cake arguments
CakeArguments="$Script --runtime=$Runtime"
if [ ! -z "$Target" ]; then CakeArguments="$CakeArguments --target=$Target"; fi
if [ ! -z "$Configuration" ]; then CakeArguments="$CakeArguments --configuration=$Configuration"; fi
if [ ! -z "$Version" ]; then CakeArguments="$CakeArguments --version=$Version"; fi
if [ ! -z "$Verbosity" ]; then CakeArguments="$CakeArguments --verbosity=$Verbosity"; fi
if $ShowDescription; then CakeArguments="$CakeArguments --showdescription"; fi
if $Pre; then CakeArguments="$CakeArguments --pre=true"; fi
if [ ! -z "$ScriptArgs" ]; then CakeArguments="$CakeArguments $ScriptArgs"; fi
# Start Cake
>&2 echo "Running build script for SCALUS..."
>&2 echo "cake $CakeArguments"
CakeCommand="$ToolsDir/dotnet-cake $CakeArguments"
eval "$CakeCommand"