您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

49 行
2.3KB

  1. <#
  2. .SYNOPSIS
  3. Check that every tool this project needs is installed, and say exactly what to do if not.
  4. .DESCRIPTION
  5. Looks for each tool in resolved.tools (project.json) in this order: the tool's environment
  6. variable (for example VICE_HOME or CC65_HOME, pointing at the install folder or its bin
  7. folder), then PATH, then common install folders. Prints the path and version found, or the
  8. first command to run and what stays unverified until the tool is installed.
  9. Exit codes: 0 = everything found, 2 = something is missing.
  10. #>
  11. [CmdletBinding()]
  12. param()
  13. . (Join-Path $PSScriptRoot 'lib.ps1')
  14. $project = Get-ProjectConfig
  15. $missing = 0
  16. Write-Host "Prerequisites for $($project.project.name)"
  17. Write-Host ""
  18. $ps = $PSVersionTable.PSVersion
  19. if ($ps.Major -ge 7) { Write-Host (" [ok] PowerShell {0}" -f $ps) -ForegroundColor Green }
  20. else { Write-Host " [MISSING] PowerShell 7+ (running $ps). First step: winget install --id Microsoft.PowerShell -e" -ForegroundColor Yellow; $missing++ }
  21. $git = Get-Command git -ErrorAction SilentlyContinue
  22. if ($git) { Write-Host (" [ok] {0}" -f ((& git --version) -join '')) -ForegroundColor Green }
  23. else { Write-Host " [MISSING] git. First step: winget install --id Git.Git -e" -ForegroundColor Yellow; $missing++ }
  24. foreach ($tool in @($project.resolved.tools)) {
  25. $path = Find-ToolPath $tool
  26. if ($path) {
  27. $ver = Get-ToolVersion $tool $path
  28. Write-Host (" [ok] {0,-7} {1}" -f $tool.executable, $ver) -ForegroundColor Green
  29. Write-Host (" {0}" -f $path)
  30. Write-Host (" verified with: {0}" -f $tool.verifiedVersion)
  31. } else {
  32. $missing++
  33. Write-Host (" [MISSING] {0} - {1}" -f $tool.executable, $tool.purpose) -ForegroundColor Yellow
  34. Write-Host (" First step : {0}" -f $tool.install.firstCommand)
  35. Write-Host (" Source : {0}" -f $tool.install.source)
  36. Write-Host (" Or set {0} to the install folder." -f $tool.envVar)
  37. Write-Host (" Unverified until installed: {0}" -f (@($tool.requiredFor) -join '; '))
  38. }
  39. }
  40. Write-Host ""
  41. if ($missing) { Write-Host "$missing prerequisite(s) missing." -ForegroundColor Yellow; exit 2 }
  42. Write-Host "All prerequisites found. Next: pwsh -File tools/smoke.ps1"
  43. exit 0

Powered by TurnKey Linux.