Exit code fix (#130)
* Add --install-dir argument * Fix exit code propagation
This commit is contained in:
Родитель
7c43efa841
Коммит
9a2c108ed0
|
@ -1,3 +1,3 @@
|
|||
@echo off
|
||||
powershell -ExecutionPolicy ByPass -command "& {&'%~dp0eng\common\Build.ps1' -restore -build %*}
|
||||
powershell -ExecutionPolicy ByPass -command "& """%~dp0eng\common\Build.ps1""" -restore -build %*"
|
||||
exit /b %ErrorLevel%
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
@echo off
|
||||
powershell -ExecutionPolicy ByPass -command "& {&'%~dp0eng\common\Build.ps1' -restore %*}
|
||||
powershell -ExecutionPolicy ByPass -command "& """%~dp0eng\common\Build.ps1""" -restore %*"
|
||||
exit /b %ErrorLevel%
|
||||
|
|
2
Test.cmd
2
Test.cmd
|
@ -1,3 +1,3 @@
|
|||
@echo off
|
||||
powershell -ExecutionPolicy ByPass -command "& {&'%~dp0eng\common\Build.ps1' -test %*}
|
||||
powershell -ExecutionPolicy ByPass -command "& """%~dp0eng\common\Build.ps1""" -test %*"
|
||||
exit /b %ErrorLevel%
|
|
@ -1,3 +1,3 @@
|
|||
@echo off
|
||||
powershell -ExecutionPolicy ByPass -command "& {&'%~dp0Build.ps1' -restore -build -test -sign -pack -ci %*}
|
||||
powershell -ExecutionPolicy ByPass -command "& """%~dp0Build.ps1""" -restore -build -test -sign -pack -ci %*"
|
||||
exit /b %ErrorLevel%
|
||||
|
|
|
@ -99,7 +99,8 @@ function InstallDotNetCli([string] $dotnetRoot) {
|
|||
|
||||
& $installScript -Version $GlobalJson.sdk.version -InstallDir $dotnetRoot
|
||||
if ($lastExitCode -ne 0) {
|
||||
throw "Failed to install dotnet cli (exit code '$lastExitCode')."
|
||||
Write-Host "Failed to install dotnet cli (exit code '$lastExitCode')." -ForegroundColor Red
|
||||
exit $lastExitCode
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -134,8 +135,9 @@ function LocateVisualStudio {
|
|||
|
||||
$vsInstallDir = & $vsWhereExe -latest -prerelease -property installationPath -requires Microsoft.Component.MSBuild -requires Microsoft.VisualStudio.Component.VSSDK -requires Microsoft.Net.Component.4.6.TargetingPack -requires Microsoft.VisualStudio.Component.Roslyn.Compiler -requires Microsoft.VisualStudio.Component.VSSDK
|
||||
|
||||
if (!(Test-Path $vsInstallDir)) {
|
||||
throw "Failed to locate Visual Studio (exit code '$lastExitCode')."
|
||||
if ($lastExitCode -ne 0) {
|
||||
Write-Host "Failed to locate Visual Studio (exit code '$lastExitCode')." -ForegroundColor Red
|
||||
exit $lastExitCode
|
||||
}
|
||||
|
||||
return $vsInstallDir
|
||||
|
@ -154,7 +156,8 @@ function InitializeToolset {
|
|||
}
|
||||
|
||||
if (-not $restore) {
|
||||
throw "Toolset version $toolsetVersion has not been restored."
|
||||
Write-Host "Toolset version $toolsetVersion has not been restored."
|
||||
exit 1
|
||||
}
|
||||
|
||||
$proj = Join-Path $ToolsetDir "restore.proj"
|
||||
|
@ -163,7 +166,9 @@ function InitializeToolset {
|
|||
& $BuildDriver $BuildArgs $proj /t:__WriteToolsetLocation /m /nologo /clp:None /warnaserror /bl:$ToolsetRestoreLog /v:$verbosity /p:__ToolsetLocationOutputFile=$toolsetLocationFile
|
||||
|
||||
if ($lastExitCode -ne 0) {
|
||||
throw "Failed to restore toolset (exit code '$lastExitCode'). See log: $ToolsetRestoreLog"
|
||||
Write-Host "Failed to restore toolset (exit code '$lastExitCode')." -Color Red
|
||||
Write-Host "Build log: $ToolsetRestoreLog" -ForegroundColor DarkGray
|
||||
exit $lastExitCode
|
||||
}
|
||||
|
||||
$global:ToolsetBuildProj = Get-Content $toolsetLocationFile
|
||||
|
@ -171,6 +176,10 @@ function InitializeToolset {
|
|||
|
||||
function Build {
|
||||
& $BuildDriver $BuildArgs $ToolsetBuildProj /m /nologo /clp:Summary /warnaserror /v:$verbosity /bl:$Log /p:Configuration=$configuration /p:Projects=$solution /p:RepoRoot=$RepoRoot /p:Restore=$restore /p:DeployDeps=$deployDeps /p:Build=$build /p:Rebuild=$rebuild /p:Deploy=$deploy /p:Test=$test /p:IntegrationTest=$integrationTest /p:Sign=$sign /p:Pack=$pack /p:CIBuild=$ci $properties
|
||||
if ($lastExitCode -ne 0) {
|
||||
Write-Host "Build log: $Log" -ForegroundColor DarkGray
|
||||
exit $lastExitCode
|
||||
}
|
||||
}
|
||||
|
||||
function Stop-Processes() {
|
||||
|
@ -216,7 +225,8 @@ try {
|
|||
} elseif ((Get-Member -InputObject $GlobalJson -Name "sdk") -ne $null) {
|
||||
InitializeDotNetCli
|
||||
} else {
|
||||
throw "/global.json must either specify 'sdk.version' or 'vswhere.version'."
|
||||
Write-Host "/global.json must either specify 'sdk.version' or 'vswhere.version'." -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
if ($ci) {
|
||||
|
@ -226,7 +236,6 @@ try {
|
|||
InitializeToolset
|
||||
|
||||
Build
|
||||
exit $lastExitCode
|
||||
}
|
||||
catch {
|
||||
Write-Host $_
|
||||
|
|
|
@ -184,7 +184,7 @@ function InstallDotNetCli {
|
|||
fi
|
||||
fi
|
||||
|
||||
bash "$dotnet_install_script" --version $dotnet_sdk_version
|
||||
bash "$dotnet_install_script" --version $dotnet_sdk_version --install-dir $dotnet_root
|
||||
local lastexitcode=$?
|
||||
|
||||
if [[ $lastexitcode != 0 ]]; then
|
||||
|
|
Загрузка…
Ссылка в новой задаче