Files
lib-privatebin/scripts/collect_binaries.ps1

31 lines
955 B
PowerShell

param(
[Parameter(Mandatory=$true)][string]$OutDir
)
$ErrorActionPreference = 'Stop'
New-Item -ItemType Directory -Force -Path $OutDir | Out-Null
$items = @(
@{ Path = 'build/Release/privatebinapi.dll'; Optional = $false }
@{ Path = 'build/Release/privatebinapi.lib'; Optional = $true }
@{ Path = 'build/Release/privatebinapi.pdb'; Optional = $true }
@{ Path = 'build/example/Release/example.exe'; Optional = $true }
)
foreach ($it in $items) {
$p = Resolve-Path -LiteralPath $it.Path -ErrorAction SilentlyContinue
if ($null -ne $p) {
Copy-Item -LiteralPath $p.Path -Destination $OutDir -Force
Write-Host ("Collected: " + [IO.Path]::GetFileName($p.Path))
} elseif (-not $it.Optional) {
throw "Required artifact not found: $($it.Path)"
} else {
Write-Host ("Skip missing optional: " + $it.Path)
}
}
Get-ChildItem -LiteralPath $OutDir -File | Format-Table Name,Length -AutoSize