build\build.ps1: Fixed script to fail the build if an external executable call fails.
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/9c7394a1 Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/9c7394a1 Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/9c7394a1 Branch: refs/heads/master Commit: 9c7394a1d61e52fe3841915d60ce1b8bd5359844 Parents: 873d94e Author: Shad Storhaug <[email protected]> Authored: Sun Apr 23 16:36:24 2017 +0700 Committer: Shad Storhaug <[email protected]> Committed: Sun Apr 23 16:36:24 2017 +0700 ---------------------------------------------------------------------- build/build.ps1 | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucenenet/blob/9c7394a1/build/build.ps1 ---------------------------------------------------------------------- diff --git a/build/build.ps1 b/build/build.ps1 index 62594ad..d9031cc 100644 --- a/build/build.ps1 +++ b/build/build.ps1 @@ -38,7 +38,7 @@ task Init -description "This task makes sure the build environment is correctly & where.exe dotnet.exe if ($LASTEXITCODE -ne 0) { - Write-Error "Could not find dotnet CLI in PATH. Please install the .NET Core 1.1 SDK." + throw "Could not find dotnet CLI in PATH. Please install the .NET Core 1.1 SDK." } #Update TeamCity or MyGet with packageVersion @@ -59,11 +59,6 @@ task Init -description "This task makes sure the build environment is correctly Write-Host "Configuration: $configuration" Ensure-Directory-Exists "$release_directory" - - #ensure we have the latest version of NuGet - exec { - &"$tools_directory\nuget\nuget.exe" update -self - } -ErrorAction SilentlyContinue } task Compile -depends Clean, Init -description "This task compiles the solution" { @@ -74,12 +69,12 @@ task Compile -depends Clean, Init -description "This task compiles the solution" Backup-Files $projects Prepare-For-Build $projects - & dotnet.exe restore $base_directory + Exec { + & dotnet.exe restore $base_directory + } Build-Assemblies $projects - Start-Sleep 10 - $success = $true } finally { if ($success -ne $true) { @@ -271,7 +266,9 @@ using System.Reflection; function Build-Assemblies([string[]]$projects) { foreach ($project in $projects) { - & dotnet.exe build $project --configuration $configuration + Exec { + & dotnet.exe build $project --configuration $configuration + } } } @@ -279,7 +276,9 @@ function Pack-Assemblies([string[]]$projects) { Ensure-Directory-Exists $nuget_package_directory foreach ($project in $projects) { Write-Host "Creating NuGet package for $project..." -ForegroundColor Magenta - & dotnet.exe pack $project --configuration $Configuration --output $nuget_package_directory --no-build + Exec { + & dotnet.exe pack $project --configuration $Configuration --output $nuget_package_directory --no-build + } } }
