Skip to content

Commit 17c1f4b

Browse files
authored
Merge pull request #71355 from compnerd/summary
utils: introduce new `-Summary` option for `build.ps1`
2 parents f5cce47 + b58792e commit 17c1f4b

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

utils/build-windows-toolchain.bat

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ powershell.exe -ExecutionPolicy RemoteSigned -File %~dp0build.ps1 ^
7777
-ImageRoot %BuildRoot% ^
7878
%SkipPackagingArg% ^
7979
%TestArg% ^
80-
-Stage %PackageRoot% || (exit /b 1)
80+
-Stage %PackageRoot% ^
81+
-Summary || (exit /b 1)
8182

8283
:: Clean up the module cache
8384
rd /s /q %LocalAppData%\clang\ModuleCache

utils/build.ps1

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ param(
107107
[switch] $Clean,
108108
[switch] $DebugInfo,
109109
[switch] $EnableCaching,
110+
[switch] $Summary,
110111
[switch] $ToBatch
111112
)
112113

@@ -204,6 +205,8 @@ $HostArch = switch ($NativeProcessorArchName) {
204205
default { throw "Unsupported processor architecture" }
205206
}
206207

208+
$TimingData = New-Object System.Collections.Generic.List[System.Object]
209+
207210
function Get-InstallDir($Arch) {
208211
if ($Arch -eq $HostArch) {
209212
$ProgramFilesName = "Program Files"
@@ -760,6 +763,15 @@ function Build-CMakeProject {
760763
Write-Host -ForegroundColor Cyan "[$([DateTime]::Now.ToString("yyyy-MM-dd HH:mm:ss"))] Finished building '$Src' to '$Bin' for arch '$($Arch.ShortName)' in $($Stopwatch.Elapsed)"
761764
Write-Host ""
762765
}
766+
767+
if ($Summary) {
768+
$TimingData.Add([PSCustomObject]@{
769+
Arch = $Arch.ShortName
770+
Checkout = $Src
771+
BuildID = Split-Path -Path $Bin -Leaf
772+
"Elapsed Time" = $Stopwatch.Elapsed.ToString()
773+
})
774+
}
763775
}
764776

765777
function Build-SPMProject {
@@ -811,6 +823,15 @@ function Build-SPMProject {
811823
Write-Host -ForegroundColor Cyan "[$([DateTime]::Now.ToString("yyyy-MM-dd HH:mm:ss"))] Finished building '$Src' to '$Bin' for arch '$($Arch.ShortName)' in $($Stopwatch.Elapsed)"
812824
Write-Host ""
813825
}
826+
827+
if ($Summary) {
828+
$TimingData.Add([PSCustomObject]@{
829+
Arch = $Arch.ShortName
830+
Checkout = $Src
831+
BuildID = Split-Path -Path $Bin -Leaf
832+
"Elapsed Time" = $Stopwatch.Elapsed.ToString()
833+
})
834+
}
814835
}
815836

816837
function Build-WiXProject() {
@@ -1860,6 +1881,10 @@ if ($Stage) {
18601881
Stage-BuildArtifacts $HostArch
18611882
}
18621883

1884+
if ($Summary) {
1885+
$TimingData | Select Arch,Checkout,BuildID,"Elapsed Time" | Sort -Descending -Property "Elapsed Time" | Format-Table -AutoSize
1886+
}
1887+
18631888
if ($Test -ne $null -and (Compare-Object $Test @("clang", "lld", "lldb", "llvm", "swift") -PassThru -IncludeEqual -ExcludeDifferent) -ne $null) {
18641889
$Tests = @{
18651890
"-TestClang" = $Test -contains "clang";

0 commit comments

Comments
 (0)