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 // Calculate the build command
if (os == 'Windows_NT') { if (os == 'Windows_NT') {
buildCommand = ".\\build.cmd -Configuration ${lowerConfiguration} Default" buildCommand = ".\\build.cmd -Configuration ${lowerConfiguration} -Targets Default"
} }
else if (os == 'Windows_2016') { else if (os == 'Windows_2016') {
buildCommand = ".\\build.cmd -Configuration ${lowerConfiguration} -RunInstallerTestsInDocker Default" buildCommand = ".\\build.cmd -Configuration ${lowerConfiguration} -RunInstallerTestsInDocker -Targets Default"
} }
else if (os == 'Ubuntu') { 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 { else {
// Jenkins non-Ubuntu CI machines don't have docker // 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)) { def newJob = job(Utilities.getFullJobName(project, jobName, isPR)) {

View file

@ -6,21 +6,22 @@
param( param(
[string]$Configuration="Debug", [string]$Configuration="Debug",
[string]$Architecture="x64", [string]$Architecture="x64",
[string[]]$Targets=@("Default"),
[switch]$NoPackage, [switch]$NoPackage,
[switch]$RunInstallerTestsInDocker, [switch]$RunInstallerTestsInDocker,
[switch]$Help) [switch]$Help)
if($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 ""
Write-Host "Options:" Write-Host "Options:"
Write-Host " -Configuration <CONFIGURATION> Build the specified Configuration (Debug or Release, default: Debug)" 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 " -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 " -NoPackage Skip packaging targets"
Write-Host " -RunInstallerTestsInDocker Runs the .msi installer tests in a Docker container. Requires Windows 2016 TP4 or higher" 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 " -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 exit 0
} }
@ -83,5 +84,5 @@ if($LASTEXITCODE -ne 0) { throw "Failed to compile build scripts" }
# Run the builder # Run the builder
Write-Host "Invoking Build Scripts..." Write-Host "Invoking Build Scripts..."
Write-Host " Configuration: $env:CONFIGURATION" 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" } if($LASTEXITCODE -ne 0) { throw "Build failed" }

View file

@ -21,6 +21,10 @@ while [[ $# > 0 ]]; do
export CONFIGURATION=$2 export CONFIGURATION=$2
shift shift
;; ;;
--targets)
IFS=',' read -r -a targets <<< $2
shift
;;
--nopackage) --nopackage)
export DOTNET_BUILD_SKIP_PACKAGING=1 export DOTNET_BUILD_SKIP_PACKAGING=1
;; ;;
@ -29,10 +33,11 @@ while [[ $# > 0 ]]; do
export DOTNET_INSTALL_SKIP_PREREQS=1 export DOTNET_INSTALL_SKIP_PREREQS=1
;; ;;
--help) --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 ""
echo "Options:" echo "Options:"
echo " --configuration <CONFIGURATION> Build the specified Configuration (Debug or Release, default: Debug)" 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 " --nopackage Skip packaging targets"
echo " --skip-prereqs Skip checks for pre-reqs in dotnet_install" 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" 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" echo "Configuration: $CONFIGURATION"
if [ -f "$DIR/dotnet-cli-build/bin/dotnet-cli-build" ]; then 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 $? exit $?
else else
# We're on an older CLI. This is temporary while Ubuntu and CentOS VSO builds are stalled. # 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 $? exit $?
fi fi