diff --git a/src/Beacon.Plugin/Beacon.Plugin.csproj b/src/Beacon.Plugin/Beacon.Plugin.csproj index 6806467..23329a4 100644 --- a/src/Beacon.Plugin/Beacon.Plugin.csproj +++ b/src/Beacon.Plugin/Beacon.Plugin.csproj @@ -4,7 +4,7 @@ Beacon Beacon - 0.1.7.0 + 0.1.8.0 enable diff --git a/tools/publish-release.ps1 b/tools/publish-release.ps1 index 4ca614f..8cdba6b 100644 --- a/tools/publish-release.ps1 +++ b/tools/publish-release.ps1 @@ -29,7 +29,9 @@ try { Copy-Item -LiteralPath 'src/Beacon.Plugin/bin/Release/Beacon/latest.zip' -Destination $destination -Force $hash = Get-FileHash -LiteralPath $destination -Algorithm SHA256 - Set-Content -LiteralPath "$destination.sha256" -Value "$($hash.Hash.ToLowerInvariant()) $([IO.Path]::GetFileName($destination))" -Encoding utf8NoBOM + # -Encoding utf8NoBOM is PowerShell 7 only, and a BOM in a checksum file breaks sha256sum -c. + $checksumLine = "$($hash.Hash.ToLowerInvariant()) $([IO.Path]::GetFileName($destination))" + [IO.File]::WriteAllText("$destination.sha256", $checksumLine + "`n", [Text.UTF8Encoding]::new($false)) Write-Host "Release package: $destination" Write-Host "SHA-256: $($hash.Hash.ToLowerInvariant())" diff --git a/tools/smoke-server.ps1 b/tools/smoke-server.ps1 index 259e259..daa2977 100644 --- a/tools/smoke-server.ps1 +++ b/tools/smoke-server.ps1 @@ -4,6 +4,12 @@ param() $ErrorActionPreference = 'Stop' Set-StrictMode -Version Latest +# Windows PowerShell 5.1 does not load System.Net.Http by default, and the release gate has to be +# runnable on whatever shell the release machine actually has rather than only on PowerShell 7. +if (-not ('System.Net.Http.HttpClient' -as [type])) { + Add-Type -AssemblyName System.Net.Http +} + $repoRoot = Split-Path -Parent $PSScriptRoot $scratch = Join-Path ([System.IO.Path]::GetTempPath()) ("beacon-smoke-" + [guid]::NewGuid().ToString('N')) $published = Join-Path $scratch 'server' @@ -25,7 +31,15 @@ function Get-FreeLoopbackPort { function Start-BeaconServer([int]$Port) { $start = [System.Diagnostics.ProcessStartInfo]::new() $start.FileName = 'dotnet' - $start.ArgumentList.Add((Join-Path $published 'Beacon.Server.dll')) + # ArgumentList is .NET Core only. On Windows PowerShell 5.1 the only way through is the quoted + # Arguments string, and the published path can contain spaces. + $serverDll = Join-Path $published 'Beacon.Server.dll' + if ($null -ne $start.PSObject.Properties['ArgumentList']) { + $start.ArgumentList.Add($serverDll) + } + else { + $start.Arguments = '"' + $serverDll + '"' + } $start.WorkingDirectory = $published $start.UseShellExecute = $false $start.CreateNoWindow = $true @@ -46,7 +60,14 @@ function Stop-BeaconServer($ServerProcess) { return } - $ServerProcess.Kill($true) + # Kill(entireProcessTree) is .NET Core only; 5.1 has the parameterless overload. + try { + $ServerProcess.Kill($true) + } + catch [System.Management.Automation.MethodException] { + $ServerProcess.Kill() + } + $ServerProcess.WaitForExit() $ServerProcess.Dispose() }