Disable outdated test until it is updated
[platform/upstream/coreclr.git] / build-packages.sh
1 #!/usr/bin/env bash
2
3 usage()
4 {
5     echo "Builds the NuGet packages from the binaries that were built in the Build product binaries step."
6     echo "Usage: build-packages -BuildArch -BuildType"
7     echo "BuildArch can be x64, x86, arm, arm64 (default is x64)"
8     echo "BuildType can be release, checked, debug (default is debug)"
9     echo
10     exit 1
11 }
12
13 initHostDistroRid()
14 {
15     __HostDistroRid=""
16     if [ "$__HostOS" == "Linux" ]; then
17         if [ -e /etc/os-release ]; then
18             source /etc/os-release
19             if [[ $ID == "rhel" ]]; then
20                 # remove the last version digit
21                 VERSION_ID=${VERSION_ID%.*}
22             fi
23             __HostDistroRid="$ID.$VERSION_ID-$__Arch"
24             if [[ $ID == "alpine" ]]; then
25                 __HostDistroRid="linux-musl-$__Arch"
26             fi
27         elif [ -e /etc/redhat-release ]; then
28             local redhatRelease=$(</etc/redhat-release)
29             if [[ $redhatRelease == "CentOS release 6."* || $redhatRelease == "Red Hat Enterprise Linux Server release 6."* ]]; then
30                __HostDistroRid="rhel.6-$__Arch"
31             fi
32             if [[ $redhatRelease == "CentOS Linux release 7."* ]]; then
33                 __HostDistroRid="rhel.7-$__Arch"
34             fi
35         fi
36     fi
37     if [ "$__HostOS" == "FreeBSD" ]; then
38         __freebsd_version=`sysctl -n kern.osrelease | cut -f1 -d'.'`
39         __HostDistroRid="freebsd.$__freebsd_version-$__Arch"
40     fi
41
42     if [ "$__HostDistroRid" == "" ]; then
43         echo "WARNING: Cannot determine runtime id for current distro."
44     fi
45 }
46
47 __ProjectRoot="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
48 __IsPortableBuild=1
49
50 # Use uname to determine what the OS is.
51 OSName=$(uname -s)
52 case $OSName in
53     Linux)
54         __BuildOS=Linux
55         __HostOS=Linux
56         ;;
57
58     Darwin)
59         __BuildOS=OSX
60         __HostOS=OSX
61         ;;
62
63     FreeBSD)
64         __BuildOS=FreeBSD
65         __HostOS=FreeBSD
66         ;;
67
68     OpenBSD)
69         __BuildOS=OpenBSD
70         __HostOS=OpenBSD
71         ;;
72
73     NetBSD)
74         __BuildOS=NetBSD
75         __HostOS=NetBSD
76         ;;
77
78     SunOS)
79         __BuildOS=SunOS
80         __HostOS=SunOS
81         ;;
82
83     *)
84         echo "Unsupported OS $OSName detected, configuring as if for Linux"
85         __BuildOS=Linux
86         __HostOS=Linux
87         ;;
88 esac
89
90 unprocessedBuildArgs=
91
92 while :; do
93     if [ $# -le 0 ]; then
94         break
95     fi
96
97     case "$1" in
98         -\?|-h|--help)
99         usage
100         exit 1
101         ;;
102         -BuildArch=*)
103         unprocessedBuildArgs="$unprocessedBuildArgs $1"
104         __Arch=$(echo $1| cut -d'=' -f 2)
105         ;;
106
107         -portablebuild=false)
108             unprocessedBuildArgs="$unprocessedBuildArgs $1"
109             __IsPortableBuild=0
110             ;;
111         *)
112         unprocessedBuildArgs="$unprocessedBuildArgs $1"
113     esac
114     shift
115 done
116
117 # Portable builds target the base RID
118 if [ $__IsPortableBuild == 1 ]; then
119     if [ "$__BuildOS" == "Linux" ]; then
120         export __DistroRid="linux-$__Arch"
121     elif [ "$__BuildOS" == "OSX" ]; then
122         export __DistroRid="osx-$__Arch"
123     elif [ "$__BuildOS" == "FreeBSD" ]; then
124         export __DistroRid="freebsd-$__Arch"
125     fi
126 else
127     # init the host distro name
128     initHostDistroRid
129     export __DistroRid="$__HostDistroRid"
130 fi
131
132 $__ProjectRoot/run.sh build-packages -Project=$__ProjectRoot/src/.nuget/packages.builds -DistroRid=$__DistroRid -UseSharedCompilation=false -BuildNugetPackage=false -MsBuildEventLogging="/l:BinClashLogger,Tools/Microsoft.DotNet.Build.Tasks.dll;LogFile=binclash.log" $unprocessedBuildArgs
133 if [ $? -ne 0 ]
134 then
135     echo "ERROR: An error occurred while building packages; See build-packages.log for more details."
136     exit 1
137 fi
138
139 echo "Done building packages."
140 exit 0