2018-11-08 01:21:16 +00:00
|
|
|
#
|
|
|
|
# Copyright (c) .NET Foundation and contributors. All rights reserved.
|
|
|
|
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
|
|
#
|
|
|
|
|
2018-12-04 21:20:01 +00:00
|
|
|
[CmdletBinding(PositionalBinding=$false)]
|
2018-11-08 01:21:16 +00:00
|
|
|
param(
|
|
|
|
[string]$Configuration="Debug",
|
|
|
|
[string]$Architecture="x64",
|
2019-01-11 22:47:23 +00:00
|
|
|
[switch]$Sign=$false,
|
2021-03-24 08:02:14 +00:00
|
|
|
[switch]$PgoInstrument,
|
2019-01-11 22:53:23 +00:00
|
|
|
[bool]$WarnAsError=$true,
|
2018-11-08 01:21:16 +00:00
|
|
|
[Parameter(ValueFromRemainingArguments=$true)][String[]]$ExtraParameters
|
|
|
|
)
|
|
|
|
|
|
|
|
$RepoRoot = "$PSScriptRoot"
|
|
|
|
|
2019-01-11 22:47:23 +00:00
|
|
|
$Parameters = "/p:Architecture=$Architecture"
|
|
|
|
$Parameters = "$Parameters -configuration $Configuration"
|
|
|
|
|
2021-03-24 08:02:14 +00:00
|
|
|
if ($PgoInstrument) {
|
|
|
|
$Parameters = "$Parameters /p:PgoInstrument=true"
|
|
|
|
}
|
|
|
|
|
2019-01-11 22:47:23 +00:00
|
|
|
if ($Sign) {
|
2023-11-28 05:54:44 +00:00
|
|
|
$Parameters = "$Parameters -sign /p:SignCoreSdk=true"
|
2019-01-11 22:47:23 +00:00
|
|
|
|
2023-11-28 05:54:44 +00:00
|
|
|
# Workaround https://github.com/dotnet/arcade/issues/1776
|
|
|
|
$WarnAsError = $false
|
2023-10-06 23:32:04 +00:00
|
|
|
}
|
|
|
|
|
2019-01-11 22:53:23 +00:00
|
|
|
$Parameters = "$Parameters -WarnAsError `$$WarnAsError"
|
|
|
|
|
2018-12-04 21:20:01 +00:00
|
|
|
try {
|
2019-01-11 22:47:23 +00:00
|
|
|
$ExpressionToInvoke = "$RepoRoot\eng\common\build.ps1 -restore -build $Parameters $ExtraParameters"
|
2018-12-04 21:20:01 +00:00
|
|
|
Write-Host "Invoking expression: $ExpressionToInvoke"
|
|
|
|
Invoke-Expression $ExpressionToInvoke
|
|
|
|
}
|
|
|
|
catch {
|
|
|
|
Write-Error $_
|
|
|
|
Write-Error $_.ScriptStackTrace
|
|
|
|
throw "Failed to build"
|
|
|
|
}
|
2018-11-08 01:21:16 +00:00
|
|
|
|
2018-12-26 03:08:40 +00:00
|
|
|
if($LASTEXITCODE -ne 0) { throw "Failed to build" }
|