22 lines
602 B
PowerShell
22 lines
602 B
PowerShell
param(
|
|
[string]$Version = "",
|
|
[switch]$Force
|
|
)
|
|
$ErrorActionPreference = "Stop"
|
|
$arguments = @("install", "--id", "LLVM.LLVM", "--exact", "--silent", "--accept-package-agreements", "--accept-source-agreements", "--disable-interactivity")
|
|
if ($Version) {
|
|
$arguments += @("--version", $Version)
|
|
}
|
|
if ($Force) {
|
|
$arguments += "--force"
|
|
}
|
|
& winget @arguments
|
|
if ($LASTEXITCODE -ne 0) {
|
|
exit $LASTEXITCODE
|
|
}
|
|
$clangTidy = "C:\Program Files\LLVM\bin\clang-tidy.exe"
|
|
if (!(Test-Path -LiteralPath $clangTidy)) {
|
|
throw "clang-tidy was not installed at $clangTidy"
|
|
}
|
|
& $clangTidy --version
|