forked from dotnet/corefx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·85 lines (67 loc) · 2.67 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/bash
__scriptpath=$(cd "$(dirname "$0")"; pwd -P)
__packageroot=$__scriptpath/packages
__sourceroot=$__scriptpath/src
__nugetpath=$__packageroot/NuGet.exe
__nugetconfig=$__sourceroot/NuGet.Config
__msbuildpackageid="Microsoft.Build.Mono.Debug"
__msbuildpackageversion="14.1.0.0-prerelease"
__msbuildpath=$__packageroot/$__msbuildpackageid.$__msbuildpackageversion/lib/MSBuild.exe
if [ $(uname) == "Linux" ]; then
__monoroot=/usr
else
__monoroot=/Library/Frameworks/Mono.framework/Versions/Current
fi
__referenceassemblyroot=$__monoroot/lib/mono/xbuild-frameworks
__monoversion=$(mono --version | grep "version 4.[1-9]")
if [ $? -ne 0 ]; then
echo "Mono 4.1 or later is required to build corefx. Please see https://github.com/dotnet/corefx/wiki/Building-On-Unix for more details."
exit 1
fi
if [ ! -e "$__referenceassemblyroot/.NETPortable" ]; then
echo "PCL reference assemblies not found. Please see https://github.com/dotnet/corefx/wiki/Building-On-Unix for more details."
exit 1
fi
__buildproj=$__scriptpath/build.proj
__buildlog=$__scriptpath/msbuild.log
# Pull NuGet.exe down if we don't have it already
if [ ! -e "$__nugetpath" ]; then
which curl wget > /dev/null 2> /dev/null
if [ $? -ne 0 -a $? -ne 1 ]; then
echo "cURL or wget is required to build corefx. Please see https://github.com/dotnet/corefx/wiki/Building-On-Unix for more details."
exit 1
fi
echo "Restoring NuGet.exe..."
which wget > /dev/null 2> /dev/null
if [ $? -ne 0 ]; then
curl -sSL --create-dirs -o $__nugetpath https://api.nuget.org/downloads/nuget.exe
else
mkdir -p $__packageroot
wget -q -O $__nugetpath https://api.nuget.org/downloads/nuget.exe
fi
if [ $? -ne 0 ]; then
echo "Failed to restore NuGet.exe."
exit 1
fi
fi
# Grab the MSBuild package if we don't have it already
if [ ! -e "$__msbuildpath" ]; then
echo "Restoring MSBuild..."
mono "$__nugetpath" install $__msbuildpackageid -Version $__msbuildpackageversion -ConfigFile "$__nugetconfig" -OutputDirectory "$__packageroot"
if [ $? -ne 0 ]; then
echo "Failed to restore MSBuild."
exit 1
fi
fi
if [ $(uname) == "Linux" ]; then
__osgroup=Linux
else
__osgroup=OSX
fi
MONO29679=1 ReferenceAssemblyRoot=$__referenceassemblyroot mono $__msbuildpath "$__buildproj" /nologo /verbosity:minimal "/fileloggerparameters:Verbosity=diag;LogFile=$__buildlog" /t:Build /p:OSGroup=$__osgroup /p:UseRoslynCompiler=true /p:COMPUTERNAME=$(hostname) /p:USERNAME=$(id -un) "$@"
BUILDERRORLEVEL=$?
echo
# Pull the build summary from the log file
tail -n 4 "$__buildlog"
echo Build Exit Code = $BUILDERRORLEVEL
exit $BUILDERRORLEVEL