summaryrefslogtreecommitdiff
path: root/build-packages.sh
diff options
context:
space:
mode:
authorwtgodbe <wigodbe@microsoft.com>2016-04-27 14:35:45 -0700
committerwtgodbe <wigodbe@microsoft.com>2016-05-17 14:06:39 -0700
commit8568bf1d9722657c602a1f1fe0148e28a93ea8ce (patch)
treed784a4438e3fe7b74106f1d3e82aa88889024fc4 /build-packages.sh
parent41a4ad5054cf877db6aa331855b43ad8678a93ad (diff)
downloadcoreclr-8568bf1d9722657c602a1f1fe0148e28a93ea8ce.tar.gz
coreclr-8568bf1d9722657c602a1f1fe0148e28a93ea8ce.tar.bz2
coreclr-8568bf1d9722657c602a1f1fe0148e28a93ea8ce.zip
Add dev workflow scripts for build pipeline
Diffstat (limited to 'build-packages.sh')
-rwxr-xr-xbuild-packages.sh148
1 files changed, 148 insertions, 0 deletions
diff --git a/build-packages.sh b/build-packages.sh
new file mode 100755
index 0000000000..471b9ef819
--- /dev/null
+++ b/build-packages.sh
@@ -0,0 +1,148 @@
+#!/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 [arch] [configuration]"
+ echo "arch can be x64, x86, arm, arm64 (default is x64)"
+ echo "configuration can be release, checked, debug (default is debug)"
+ echo
+ exit 1
+}
+
+__ProjectRoot="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+build_packages_log=$__ProjectRoot/build-packages.log
+binclashlog=$__ProjectRoot/binclash.log
+binclashloggerdll=$__ProjectRoot/Tools/Microsoft.DotNet.Build.Tasks.dll
+RuntimeOS=ubuntu.$VERSION_ID
+
+__MSBuildPath=$__ProjectRoot/Tools/MSBuild.exe
+
+# Parse arguments
+__BuildArch=x64
+__BuildType=Debug
+
+allargs="$@"
+
+echo -e "Running build-packages.sh $allargs" > $build_packages_log
+
+if [ "$allargs" == "-h" ] || [ "$allargs" == "--help" ]; then
+ usage
+fi
+
+while :; do
+ if [ $# -le 0 ]; then
+ break
+ fi
+
+ lowerI="$(echo $1 | awk '{print tolower($0)}')"
+ case $lowerI in
+ -\?|-h|--help)
+ usage
+ exit 1
+ ;;
+
+ x86)
+ __BuildArch=x86
+ ;;
+
+ x64)
+ __BuildArch=x64
+ ;;
+
+ arm)
+ __BuildArch=arm
+ ;;
+
+ arm64)
+ __BuildArch=arm64
+ ;;
+ debug)
+ __BuildType=Debug
+ ;;
+ release)
+ __BuildType=Release
+ ;;
+ checked)
+ __BuildType=Checked
+ esac
+ shift
+done
+
+# Use uname to determine what the OS is.
+OSName=$(uname -s)
+case $OSName in
+ Linux)
+ __BuildOS=Linux
+ ;;
+
+ Darwin)
+ __BuildOS=OSX
+ ;;
+
+ FreeBSD)
+ __BuildOS=FreeBSD
+ ;;
+
+ OpenBSD)
+ __BuildOS=OpenBSD
+ ;;
+
+ NetBSD)
+ __BuildOS=NetBSD
+ ;;
+
+ SunOS)
+ __BuildOS=SunOS
+ ;;
+
+ *)
+ echo "Unsupported OS $OSName detected, configuring as if for Linux"
+ __BuildOS=Linux
+ ;;
+esac
+
+if [ "$__BuildOS" == "Linux" ]; then
+ # Detect Distro
+ if [ "$(cat /etc/*-release | grep -cim1 ubuntu)" -eq 1 ]; then
+ export __DistroName=ubuntu
+ elif [ "$(cat /etc/*-release | grep -cim1 centos)" -eq 1 ]; then
+ export __DistroName=rhel
+ elif [ "$(cat /etc/*-release | grep -cim1 rhel)" -eq 1 ]; then
+ export __DistroName=rhel
+ elif [ "$(cat /etc/*-release | grep -cim1 debian)" -eq 1 ]; then
+ export __DistroName=debian
+ else
+ export __DistroName=""
+ fi
+fi
+
+__IntermediatesDir="$__ProjectRoot/bin/obj/$__BuildOS.$__BuildArch.$__BuildType"
+
+# Ensure that MSBuild is available
+echo "Running init-tools.sh"
+$__ProjectRoot/init-tools.sh
+
+ echo "Generating nuget packages for "$__BuildOS
+
+ # Invoke MSBuild
+ $__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
+
+if [ $? -ne 0 ]; then
+ echo -e "\nAn error occurred. Aborting build-packages.sh ." >> $build_packages_log
+ echo "ERROR: An error occurred while building packages, see $build_packages_log for more details."
+ exit 1
+fi
+
+ # Build the JIT packages
+ $__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
+
+if [ $? -ne 0 ]; then
+ echo -e "\nAn error occurred. Aborting build-packages.sh ." >> $build_packages_log
+ echo "ERROR: An error occurred while building packages, see $build_packages_log for more details."
+ exit 1
+fi
+
+echo "Done building packages."
+echo -e "\nDone building packages." >> $build_packages_log
+exit 0 \ No newline at end of file