Skip to content

Commit

Permalink
Use run tool in coreclr dev workflow.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lakshmi Priya Sekar committed Jul 30, 2016
1 parent f9350e9 commit f5afe9b
Show file tree
Hide file tree
Showing 17 changed files with 1,246 additions and 1,351 deletions.
45 changes: 11 additions & 34 deletions build-packages.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,61 +2,38 @@
setlocal EnableDelayedExpansion

set "__ProjectDir=%~dp0"
set packagesLog=build-packages.log
set binclashLoggerDll=%~dp0Tools\net45\Microsoft.DotNet.Build.Tasks.dll
set binclashlog=%~dp0binclash.log
echo Running build-packages.cmd %* > %packagesLog%

set options=/nologo /maxcpucount /v:minimal /clp:Summary /nodeReuse:false /flp:v=detailed;Append;LogFile=%packagesLog% /l:BinClashLogger,%binclashLoggerDll%;LogFile=%binclashlog% /p:FilterToOSGroup=Windows_NT
set allargs=%*

if /I [%1] == [/?] goto Usage
if /I [%1] == [/help] goto Usage

REM ensure that msbuild is available
echo Running init-tools.cmd
call %~dp0init-tools.cmd

set __msbuildArgs="%__ProjectDir%\src\.nuget\Microsoft.NETCore.Runtime.CoreClr\Microsoft.NETCore.Runtime.CoreCLR.builds" !allargs!
echo msbuild.exe %__msbuildArgs% !options! >> %packagesLog%
call msbuild.exe %__msbuildArgs% !options!
call %__ProjectDir%/run.cmd build-packages -Project=%__ProjectDir%/src/.nuget/Microsoft.NETCore.Runtime.CoreClr/Microsoft.NETCore.Runtime.CoreCLR.builds -FilterToOSGroup=Windows_NT %allargs%
if NOT [!ERRORLEVEL!]==[0] (
echo ERROR: An error occurred while building packages, see %packagesLog% for more details.
echo ERROR: An error occurred while building CoreCLR Runtime package, see build-packages.log for more details.
exit /b 1
)

set __msbuildArgs="%__ProjectDir%\src\.nuget\Microsoft.NETCore.Jit\Microsoft.NETCore.Jit.builds" !allargs!
echo msbuild.exe %__msbuildArgs% !options! >> %packagesLog%
call msbuild.exe %__msbuildArgs% !options!
call %__ProjectDir%/run.cmd build-packages -Project=%__ProjectDir%/src/.nuget/Microsoft.NETCore.Jit/Microsoft.NETCore.Jit.builds -FilterToOSGroup=Windows_NT %allargs%
if NOT [!ERRORLEVEL!]==[0] (
echo ERROR: An error occurred while building packages, see %packagesLog% for more details.
echo ERROR: An error occurred while building Jit package, see build-packages.log for more details.
exit /b 1
)

rem Build the ILAsm package
set __msbuildArgs="%__ProjectDir%\src\.nuget\Microsoft.NETCore.ILAsm\Microsoft.NETCore.ILAsm.builds" !allargs!
echo msbuild.exe %__msbuildArgs% !options! >> %packagesLog%
call msbuild.exe %__msbuildArgs% !options!
call %__ProjectDir%/run.cmd build-packages -Project=%__ProjectDir%/src/.nuget/Microsoft.NETCore.ILAsm/Microsoft.NETCore.ILAsm.builds -FilterToOSGroup=Windows_NT %allargs%
if NOT [!ERRORLEVEL!]==[0] (
echo ERROR: An error occurred while building packages, see %packagesLog% for more details.
echo ERROR: An error occurred while building ILAsm package, see build-packages.log for more details.
exit /b 1
)

rem Build the ILDAsm package
set __msbuildArgs="%__ProjectDir%\src\.nuget\Microsoft.NETCore.ILDAsm\Microsoft.NETCore.ILDAsm.builds" !allargs!
echo msbuild.exe %__msbuildArgs% !options! >> %packagesLog%
call msbuild.exe %__msbuildArgs% !options!
call %__ProjectDir%/run.cmd build-packages -Project=%__ProjectDir%/src/.nuget/Microsoft.NETCore.ILDAsm/Microsoft.NETCore.ILDAsm.builds -FilterToOSGroup=Windows_NT %allargs%
if NOT [!ERRORLEVEL!]==[0] (
echo ERROR: An error occurred while building packages, see %packagesLog% for more details.
echo ERROR: An error occurred while building ILDAsm package, see build-packages.log for more details.
exit /b 1
)

