|
- <#
- .SYNOPSIS
- Check that every tool this project needs is installed, and say exactly what to do if not.
-
- .DESCRIPTION
- Looks for each tool in resolved.tools (project.json) in this order: the tool's environment
- variable (for example VICE_HOME or CC65_HOME, pointing at the install folder or its bin
- folder), then PATH, then common install folders. Prints the path and version found, or the
- first command to run and what stays unverified until the tool is installed.
-
- Exit codes: 0 = everything found, 2 = something is missing.
- #>
- [CmdletBinding()]
- param()
- . (Join-Path $PSScriptRoot 'lib.ps1')
-
- $project = Get-ProjectConfig
- $missing = 0
- Write-Host "Prerequisites for $($project.project.name)"
- Write-Host ""
- $ps = $PSVersionTable.PSVersion
- if ($ps.Major -ge 7) { Write-Host (" [ok] PowerShell {0}" -f $ps) -ForegroundColor Green }
- else { Write-Host " [MISSING] PowerShell 7+ (running $ps). First step: winget install --id Microsoft.PowerShell -e" -ForegroundColor Yellow; $missing++ }
-
- $git = Get-Command git -ErrorAction SilentlyContinue
- if ($git) { Write-Host (" [ok] {0}" -f ((& git --version) -join '')) -ForegroundColor Green }
- else { Write-Host " [MISSING] git. First step: winget install --id Git.Git -e" -ForegroundColor Yellow; $missing++ }
-
- foreach ($tool in @($project.resolved.tools)) {
- $path = Find-ToolPath $tool
- if ($path) {
- $ver = Get-ToolVersion $tool $path
- Write-Host (" [ok] {0,-7} {1}" -f $tool.executable, $ver) -ForegroundColor Green
- Write-Host (" {0}" -f $path)
- Write-Host (" verified with: {0}" -f $tool.verifiedVersion)
- } else {
- $missing++
- Write-Host (" [MISSING] {0} - {1}" -f $tool.executable, $tool.purpose) -ForegroundColor Yellow
- Write-Host (" First step : {0}" -f $tool.install.firstCommand)
- Write-Host (" Source : {0}" -f $tool.install.source)
- Write-Host (" Or set {0} to the install folder." -f $tool.envVar)
- Write-Host (" Unverified until installed: {0}" -f (@($tool.requiredFor) -join '; '))
- }
- }
- Write-Host ""
- if ($missing) { Write-Host "$missing prerequisite(s) missing." -ForegroundColor Yellow; exit 2 }
- Write-Host "All prerequisites found. Next: pwsh -File tools/smoke.ps1"
- exit 0
|