Skip to content

Commit

Permalink
Changing dev workflow scripts to use the Run Command Tool (dotnet#10231)
Browse files Browse the repository at this point in the history
Changes to dev workflow scripts to use run command tool.
  • Loading branch information
maririos authored Jul 28, 2016
1 parent a6e95d3 commit 7e2bd07
Show file tree
Hide file tree
Showing 134 changed files with 1,068 additions and 1,373 deletions.
2 changes: 1 addition & 1 deletion UpdateDependencies.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function UpdateValidDependencyVersionsFile
# Updates all the project.json files with out of date version numbers
function RunUpdatePackageDependencyVersions
{
cmd /c $PSScriptRoot\build.cmd managed /t:UpdateInvalidPackageVersions | Out-Host
cmd /c $PSScriptRoot\build-managed.cmd -UpdateInvalidPackageVersions | Out-Host

return $LASTEXITCODE -eq 0
}
Expand Down
2 changes: 2 additions & 0 deletions build-managed.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@call %~dp0run.cmd build-managed -nodoReuse -binclashWindows %*
@exit /b %ERRORLEVEL%
61 changes: 61 additions & 0 deletions build-managed.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/usr/bin/env bash

usage()
{
echo "Usage: $0 [platform] [useservergc]"
echo
echo "platform can be: FreeBSD, Linux, NetBSD, OSX, Windows."
echo "useservergc - Switch used by configure the hosted coreclr instance when executing tests."
echo
}


__scriptpath=$(cd "$(dirname "$0")"; pwd -P)

__UnprocessedBuildArgs=
__TestNugetRuntimeId=-distroRid
__BuildOS=-os
__TargetOS=-target-os
__ServerGC=0

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

lowerI="$(echo $1 | awk '{print tolower($0)}')"
case $lowerI in
freebsd)
__TestNugetRuntimeId="$__TestNugetRuntimeId=osx.10.10-x64"
__BuildOS="$__BuildOS=freebsd"
__TargetOS="$__TargetOS=freebsd"
;;
netbsd)
__TestNugetRuntimeId="$__TestNugetRuntimeId=osx.10.10-x64"
__BuildOS="$__BuildOS=netbsd"
__TargetOS="$__TargetOS=netbsd"
;;
osx)
__TestNugetRuntimeId="$__TestNugetRuntimeId=osx.10.10-x64"
__BuildOS="$__BuildOS=osx"
__TargetOS="$__TargetOS=osx"
;;
windows)
__TestNugetRuntimeId="$__TestNugetRuntimeId=win7-x64"
__BuildOS="$__BuildOS=windows_nt"
__TargetOS="$__TargetOS=Windows_NT"
;;
useservergc)
__ServerGC=1
;;
*)
__UnprocessedBuildArgs="$__UnprocessedBuildArgs $1"
esac

shift
done

export CORECLR_SERVER_GC="$__ServerGC"

$__scriptpath/run.sh build-managed -binclashUnix $__BuildOS $__TargetOS $__TestNugetRuntimeId $__UnprocessedBuildArgs
exit $?
2 changes: 2 additions & 0 deletions build-native.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@call %~dp0run.cmd build-native %*
@exit /b %ERRORLEVEL%
5 changes: 5 additions & 0 deletions build-native.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
working_tree_root="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
#The Run Command Tool is calling src/Native/build-native.sh
$working_tree_root/run.sh build-native $*
exit $?
35 changes: 2 additions & 33 deletions build-packages.cmd
Original file line number Diff line number Diff line change
@@ -1,33 +1,2 @@
@if "%_echo%" neq "on" echo off
setlocal EnableDelayedExpansion

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

echo msbuild.exe %~dp0src\packages.builds !options! !allargs! >> %packagesLog%
call msbuild.exe %~dp0src\packages.builds !options! !allargs!
if NOT [%ERRORLEVEL%]==[0] (
echo ERROR: An error occurred while building packages, see %packagesLog% for more details.
exit /b 1
)

echo Done Building Packages.
exit /b

:Usage
echo.
echo Builds the NuGet packages from the binaries that were built in the Build product binaries step.
echo No option parameters.
exit /b
@call %~dp0run.cmd build-managed -packages -nodoReuse -binclashWindows %*
@exit /b %ERRORLEVEL%
75 changes: 2 additions & 73 deletions build-packages.sh
Original file line number Diff line number Diff line change
@@ -1,75 +1,4 @@
#!/usr/bin/env bash

usage()
{
echo "Builds the NuGet packages from the binaries that were built in the Build product binaries step."
echo "No option parameters."
exit 1
}

working_tree_root="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
build_packages_log=$working_tree_root/build-packages.log
binclashlog=$working_tree_root/binclash.log
binclashloggerdll=$working_tree_root/Tools/Microsoft.DotNet.Build.Tasks.dll
RuntimeOS=ubuntu.14.04

# Use uname to determine what the OS is.
OSName=$(uname -s)
case $OSName in
Darwin)
# Darwin version can be three sets of digits (e.g. 10.10.3), we want just the first one
DarwinVersion=$(sw_vers -productVersion | awk 'match($0, /[0-9]+/) { print substr($0, RSTART, RLENGTH) }')
RuntimeOS=osx.$DarwinVersion
;;

FreeBSD|NetBSD)
# TODO this doesn't seem correct
RuntimeOS=osx.10
;;

Linux)
if [ ! -e /etc/os-release ]; then
echo "Cannot determine Linux distribution, assuming Ubuntu 14.04"
else
source /etc/os-release
# for some distros we only need the version major number
VersionMajor=$(echo $VERSION_ID | awk 'match($0, /[0-9]+/) { print substr($0, RSTART, RLENGTH) }')
if [ "$ID" == "rhel" ]; then
RuntimeOS=$ID.$VersionMajor
else
RuntimeOS=$ID.$VERSION_ID
fi
fi
;;

*)
echo "Unsupported OS '$OSName' detected. Configuring as if for Ubuntu."
;;
esac

options="/m /nologo /v:minimal /clp:Summary /flp:v=diagnostic;Append;LogFile=$build_packages_log /l:BinClashLogger,$binclashloggerdll;LogFile=$binclashlog /p:FilterToOSGroup=$RuntimeOS"
allargs="$@"

echo -e "Running build-packages.sh $allargs" > $build_packages_log

if [ "$allargs" == "-h" ] || [ "$allargs" == "--help" ]; then
usage
fi

# Ensure that MSBuild is available
echo "Running init-tools.sh"
$working_tree_root/init-tools.sh

echo -e "\n$working_tree_root/Tools/dotnetcli/dotnet $working_tree_root/Tools/MSBuild.exe $working_tree_root/src/packages.builds $options $allargs" >> $build_packages_log
$working_tree_root/Tools/dotnetcli/dotnet $working_tree_root/Tools/MSBuild.exe $working_tree_root/src/packages.builds $options $allargs


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
$working_tree_root/run.sh build-managed -packages -binclashUnix $*
exit $?
35 changes: 2 additions & 33 deletions build-tests.cmd
Original file line number Diff line number Diff line change
@@ -1,33 +1,2 @@
@if "%_echo%" neq "on" echo off
setlocal EnableDelayedExpansion

set buildTests=build-tests.log
set binclashLoggerDll=%~dp0Tools\net45\Microsoft.DotNet.Build.Tasks.dll
set binclashlog=%~dp0binclash.log
echo Running build-tests.cmd %* > %buildTests%

set options=/nologo /maxcpucount /v:minimal /clp:Summary /nodeReuse:false /flp:v=detailed;Append;LogFile=%buildTests% /l:BinClashLogger,%binclashLoggerDll%;LogFile=%binclashlog%
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

echo msbuild.exe %~dp0src\tests.builds !options! !allargs! >> %buildTests%
call msbuild.exe %~dp0src\tests.builds !options! !allargs!
if NOT [%ERRORLEVEL%]==[0] (
echo ERROR: An error occurred while building the tests, see %buildTests% for more details.
exit /b 1
)

echo Done Building tests.
exit /b

:Usage
echo.
echo Builds the tests that are in the repository.
echo No option parameters.
exit /b
@call %~dp0run.cmd build-managed -tests -nodoReuse -binclashWindows %*
@exit /b %ERRORLEVEL%
40 changes: 2 additions & 38 deletions build-tests.sh
Original file line number Diff line number Diff line change
@@ -1,40 +1,4 @@
#!/usr/bin/env bash

usage()
{
echo "Builds the tests that are in the repository."
echo "No option parameters."
exit 1
}

working_tree_root="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
build_tests_log=$working_tree_root/build-tests.log
binclashlog=$working_tree_root/binclash.log
binclashloggerdll=$working_tree_root/Tools/Microsoft.DotNet.Build.Tasks.dll

options="/m /nologo /v:minimal /clp:Summary /flp:v=detailed;Append;LogFile=$build_tests_log /l:BinClashLogger,$binclashloggerdll;LogFile=$binclashlog"
allargs="$@"

echo -e "Running build-tests.sh $allargs" > $build_tests_log

if [ "$allargs" == "-h" ] || [ "$allargs" == "--help" ]; then
usage
fi

# Ensure that MSBuild is available
echo "Running init-tools.sh"
$working_tree_root/init-tools.sh

echo -e "\n$working_tree_root/Tools/dotnetcli/dotnet $working_tree_root/Tools/MSBuild.exe $working_tree_root/src/tests.builds $options $allargs" >> $build_tests_log
$working_tree_root/Tools/dotnetcli/dotnet $working_tree_root/Tools/MSBuild.exe $working_tree_root/src/tests.builds $options $allargs


if [ $? -ne 0 ]; then
echo -e "\nAn error occurred. Aborting build-tests.sh ." >> $build_tests_log
echo "ERROR: An error occurred while building tests, see $build_tests_log for more details."
exit 1
fi

echo "Done building tests."
echo -e "\nDone building tests." >> $build_tests_log
exit 0
$working_tree_root/run.sh build-managed -tests -binclashUnix $*
exit $?
Loading

0 comments on commit 7e2bd07

Please sign in to comment.