blob: 1c36dfb4f3ed671bd4366366c145a55027d05f2a (
plain)
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
|
#!/usr/bin/env bash
usage()
{
echo "Builds the NuGet packages from the binaries that were built in the Build product binaries step."
echo "Usage: build-packages -BuildArch -BuildType"
echo "BuildArch can be x64, x86, arm, arm64 (default is x64)"
echo "BuildType can be release, checked, debug (default is debug)"
echo
exit 1
}
initHostDistroRid()
{
__HostDistroRid=""
if [ "$__HostOS" == "Linux" ]; then
if [ -e /etc/os-release ]; then
source /etc/os-release
if [[ $ID == "rhel" ]]; then
# remove the last version digit
VERSION_ID=${VERSION_ID%.*}
fi
__HostDistroRid="$ID.$VERSION_ID-$__Arch"
if [[ $ID == "alpine" ]]; then
__HostDistroRid="linux-musl-$__Arch"
fi
elif [ -e /etc/redhat-release ]; then
local redhatRelease=$(</etc/redhat-release)
if [[ $redhatRelease == "CentOS release 6."* || $redhatRelease == "Red Hat Enterprise Linux Server release 6."* ]]; then
__HostDistroRid="rhel.6-$__Arch"
fi
if [[ $redhatRelease == "CentOS Linux release 7."* ]]; then
__HostDistroRid="rhel.7-$__Arch"
fi
fi
fi
if [ "$__HostOS" == "FreeBSD" ]; then
__freebsd_version=`sysctl -n kern.osrelease | cut -f1 -d'.'`
__HostDistroRid="freebsd.$__freebsd_version-$__Arch"
fi
if [ "$__HostDistroRid" == "" ]; then
echo "WARNING: Cannot determine runtime id for current distro."
fi
}
__ProjectRoot="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
__IsPortableBuild=1
# Use uname to determine what the OS is.
OSName=$(uname -s)
case $OSName in
Linux)
__BuildOS=Linux
__HostOS=Linux
;;
Darwin)
__BuildOS=OSX
__HostOS=OSX
;;
FreeBSD)
__BuildOS=FreeBSD
__HostOS=FreeBSD
;;
OpenBSD)
__BuildOS=OpenBSD
__HostOS=OpenBSD
;;
NetBSD)
__BuildOS=NetBSD
__HostOS=NetBSD
;;
SunOS)
__BuildOS=SunOS
__HostOS=SunOS
;;
*)
echo "Unsupported OS $OSName detected, configuring as if for Linux"
__BuildOS=Linux
__HostOS=Linux
;;
esac
buildArgs=
unprocessedBuildArgs=
# TODO: get rid of argument processing entirely once we remove the
# uses of -Arg=Value style in buildpipeline.
while :; do
if [ $# -le 0 ]; then
break
fi
case "$1" in
-\?|-h|--help)
usage
exit 1
;;
-BuildArch=*)
__Arch=$(echo $1| cut -d'=' -f 2)
buildArgs="$buildArgs /p:__BuildArch=$__Arch"
;;
-BuildType=*)
__Type=$(echo $1| cut -d'=' -f 2)
buildArgs="$buildArgs /p:__BuildType=$__Type"
;;
-OfficialBuildId=*)
__Id=$(echo $1| cut -d'=' -f 2)
buildArgs="$buildArgs /p:OfficialBuildId=$__Id"
;;
-__DoCrossArchBuild=*)
__CrossBuild=$(echo $1| cut -d'=' -f 2)
buildArgs="$buildArgs /p:__DoCrossArchBuild=$__CrossBuild"
;;
-portablebuild=false)
buildArgs="$buildArgs /p:PortableBuild=false"
__IsPortableBuild=0
;;
--)
;;
*)
unprocessedBuildArgs="$unprocessedBuildArgs $1"
esac
shift
done
# Portable builds target the base RID
if [ $__IsPortableBuild == 1 ]; then
if [ "$__BuildOS" == "Linux" ]; then
export __DistroRid="linux-$__Arch"
elif [ "$__BuildOS" == "OSX" ]; then
export __DistroRid="osx-$__Arch"
elif [ "$__BuildOS" == "FreeBSD" ]; then
export __DistroRid="freebsd-$__Arch"
fi
else
# init the host distro name
initHostDistroRid
export __DistroRid="$__HostDistroRid"
fi
$__ProjectRoot/dotnet.sh msbuild /nologo /verbosity:minimal /clp:Summary \
/p:__BuildOS=$__BuildOS /flp:v=detailed\;Append\;LogFile=build-packages.log \
/l:BinClashLogger,Tools/Microsoft.DotNet.Build.Tasks.dll\;LogFile=binclash.log \
/p:PortableBuild=true src/.nuget/packages.builds \
/p:__DistroRid=$__DistroRid /p:BuildNugetPackage=false \
$buildArgs $unprocessedBuildArgs
if [ $? -ne 0 ]
then
echo "ERROR: An error occurred while building packages; See build-packages.log for more details."
exit 1
fi
echo "Done building packages."
exit 0
|