Skip to content

utils: Improve build.ps1 build summary report. #80026

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 16, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 28 additions & 6 deletions utils/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -392,18 +392,40 @@ function Add-TimingData {
Arch = $Arch
Platform = $Platform
"Build Step" = $BuildStep
"Elapsed Time" = $ElapsedTime.ToString()
"Elapsed Time" = $ElapsedTime
})
}

function Write-Summary {
Write-Host "Summary:" -ForegroundColor Cyan

# Sort timing data by elapsed time (descending)
$TimingData `
| Select-Object "Build Step",Platform,Arch,"Elapsed Time" `
| Sort-Object -Descending -Property "Elapsed Time" `
| Format-Table -AutoSize
$TotalTime = [TimeSpan]::Zero
foreach ($Entry in $TimingData) {
$TotalTime = $TotalTime.Add($Entry."Elapsed Time")
}

$SortedData = $TimingData | ForEach-Object {
$Percentage = [math]::Round(($_.("Elapsed Time").TotalSeconds / $TotalTime.TotalSeconds) * 100, 1)
$FormattedTime = "{0:hh\:mm\:ss\.ff}" -f $_."Elapsed Time"
[PSCustomObject]@{
"Build Step" = $_."Build Step"
Platform = $_.Platform
Arch = $_.Arch
"Elapsed Time" = $FormattedTime
"%" = "$Percentage%"
}
} | Sort-Object -Descending -Property "%"

$FormattedTotalTime = "{0:hh\:mm\:ss\.ff}" -f $TotalTime
$TotalRow = [PSCustomObject]@{
"Build Step" = "TOTAL"
Platform = ""
Arch = ""
"Elapsed Time" = $FormattedTotalTime
"%" = "100.0%"
}

@($SortedData) + $TotalRow | Format-Table -AutoSize
}

function Get-AndroidNDK {
Expand Down