-
Notifications
You must be signed in to change notification settings - Fork 2
/
build
executable file
·64 lines (52 loc) · 1.36 KB
/
build
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/sh
set -e
arg0=""
remainingArgs=""
if [ $# -gt 0 ]; then
arg0="$1"
fi
if [ $# -gt 1 ]; then
skippedFirst=false
for i in "$@"; do
if $skippedFirst; then
remainingArgs="$remainingArgs $i"
else
skippedFirst=true
fi
done
fi
nugetVersion="4.1.0"
useExperimental=false
rootDir=$(dirname $0)
buildDir="$rootDir/.build"
toolsDir="$buildDir/tools"
packagesDir="$buildDir/lib/nuget"
nugetExe="$toolsDir/nuget/$nugetVersion/NuGet.exe"
packagesConfigFile="$rootDir/packages.config"
cakeVersion="$(sed -nE "s|\s*<package\s+id=\"Cake\"\s+version=\"(.+)\"\s*/>\s*|\1|p" $packagesConfigFile)"
cakeExe="$packagesDir/Cake.$cakeVersion/Cake.exe"
nugetDir="$(dirname $nugetExe)"
if [ ! -d "$nugetDir" ]; then
mkdir -p "$nugetDir"
fi
if [ ! -f "$nugetExe" ]; then
curl -L "https://dist.nuget.org/win-x86-commandline/v${nugetVersion}/nuget.exe" --output "$nugetExe"
fi
mono "$nugetExe" install "$packagesConfigFile" -OutputDirectory "$packagesDir"
cakeArgs=""
if [ -n "$arg0" ]; then
case $arg0 in
-*)
cakeArgs="$cakeArgs $arg0"
;;
*)
cakeArgs="$cakeArgs --target=$arg0"
;;
esac
fi
if $useExperimental; then
cakeArgs="$cakeArgs --experimental"
fi
echo "CAKE: mono $cakeExe $cakeArgs $remainingArgs"
mono "$cakeExe" $cakeArgs $remainingArgs
exit $?