Skip to content

Commit afecdc8

Browse files
author
Takashi Matsuo
authored
testing: Fix build on windows 2019 (#2932)
1 parent 6637725 commit afecdc8

3 files changed

Lines changed: 12 additions & 6 deletions

File tree

ci/kokoro/windows/build-dependencies.ps1

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ if (-not (Test-Path env:CONFIG)) {
2323
}
2424
$CONFIG = $env:CONFIG
2525

26+
# Add 7-zip to Path
27+
$env:Path += ";C:\Program Files\7-Zip"
28+
2629
# Set BUILD_CACHE, defauting to the original value
2730
if (-not (Test-Path env:BUILD_CACHE)) {
2831
$BUILD_CACHE = "gs://cloud-cpp-kokoro-results/" +
@@ -57,18 +60,18 @@ if ($LastExitCode) {
5760

5861
Write-Host "Downloading build cache."
5962
Get-Date -Format o
60-
gsutil cp $BUILD_CACHE .
63+
gsutil cp $BUILD_CACHE vcpkg-installed.zip
6164
if ($LastExitCode) {
6265
# Ignore errors, caching failures should not break the build.
63-
Write-Host "extracting build cache failed with exit code $LastExitCode"
66+
Write-Host "gsutil download failed with exit code $LastExitCode"
6467
}
6568

6669
Write-Host "Extracting build cache."
6770
Get-Date -Format o
68-
cmd /c 7z x vcpkg-installed.zip -aoa
71+
C:\Windows\system32\cmd /c 7z x vcpkg-installed.zip -aoa
6972
if ($LastExitCode) {
7073
# Ignore errors, caching failures should not break the build.
71-
Write-Host "gsutil download failed with exit code $LastExitCode"
74+
Write-Host "extracting build cache failed with exit code $LastExitCode"
7275
}
7376

7477
Write-Host "Bootstrap vcpkg."
@@ -119,7 +122,7 @@ Write-Host "================================================================"
119122
Write-Host "================================================================"
120123
Write-Host "Create cache zip file."
121124
Get-Date -Format o
122-
cmd /c 7z a vcpkg-installed.zip installed\
125+
C:\Windows\system32\cmd /c 7z a vcpkg-installed.zip installed\
123126
if ($LastExitCode) {
124127
# Ignore errors, caching failures should not break the build.
125128
Write-Host "zip build cache failed with exit code $LastExitCode"

ci/kokoro/windows/build-project.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ $CONFIG = $env:CONFIG
2929
$PROVIDER = $env:PROVIDER
3030
$GENERATOR = "Ninja"
3131

32+
# Set TEMP explicitly for windows 2019 image
33+
$Env:TEMP = "T:\tmp\"
34+
3235
# By default assume "module", use the configuration parameters and build in the `cmake-out` directory.
3336
$cmake_flags=@("-G$GENERATOR", "-DCMAKE_BUILD_TYPE=$CONFIG", "-H.", "-Bcmake-out")
3437

ci/kokoro/windows/build.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ set test_errorlevel=%errorlevel%
4444
@rem not interesting artifacts.
4545
echo %date% %time%
4646
cd "%KOKORO_ARTIFACTS_DIR%"
47-
powershell -Command "& {Get-ChildItem -Recurse -File -Exclude test.xml,sponge_log.xml,build.bat | Remove-Item}"
47+
powershell -Command "& {Get-ChildItem -Recurse -File -Exclude test.xml,sponge_log.xml,build.bat | Remove-Item -Recurse -Force}"
4848
if %errorlevel% neq 0 exit /b %errorlevel%
4949

5050
if %test_errorlevel% neq 0 exit /b %test_errorlevel%

0 commit comments

Comments
 (0)