Exit with non-zero exit code when build.ps1 fails

pull/3113/head
Mark McDowall 12 years ago
parent f4ceb57b2b
commit b79f695564

@ -2,7 +2,6 @@ param (
[switch]$runTests = $false
)
$msBuild = 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe'
$outputFolder = '.\_output'
$testSearchPattern = '*.Test\bin\x86\Release'
@ -13,13 +12,19 @@ Function Build()
$clean = $msbuild + " nzbdrone.sln /t:Clean /m"
$build = $msbuild + " nzbdrone.sln /p:Configuration=Release /p:Platform=x86 /t:Build /m"
if(Test-Path $outputFolder)
{
Remove-Item -Recurse -Force $outputFolder -ErrorAction Continue
}
Invoke-Expression $clean
CheckExitCode
Invoke-Expression $build
CheckExitCode
CleanFolder $outputFolder
}
@ -42,7 +47,7 @@ Function CleanFolder($path)
Function PackageTests()
{
Write-Host Packagin Tests
Write-Host Packaging Tests
if(Test-Path $testPackageFolder)
{
@ -60,7 +65,6 @@ Function PackageTests()
}
Function Nunit()
{
$testFiles
@ -72,14 +76,26 @@ Function Nunit()
$nunitExe = '.\Libraries\nunit\nunit-console-x86.exe ' + $testFiles + ' /process:multiple /noxml'
Invoke-Expression $nunitExe
CheckExitCode
}
Function RunGrunt()
{
$gruntPath = [environment]::getfolderpath("applicationdata") + '\npm\node_modules\grunt-cli\bin\grunt'
Invoke-Expression 'npm install'
CheckExitCode
Invoke-Expression ('node ' + $gruntPath + ' package')
CheckExitCode
}
Function CheckExitCode()
{
if ($lastexitcode -ne 0)
{
Write-Host $errorMessage
exit 1
}
}
Build

Loading…
Cancel
Save