22 lines
673 B
PowerShell
22 lines
673 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
|
|
}
|
|
$command = Get-Command clang-tidy -ErrorAction SilentlyContinue | Select-Object -First 1
|
|
if (!$command) {
|
|
throw "clang-tidy was installed but is not available on PATH. Configure PSC_CLANG_TIDY_EXECUTABLE explicitly."
|
|
}
|
|
& $command.Source --version
|