Skip to content

Commit b920a0e

Browse files
committed
chore: add debug logs around vcpkg install
1 parent dc2eaf8 commit b920a0e

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

ci/kokoro/windows/builds/cmake.ps1

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,40 @@ $vcpkg_root = Install-Vcpkg "${project_root}" ""
4545
$binary_dir="cmake-out/${BuildName}"
4646
# Install all dependencies from the vcpkg.json manifest file.
4747
# This mirrors the behavior of our GHA builds.
48+
Write-Host -ForegroundColor Yellow "Attempting vcpkg install..."
4849
& "${vcpkg_root}/vcpkg.exe" install --triplet "${env:VCPKG_TRIPLET}"
4950

51+
# Manually check the exit code. vcpkg might not be throwing a terminating error.
52+
if ($LastExitCode -ne 0) {
53+
Write-Host -ForegroundColor Red "----------------------------------------------------------------"
54+
Write-Host -ForegroundColor Red "vcpkg install FAILED with exit code $LastExitCode."
55+
Write-Host -ForegroundColor Red "Dumping vcpkg buildtree logs for crc32c..."
56+
Write-Host -ForegroundColor Red "----------------------------------------------------------------"
57+
58+
# Define the log files based on the error message
59+
$log1 = "${vcpkg_root}/buildtrees/crc32c/config-x64-windows-static-out.log"
60+
$log2 = "${vcpkg_root}/buildtrees/crc32c/config-x64-windows-static-dbg-CMakeCache.txt.log"
61+
$log3 = "${vcpkg_root}/buildtrees/crc32c/config-x64-windows-static-rel-CMakeCache.txt.log"
62+
63+
foreach ($logFile in @($log1, $log2, $log3)) {
64+
if (Test-Path $logFile) {
65+
Write-Host -ForegroundColor Red "========= Contents of $logFile ========="
66+
Get-Content $logFile
67+
Write-Host -ForegroundColor Red "========= End of $logFile ========="
68+
} else {
69+
Write-Host -ForegroundColor Yellow "Log file not found, skipping: $logFile"
70+
}
71+
}
72+
73+
Write-Host -ForegroundColor Red "----------------------------------------------------------------"
74+
Write-Host -ForegroundColor Red "Dumping complete. Forcing build failure."
75+
Write-Host -ForegroundColor Red "----------------------------------------------------------------"
76+
# Manually fail the build with the exit code from vcpkg
77+
exit $LastExitCode
78+
}
79+
80+
Write-Host -ForegroundColor Green "vcpkg install SUCCEEDED."
81+
5082
$cmake_args=@(
5183
"-G$env:GENERATOR",
5284
"-S", ".",

0 commit comments

Comments
 (0)