فهرست منبع

Update build script for passing exit code to host

Oren Novotny 9 سال پیش
والد
کامیت
4a61a67751
2فایلهای تغییر یافته به همراه12 افزوده شده و 3 حذف شده
  1. 6 2
      Ix.NET/Source/build-new.ps1
  2. 6 1
      Rx.NET/Source/build-new.ps1

+ 6 - 2
Ix.NET/Source/build-new.ps1

@@ -15,7 +15,7 @@ $msbuild = Get-ItemProperty "hklm:\SOFTWARE\Microsoft\MSBuild\ToolsVersions\14.0
 $msbuildExe = Join-Path $msbuild.MSBuildToolsPath "msbuild.exe"
 
 # get tools
-.\nuget.exe install -excludeversion -pre gitversion.commandline -Version 3.5.5-pullrequest0921 -outputdirectory packages
+.\nuget.exe install -excludeversion gitversion.commandline -outputdirectory packages
 
 #update version
 .\packages\gitversion.commandline\tools\gitversion.exe /l console /output buildserver /updateassemblyinfo
@@ -40,7 +40,8 @@ $projects = gci $scriptPath -Directory `
    | Where-Object { ($_.Name -notlike "*DeviceRunner") -and (Test-Path (Join-Path $_.FullName "project.json"))  } `
 
 foreach ($project in $projects) {
-  dotnet build -c "$configuration" $project.FullName  
+  dotnet build -c "$configuration" $project.FullName
+  if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode)  }  
 }
 
 Write-Host "Building Packages" -Foreground Green
@@ -50,11 +51,14 @@ New-Item -ItemType Directory -Force -Path .\artifacts
 
 foreach ($nuspec in $nuspecs) {
    .\nuget pack $nuspec -symbols -Version $version -Properties "Configuration=$configuration" -MinClientVersion 2.12 -outputdirectory .\artifacts
+   if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode)  }
+
 }
 
 Write-Host "Running tests" -Foreground Green
 $testDirectory = Join-Path $scriptPath "Tests"  
 dotnet test $testDirectory -c $configuration
+if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode)  }
 
 Write-Host "Reverting AssemblyInfo's" -Foreground Green
 gci $scriptPath -re -in AssemblyInfo.cs | %{ git checkout $_ } 

+ 6 - 1
Rx.NET/Source/build-new.ps1

@@ -13,7 +13,7 @@ $msbuild = Get-ItemProperty "hklm:\SOFTWARE\Microsoft\MSBuild\ToolsVersions\14.0
 $msbuildExe = Join-Path $msbuild.MSBuildToolsPath "msbuild.exe"
 
 # get version
-.\nuget.exe install -excludeversion -pre gitversion.commandline -Version 3.5.5-pullrequest0921 -outputdirectory packages
+.\nuget.exe install -excludeversion gitversion.commandline -outputdirectory packages
 .\packages\gitversion.commandline\tools\gitversion.exe /l console /output buildserver /updateassemblyinfo
 
 $versionObj = .\packages\gitversion.commandline\tools\gitversion.exe | ConvertFrom-Json 
@@ -43,6 +43,8 @@ $projects = gci $scriptPath -Directory `
 
 foreach ($project in $projects) {
   dotnet build -c "$configuration" $project.FullName  
+  if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode)  }
+
 }
 
 Write-Host "Building Packages" -Foreground Green
@@ -61,11 +63,14 @@ foreach ($nuspec in $nuspecs)
   }
    
    .\nuget pack $nuspec $symbolSwitch -Version $version -Properties "Configuration=$configuration" -MinClientVersion 2.12 -outputdirectory .\artifacts
+   if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode)  }
+
 }
 
 Write-Host "Running tests" -Foreground Green
 $testDirectory = Join-Path $scriptPath "Tests.System.Reactive"
 dotnet test $testDirectory -c "$configuration"
+if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode)  }
 
 Write-Host "Reverting AssemblyInfo's" -Foreground Green
 gci $scriptPath -re -in AssemblyInfo.cs | %{ git checkout $_ }