Explorar o código

only call exit code on appveyor so local console doesn't exit

Oren Novotny %!s(int64=9) %!d(string=hai) anos
pai
achega
7d23988160
Modificáronse 2 ficheiros con 38 adicións e 7 borrados
  1. 19 4
      Ix.NET/Source/build-new.ps1
  2. 19 3
      Rx.NET/Source/build-new.ps1

+ 19 - 4
Ix.NET/Source/build-new.ps1

@@ -3,7 +3,7 @@ $scriptPath = split-path -parent $MyInvocation.MyCommand.Definition
 $configuration = "Release"
 
 $nuspecDir = Join-Path $scriptPath "NuSpecs"
-
+$isAppVeyor = Test-Path -Path env:\APPVEYOR
 
 if (!(Test-Path .\nuget.exe)) {
     wget "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" -outfile .\nuget.exe
@@ -41,7 +41,12 @@ $projects = gci $scriptPath -Directory `
 
 foreach ($project in $projects) {
   dotnet build -c "$configuration" $project.FullName
-  if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode)  }  
+  if ($LastExitCode -ne 0) { 
+    Write-Host "Error building project $project" -Foreground Red
+    if($isAppVeyor) {
+      $host.SetShouldExit($LastExitCode)
+    }  
+  } 
 }
 
 Write-Host "Building Packages" -Foreground Green
@@ -51,14 +56,24 @@ 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)  }
+   if ($LastExitCode -ne 0) { 
+    Write-Host "Error packing NuGet $nuspec" -Foreground Red
+    if($isAppVeyor) {
+      $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)  }
+if ($LastExitCode -ne 0) { 
+    Write-Host "Error with tests" -Foreground Red
+    if($isAppVeyor) {
+      $host.SetShouldExit($LastExitCode)
+    }  
+}
 
 Write-Host "Reverting AssemblyInfo's" -Foreground Green
 gci $scriptPath -re -in AssemblyInfo.cs | %{ git checkout $_ } 

+ 19 - 3
Rx.NET/Source/build-new.ps1

@@ -3,6 +3,7 @@ $scriptPath = split-path -parent $MyInvocation.MyCommand.Definition
 $configuration = "Release"
 
 $nuspecDir = Join-Path $scriptPath "NuSpecs"
+$isAppVeyor = Test-Path -Path env:\APPVEYOR
 
 if (!(Test-Path .\nuget.exe)) {
     wget "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" -outfile .\nuget.exe
@@ -43,7 +44,12 @@ $projects = gci $scriptPath -Directory `
 
 foreach ($project in $projects) {
   dotnet build -c "$configuration" $project.FullName  
-  if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode)  }
+  if ($LastExitCode -ne 0) { 
+    Write-Host "Error building project $project" -Foreground Red
+    if($isAppVeyor) {
+      $host.SetShouldExit($LastExitCode)
+    }  
+  }
 
 }
 
@@ -63,14 +69,24 @@ 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)  }
+   if ($LastExitCode -ne 0) { 
+    Write-Host "Error packing NuGet $nuspec" -Foreground Red
+    if($isAppVeyor) {
+      $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)  }
+if ($LastExitCode -ne 0) { 
+    Write-Host "Error with tests" -Foreground Red
+    if($isAppVeyor) {
+      $host.SetShouldExit($LastExitCode)
+    }  
+}
 
 Write-Host "Reverting AssemblyInfo's" -Foreground Green
 gci $scriptPath -re -in AssemblyInfo.cs | %{ git checkout $_ }