rem Build the TargetingPack package
set __msbuildArgs="%__ProjectDir%\src\.nuget\Microsoft.TargetingPack.Private.CoreCLR\Microsoft.TargetingPack.Private.CoreCLR.pkgproj" !allargs!
echo msbuild.exe %__msbuildArgs% !options! >> %packagesLog%
call msbuild.exe %__msbuildArgs% !options!
call %__ProjectDir%/run.cmd build-packages -Project=%__ProjectDir%/src/.nuget/Microsoft.TargetingPack.Private.CoreCLR/Microsoft.TargetingPack.Private.CoreCLR.pkgproj -FilterToOSGroup=Windows_NT %allargs%
if NOT [!ERRORLEVEL!]==[0] (
echo ERROR: An error occurred while building packages, see %packagesLog% for more details.
echo ERROR: An error occurred while building CoreCLR TargetingPack package, see build-packages.log for more details.
exit /b 1
)

Expand All @@ -76,7 +53,7 @@ exit /b
echo.
echo Builds the NuGet packages from the binaries that were built in the Build product binaries step.
echo The following properties are required to define build architecture
echo /p:__BuildArch=[architecture] /p:__BuildType=[configuration]
echo -BuildArch=[architecture] -BuildType=[configuration]
echo Architecture can be x64, x86, arm, or arm64
echo Configuration can be Release, Debug, or Checked
exit /b
151 changes: 28 additions & 123 deletions build-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,156 +3,62 @@
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 "Usage: build-packages -BuildArch -BuildType"
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
unprocessedBuildArgs=

while :; do
if [ $# -le 0 ]; then
break
fi

lowerI="$(echo $1 | awk '{print tolower($0)}')"
case $lowerI in
case "$1" 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
usage
exit 1
;;
-BuildArch=*)
unprocessedBuildArgs="$unprocessedBuildArgs $1"
__Arch=$(echo $1| cut -d'=' -f 2)
;;
*)
unprocessedBuildArgs="$unprocessedBuildArgs $1"
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
if [ ! -e /etc/os-release ]; then
echo "WARNING: Can not determine runtime id for current distro."
export __DistroRid=""
else
source /etc/os-release
export __DistroRid="$ID.$VERSION_ID-$__BuildArch"
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/dotnetcli/dotnet "$__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."
$__ProjectRoot/run.sh build-packages -Project=$__ProjectRoot/src/.nuget/Microsoft.NETCore.Runtime.CoreCLR/Microsoft.NETCore.Runtime.CoreCLR.builds -DistroRid=\${OSRid}-$__Arch -UseSharedCompilation=false -BuildNugetPackage=false $unprocessedBuildArgs
if [ $? -ne 0 ]
then
echo "ERROR: An error occurred while syncing packages; See build-packages.log for more details."
exit 1
fi

# Build the JIT packages
$__ProjectRoot/Tools/dotnetcli/dotnet "$__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."
$__ProjectRoot/run.sh build-packages -Project=$__ProjectRoot/src/.nuget/Microsoft.NETCore.Jit/Microsoft.NETCore.Jit.builds -DistroRid=\${OSRid}-$__Arch -UseSharedCompilation=false -BuildNugetPackage=false $unprocessedBuildArgs
if [ $? -ne 0 ]
then
echo "ERROR: An error occurred while syncing packages; See build-packages.log for more details."
exit 1
fi

# Build the ILAsm package
$__ProjectRoot/Tools/dotnetcli/dotnet "$__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

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."
$__ProjectRoot/run.sh build-packages -Project=$__ProjectRoot/src/.nuget/Microsoft.NETCore.ILAsm/Microsoft.NETCore.ILAsm.builds -DistroRid=\${OSRid}-$__Arch -UseSharedCompilation=false -BuildNugetPackage=false $unprocessedBuildArgs
if [ $? -ne 0 ]
then
echo "ERROR: An error occurred while syncing packages; See build-packages.log for more details."
exit 1
fi

# Build the ILDAsm package
$__ProjectRoot/Tools/dotnetcli/dotnet "$__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

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."
$__ProjectRoot/run.sh build-packages -Project=$__ProjectRoot/src/.nuget/Microsoft.NETCore.ILDAsm/Microsoft.NETCore.ILDAsm.builds -DistroRid=\${OSRid}-$__Arch -UseSharedCompilation=false -BuildNugetPackage=false $unprocessedBuildArgs
if [ $? -ne 0 ]
then
echo "ERROR: An error occurred while syncing packages; See build-packages.log for more details."
exit 1
fi

Expand All @@ -166,5 +72,4 @@ if [ $? -ne 0 ]; then
fi

echo "Done building packages."
echo -e "\nDone building packages." >> $build_packages_log
exit 0
Loading

0 comments on commit f5afe9b

Please sign in to comment.