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:
|
||||
- checkout: self
|
||||
fetchDepth: 1
|
||||
submodules: false
|
||||
clean: true
|
||||
|
||||
|
|
|
@ -326,11 +326,21 @@ function Invoke-ClangFormat {
|
|||
[string[]]$Path
|
||||
)
|
||||
|
||||
Begin {
|
||||
$BatchSize = [int]64
|
||||
$Paths = @()
|
||||
}
|
||||
|
||||
Process {
|
||||
ForEach($_ in $Path) {
|
||||
$Paths += Get-Item $_ -ErrorAction Stop | Select -Expand FullName
|
||||
}
|
||||
}
|
||||
|
||||
End {
|
||||
For($i = [int]0; $i -Lt $Paths.Length; $i += $BatchSize) {
|
||||
Try {
|
||||
$n = Get-Item $_ -ErrorAction Stop | Select -Expand FullName
|
||||
& "$env:OpenconsoleRoot/dep/llvm/clang-format" -i $n
|
||||
& "$env:OpenconsoleRoot/dep/llvm/clang-format" -i $Paths[$i .. ($i + $BatchSize - 1)]
|
||||
} Catch {
|
||||
Write-Error $_
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue