Add '--targets' option to the build scripts which take a comma separated

list of build targets.
This commit is contained in:
Sridhar Periyasamy 2016-02-26 18:14:01 -08:00
parent 85ca7c183d
commit 106aa69ce1
3 changed files with 16 additions and 10 deletions

View file

@ -26,17 +26,17 @@ def static getBuildJobName(def configuration, def os) {
// Calculate the build command
if (os == 'Windows_NT') {
buildCommand = ".\\build.cmd -Configuration ${lowerConfiguration} Default"
buildCommand = ".\\build.cmd -Configuration ${lowerConfiguration} -Targets Default"
}
else if (os == 'Windows_2016') {
buildCommand = ".\\build.cmd -Configuration ${lowerConfiguration} -RunInstallerTestsInDocker Default"
buildCommand = ".\\build.cmd -Configuration ${lowerConfiguration} -RunInstallerTestsInDocker -Targets Default"
}
else if (os == 'Ubuntu') {
buildCommand = "./build.sh --skip-prereqs --configuration ${lowerConfiguration} --docker ubuntu Default"
buildCommand = "./build.sh --skip-prereqs --configuration ${lowerConfiguration} --docker ubuntu --targets Default"
}
else {
// Jenkins non-Ubuntu CI machines don't have docker
buildCommand = "./build.sh --skip-prereqs --configuration ${lowerConfiguration} Default"
buildCommand = "./build.sh --skip-prereqs --configuration ${lowerConfiguration} --targets Default"
}
def newJob = job(Utilities.getFullJobName(project, jobName, isPR)) {

View file

@ -6,21 +6,22 @@
param(
[string]$Configuration="Debug",
[string]$Architecture="x64",
[string[]]$Targets=@("Default"),
[switch]$NoPackage,
[switch]$RunInstallerTestsInDocker,
[switch]$Help)
if($Help)
{
Write-Host "Usage: .\build.cmd [-Configuration <CONFIGURATION>] [-NoPackage] [-Help] <TARGETS...>"
Write-Host "Usage: .\build.cmd [-Configuration <CONFIGURATION>] [-NoPackage] [-Help] [-Targets <TARGETS...>]"
Write-Host ""
Write-Host "Options:"
Write-Host " -Configuration <CONFIGURATION> Build the specified Configuration (Debug or Release, default: Debug)"
Write-Host " -Architecture <ARCHITECTURE> Build the specified architecture (x64 or x86 (supported only on Windows), default: x64)"
Write-Host " -Targets <TARGETS...> Comma separated build targets to run (Init, Compile, Publish, etc.; Default is a full build and publish)"
Write-Host " -NoPackage Skip packaging targets"
Write-Host " -RunInstallerTestsInDocker Runs the .msi installer tests in a Docker container. Requires Windows 2016 TP4 or higher"
Write-Host " -Help Display this help message"
Write-Host " <TARGETS...> The build targets to run (Init, Compile, Publish, etc.; Default is a full build and publish)"
exit 0
}
@ -83,5 +84,5 @@ if($LASTEXITCODE -ne 0) { throw "Failed to compile build scripts" }
# Run the builder
Write-Host "Invoking Build Scripts..."
Write-Host " Configuration: $env:CONFIGURATION"
& "$PSScriptRoot\dotnet-cli-build\bin\dotnet-cli-build.exe" @args
& "$PSScriptRoot\dotnet-cli-build\bin\dotnet-cli-build.exe" @Targets
if($LASTEXITCODE -ne 0) { throw "Build failed" }

View file

@ -21,6 +21,10 @@ while [[ $# > 0 ]]; do
export CONFIGURATION=$2
shift
;;
--targets)
IFS=',' read -r -a targets <<< $2
shift
;;
--nopackage)
export DOTNET_BUILD_SKIP_PACKAGING=1
;;
@ -29,10 +33,11 @@ while [[ $# > 0 ]]; do
export DOTNET_INSTALL_SKIP_PREREQS=1
;;
--help)
echo "Usage: $0 [--configuration <CONFIGURATION>] [--skip-prereqs] [--nopackage] [--docker <IMAGENAME>] [--help] <TARGETS...>"
echo "Usage: $0 [--configuration <CONFIGURATION>] [--skip-prereqs] [--nopackage] [--docker <IMAGENAME>] [--help] [--targets <TARGETS...>]"
echo ""
echo "Options:"
echo " --configuration <CONFIGURATION> Build the specified Configuration (Debug or Release, default: Debug)"
echo " --targets <TARGETS...> Comma separated build targets to run (Init, Compile, Publish, etc.; Default is a full build and publish)"
echo " --nopackage Skip packaging targets"
echo " --skip-prereqs Skip checks for pre-reqs in dotnet_install"
echo " --docker <IMAGENAME> Build in Docker using the Dockerfile located in scripts/docker/IMAGENAME"
@ -106,10 +111,10 @@ echo "Invoking Build Scripts..."
echo "Configuration: $CONFIGURATION"
if [ -f "$DIR/dotnet-cli-build/bin/dotnet-cli-build" ]; then
$DIR/dotnet-cli-build/bin/dotnet-cli-build "$@"
$DIR/dotnet-cli-build/bin/dotnet-cli-build "${targets[@]}"
exit $?
else
# We're on an older CLI. This is temporary while Ubuntu and CentOS VSO builds are stalled.
$DIR/dotnet-cli-build/bin/Debug/dnxcore50/dotnet-cli-build "$@"
$DIR/dotnet-cli-build/bin/Debug/dnxcore50/dotnet-cli-build "${targets[@]}"
exit $?
fi