mirror of
https://github.com/herdrdev/herdr.git
synced 2026-09-21 16:01:04 +00:00
Native Windows lint and check only clippy-checked the herdr binary, while macOS and Linux run clippy across all targets. Enable --all-targets on Windows and gate the Unix-only test helpers that this exposed so Windows check matches the Unix one.
48 lines
1.1 KiB
PowerShell
48 lines
1.1 KiB
PowerShell
param(
|
|
[ValidateSet("lint", "check")]
|
|
[string]$Mode = "check"
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
function Invoke-Checked {
|
|
param([string]$Command, [string[]]$Arguments)
|
|
|
|
& $Command @Arguments
|
|
if ($LASTEXITCODE -ne 0) {
|
|
throw "command failed with exit code $LASTEXITCODE`: $Command $($Arguments -join ' ')"
|
|
}
|
|
}
|
|
|
|
function Invoke-CargoWithZigCacheRecovery {
|
|
param([string[]]$Arguments)
|
|
|
|
& cargo @Arguments
|
|
if ($LASTEXITCODE -eq 0) {
|
|
return
|
|
}
|
|
|
|
Write-Warning "cargo compile failed; clearing Zig build caches and retrying once"
|
|
Remove-Item -Recurse -Force .zig-cache -ErrorAction SilentlyContinue
|
|
Remove-Item -Recurse -Force vendor/libghostty-vt/.zig-cache -ErrorAction SilentlyContinue
|
|
Remove-Item -Recurse -Force vendor/libghostty-vt/zig-out -ErrorAction SilentlyContinue
|
|
Invoke-Checked cargo $Arguments
|
|
}
|
|
|
|
Invoke-Checked cargo @("fmt", "--check")
|
|
Invoke-CargoWithZigCacheRecovery @(
|
|
"clippy",
|
|
"--all-targets",
|
|
"--locked",
|
|
"--",
|
|
"-D",
|
|
"warnings"
|
|
)
|
|
|
|
if ($Mode -eq "lint") {
|
|
return
|
|
}
|
|
|
|
Invoke-Checked just @("test")
|
|
Invoke-Checked cargo @("build", "--locked")
|