# Runs luac55 -p (parse-only) over every service script and every Lua # source file, since this Windows box has no way to actually load/execute # anything that touches POSIX (require("s6exec"), /proc, etc.). param() $ErrorActionPreference = "Stop" $repoRoot = Split-Path -Parent $PSScriptRoot $luac = (Get-Command luac55 -ErrorAction SilentlyContinue).Source if (-not $luac) { $luac = "C:\Program Files\lua-5.5.0_Win64_bin\luac55.exe" } $scriptNames = @('run', 'up', 'down', 'finish', 'reload', 'check') $targets = @() $targets += Get-ChildItem -Path (Join-Path $repoRoot 'services') -Recurse -File | Where-Object { $scriptNames -contains $_.Name } $targets += Get-ChildItem -Path (Join-Path $repoRoot 'src') -Recurse -File -Filter '*.lua' $targets += Get-ChildItem -Path (Join-Path $repoRoot 'tools') -Recurse -File -Filter '*.lua' $failed = @() foreach ($t in $targets) { & $luac -p $t.FullName if ($LASTEXITCODE -ne 0) { $failed += $t.FullName } } Write-Host "" Write-Host "Checked $($targets.Count) file(s)." if ($failed.Count -gt 0) { Write-Host "FAILED syntax check on $($failed.Count) file(s):" -ForegroundColor Red $failed | ForEach-Object { Write-Host " $_" -ForegroundColor Red } exit 1 } Write-Host "All files parsed OK." -ForegroundColor Green