Batch up to 64 files per clang-format to speed it up (#4639)
This will make `Invoke-CodeFormat` less bad.
This commit is contained in:
parent
8392d6b647
commit
deccf7e12b
|
@ -6,6 +6,7 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- checkout: self
|
- checkout: self
|
||||||
|
fetchDepth: 1
|
||||||
submodules: false
|
submodules: false
|
||||||
clean: true
|
clean: true
|
||||||
|
|
||||||
|
|
|
@ -326,11 +326,21 @@ function Invoke-ClangFormat {
|
||||||
[string[]]$Path
|
[string[]]$Path
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Begin {
|
||||||
|
$BatchSize = [int]64
|
||||||
|
$Paths = @()
|
||||||
|
}
|
||||||
|
|
||||||
Process {
|
Process {
|
||||||
ForEach($_ in $Path) {
|
ForEach($_ in $Path) {
|
||||||
|
$Paths += Get-Item $_ -ErrorAction Stop | Select -Expand FullName
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
End {
|
||||||
|
For($i = [int]0; $i -Lt $Paths.Length; $i += $BatchSize) {
|
||||||
Try {
|
Try {
|
||||||
$n = Get-Item $_ -ErrorAction Stop | Select -Expand FullName
|
& "$env:OpenconsoleRoot/dep/llvm/clang-format" -i $Paths[$i .. ($i + $BatchSize - 1)]
|
||||||
& "$env:OpenconsoleRoot/dep/llvm/clang-format" -i $n
|
|
||||||
} Catch {
|
} Catch {
|
||||||
Write-Error $_
|
Write-Error $_
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue