2019-01-18 18:07:17 +00:00
|
|
|
[CmdletBinding(PositionalBinding=$false)]
|
|
|
|
Param(
|
2019-11-22 13:41:58 +00:00
|
|
|
[string] $configuration = 'Debug',
|
2019-02-05 13:42:55 +00:00
|
|
|
[string] $task,
|
2019-11-22 13:41:58 +00:00
|
|
|
[string] $verbosity = 'minimal',
|
2019-01-18 18:07:17 +00:00
|
|
|
[string] $msbuildEngine = $null,
|
2019-02-05 13:42:55 +00:00
|
|
|
[switch] $restore,
|
2019-01-18 18:07:17 +00:00
|
|
|
[switch] $prepareMachine,
|
|
|
|
[switch] $help,
|
|
|
|
[Parameter(ValueFromRemainingArguments=$true)][String[]]$properties
|
|
|
|
)
|
|
|
|
|
2019-02-05 13:42:55 +00:00
|
|
|
$ci = $true
|
|
|
|
$binaryLog = $true
|
|
|
|
$warnAsError = $true
|
|
|
|
|
2019-01-18 18:07:17 +00:00
|
|
|
. $PSScriptRoot\tools.ps1
|
|
|
|
|
|
|
|
function Print-Usage() {
|
2019-02-05 13:42:55 +00:00
|
|
|
Write-Host "Common settings:"
|
|
|
|
Write-Host " -task <value> Name of Arcade task (name of a project in SdkTasks directory of the Arcade SDK package)"
|
|
|
|
Write-Host " -restore Restore dependencies"
|
|
|
|
Write-Host " -verbosity <value> Msbuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]"
|
|
|
|
Write-Host " -help Print help and exit"
|
|
|
|
Write-Host ""
|
2019-01-18 18:07:17 +00:00
|
|
|
|
2019-02-05 13:42:55 +00:00
|
|
|
Write-Host "Advanced settings:"
|
|
|
|
Write-Host " -prepareMachine Prepare machine for CI run"
|
|
|
|
Write-Host " -msbuildEngine <value> Msbuild engine to use to run build ('dotnet', 'vs', or unspecified)."
|
|
|
|
Write-Host ""
|
|
|
|
Write-Host "Command line arguments not listed above are passed thru to msbuild."
|
2019-01-18 18:07:17 +00:00
|
|
|
}
|
|
|
|
|
2019-02-05 13:42:55 +00:00
|
|
|
function Build([string]$target) {
|
2019-11-22 13:41:58 +00:00
|
|
|
$logSuffix = if ($target -eq 'Execute') { '' } else { ".$target" }
|
2019-02-05 13:42:55 +00:00
|
|
|
$log = Join-Path $LogDir "$task$logSuffix.binlog"
|
|
|
|
$outputPath = Join-Path $ToolsetDir "$task\\"
|
2019-01-18 18:07:17 +00:00
|
|
|
|
2019-02-05 13:42:55 +00:00
|
|
|
MSBuild $taskProject `
|
|
|
|
/bl:$log `
|
|
|
|
/t:$target `
|
|
|
|
/p:Configuration=$configuration `
|
2019-01-18 18:07:17 +00:00
|
|
|
/p:RepoRoot=$RepoRoot `
|
2019-02-05 13:42:55 +00:00
|
|
|
/p:BaseIntermediateOutputPath=$outputPath `
|
2019-01-18 18:07:17 +00:00
|
|
|
@properties
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
2019-11-22 13:41:58 +00:00
|
|
|
if ($help -or (($null -ne $properties) -and ($properties.Contains('/help') -or $properties.Contains('/?')))) {
|
2019-01-18 18:07:17 +00:00
|
|
|
Print-Usage
|
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
|
2019-02-05 13:42:55 +00:00
|
|
|
if ($task -eq "") {
|
2019-11-22 13:41:58 +00:00
|
|
|
Write-PipelineTelemetryError -Category 'Build' -Message "Missing required parameter '-task <value>'" -ForegroundColor Red
|
2019-01-18 18:07:17 +00:00
|
|
|
Print-Usage
|
|
|
|
ExitWithExitCode 1
|
|
|
|
}
|
|
|
|
|
2019-02-05 13:42:55 +00:00
|
|
|
$taskProject = GetSdkTaskProject $task
|
|
|
|
if (!(Test-Path $taskProject)) {
|
2019-11-22 13:41:58 +00:00
|
|
|
Write-PipelineTelemetryError -Category 'Build' -Message "Unknown task: $task" -ForegroundColor Red
|
2019-02-05 13:42:55 +00:00
|
|
|
ExitWithExitCode 1
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($restore) {
|
2019-11-22 13:41:58 +00:00
|
|
|
Build 'Restore'
|
2019-01-18 18:07:17 +00:00
|
|
|
}
|
|
|
|
|
2019-11-22 13:41:58 +00:00
|
|
|
Build 'Execute'
|
2019-01-18 18:07:17 +00:00
|
|
|
}
|
|
|
|
catch {
|
|
|
|
Write-Host $_.ScriptStackTrace
|
2019-11-22 13:41:58 +00:00
|
|
|
Write-PipelineTelemetryError -Category 'Build' -Message $_
|
2019-01-18 18:07:17 +00:00
|
|
|
ExitWithExitCode 1
|
|
|
|
}
|
|
|
|
|
|
|
|
ExitWithExitCode 0
|