5 echo "Builds the NuGet packages from the binaries that were built in the Build product binaries step."
6 echo "Usage: build-packages [arch] [configuration]"
7 echo "arch can be x64, x86, arm, arm64 (default is x64)"
8 echo "configuration can be release, checked, debug (default is debug)"
13 __ProjectRoot="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
14 build_packages_log=$__ProjectRoot/build-packages.log
15 binclashlog=$__ProjectRoot/binclash.log
16 binclashloggerdll=$__ProjectRoot/Tools/Microsoft.DotNet.Build.Tasks.dll
17 RuntimeOS=ubuntu.$VERSION_ID
19 __MSBuildPath=$__ProjectRoot/Tools/MSBuild.exe
27 echo -e "Running build-packages.sh $allargs" > $build_packages_log
29 if [ "$allargs" == "-h" ] || [ "$allargs" == "--help" ]; then
38 lowerI="$(echo $1 | awk '{print tolower($0)}')"
72 # Use uname to determine what the OS is.
100 echo "Unsupported OS $OSName detected, configuring as if for Linux"
105 if [ "$__BuildOS" == "Linux" ]; then
106 if [ ! -e /etc/os-release ]; then
107 echo "WARNING: Can not determine runtime id for current distro."
108 export __DistroRid=""
110 source /etc/os-release
111 export __DistroRid="$ID.$VERSION_ID-$__BuildArch"
115 __IntermediatesDir="$__ProjectRoot/bin/obj/$__BuildOS.$__BuildArch.$__BuildType"
117 # Ensure that MSBuild is available
118 echo "Running init-tools.sh"
119 $__ProjectRoot/init-tools.sh
121 echo "Generating nuget packages for "$__BuildOS
124 $__ProjectRoot/Tools/corerun "$__MSBuildPath" /nologo "$__ProjectRoot/src/.nuget/Microsoft.NETCore.Runtime.CoreCLR/Microsoft.NETCore.Runtime.CoreCLR.builds" /verbosity:minimal "/fileloggerparameters:Verbosity=normal;LogFile=$binclashlog" /t:Build /p:__BuildOS=$__BuildOS /p:__BuildArch=$__BuildArch /p:__BuildType=$__BuildType /p:__IntermediatesDir=$__IntermediatesDir /p:BuildNugetPackage=false /p:UseSharedCompilation=false
126 if [ $? -ne 0 ]; then
127 echo -e "\nAn error occurred. Aborting build-packages.sh ." >> $build_packages_log
128 echo "ERROR: An error occurred while building packages, see $build_packages_log for more details."
132 # Build the JIT packages
133 $__ProjectRoot/Tools/corerun "$__MSBuildPath" /nologo "$__ProjectRoot/src/.nuget/Microsoft.NETCore.Jit/Microsoft.NETCore.Jit.builds" /verbosity:minimal "/fileloggerparameters:Verbosity=normal;LogFile=$binclashlog" /t:Build /p:__BuildOS=$__BuildOS /p:__BuildArch=$__BuildArch /p:__BuildType=$__BuildType /p:__IntermediatesDir=$__IntermediatesDir /p:BuildNugetPackage=false /p:UseSharedCompilation=false
135 if [ $? -ne 0 ]; then
136 echo -e "\nAn error occurred. Aborting build-packages.sh ." >> $build_packages_log
137 echo "ERROR: An error occurred while building packages, see $build_packages_log for more details."
141 # Build the ILAsm package
142 $__ProjectRoot/Tools/corerun "$__MSBuildPath" /nologo "$__ProjectRoot/src/.nuget/Microsoft.NETCore.ILAsm/Microsoft.NETCore.ILAsm.builds" /verbosity:minimal "/fileloggerparameters:Verbosity=normal;LogFile=$binclashlog" /t:Build /p:__BuildOS=$__BuildOS /p:__BuildArch=$__BuildArch /p:__BuildType=$__BuildType /p:__IntermediatesDir=$__IntermediatesDir /p:BuildNugetPackage=false /p:UseSharedCompilation=false
144 if [ $? -ne 0 ]; then
145 echo -e "\nAn error occurred. Aborting build-packages.sh ." >> $build_packages_log
146 echo "ERROR: An error occurred while building packages, see $build_packages_log for more details."
150 # Build the ILDAsm package
151 $__ProjectRoot/Tools/corerun "$__MSBuildPath" /nologo "$__ProjectRoot/src/.nuget/Microsoft.NETCore.ILDAsm/Microsoft.NETCore.ILDAsm.builds" /verbosity:minimal "/fileloggerparameters:Verbosity=normal;LogFile=$binclashlog" /t:Build /p:__BuildOS=$__BuildOS /p:__BuildArch=$__BuildArch /p:__BuildType=$__BuildType /p:__IntermediatesDir=$__IntermediatesDir /p:BuildNugetPackage=false /p:UseSharedCompilation=false
153 if [ $? -ne 0 ]; then
154 echo -e "\nAn error occurred. Aborting build-packages.sh ." >> $build_packages_log
155 echo "ERROR: An error occurred while building packages, see $build_packages_log for more details."
159 echo "Done building packages."
160 echo -e "\nDone building packages." >> $build_packages_log