diff --git a/azure-pipelines.yml b/azure-pipelines.yml index af2a5ea4845fd2..e9faf5aff5a7d7 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -174,6 +174,7 @@ jobs: (New-Object Net.WebClient).DownloadFile($downloadUrl, "compat.zip") Expand-Archive compat.zip -DestinationPath . -Force Remove-Item compat.zip + new-item -path "$(Build.SourcesDirectory)/compat/vcbuild" -name NoPrebuildEvent.txt -type "file" -value "Inhibit git.sln PrebuildEvent" displayName: 'Download vcpkg artifacts' - task: MSBuild@1 inputs: diff --git a/compat/vcbuild/vcpkg_install.bat b/compat/vcbuild/vcpkg_install.bat index 8330d8120fb511..5e45b35cba665f 100644 --- a/compat/vcbuild/vcpkg_install.bat +++ b/compat/vcbuild/vcpkg_install.bat @@ -34,7 +34,16 @@ REM ================================================================ @FOR /F "delims=" %%D IN ("%~dp0") DO @SET cwd=%%~fD cd %cwd% - dir vcpkg\vcpkg.exe >nul 2>nul && GOTO :install_libraries +REM the architecture is currently hard-coded, and that we will change that once we need to. + SET arch=x64-windows + +REM is vcpkg package installed and complied? +REM can be inhibited by creating compat\vcbuild\NoPrebuildEvent.txt + + IF EXIST "vcpkg\installed\%arch%\include\openssl\ssl.h" GOTO :check_for_update + +REM is vcpkg package manager already cloned + IF EXIST vcpkg\vcpkg.exe GOTO GOTO :install_libraries git.exe version 2>nul IF ERRORLEVEL 1 ( @@ -53,9 +62,18 @@ REM ================================================================ IF ERRORLEVEL 1 ( EXIT /B 1 ) echo Successfully installed %cwd%vcpkg\vcpkg.exe + GOTO :install_libraries + +:check_for_updates + echo Checking for vcpkg updates and upgrades to installed libraries + cd %cwd%vcpkg + git pull + .\vcpkg.exe update + .\vcpkg.exe upgrade --no-dry-run + + EXIT /B 0 :install_libraries - SET arch=x64-windows echo Installing third-party libraries... FOR %%i IN (zlib expat libiconv openssl libssh2 curl) DO ( @@ -80,11 +98,11 @@ REM ================================================================ :sub__install_one echo Installing package %1... - REM vcpkg may not be reliable on slow, intermittent or proxy - REM connections, see e.g. - REM https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/4a8f7be5-5e15-4213-a7bb-ddf424a954e6/winhttpsendrequest-ends-with-12002-errorhttptimeout-after-21-seconds-no-matter-what-timeout?forum=windowssdk - REM which explains the hidden 21 second timeout - REM (last post by Dave : Microsoft - Windows Networking team) +REM vcpkg may not be reliable on slow, intermittent or proxy +REM connections, see e.g. +REM https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/4a8f7be5-5e15-4213-a7bb-ddf424a954e6/winhttpsendrequest-ends-with-12002-errorhttptimeout-after-21-seconds-no-matter-what-timeout?forum=windowssdk +REM which explains the hidden 21 second timeout +REM (last post by Dave : Microsoft - Windows Networking team) .\vcpkg.exe install %1:%arch% IF ERRORLEVEL 1 ( EXIT /B 1 ) diff --git a/contrib/buildsystems/Generators/Vcxproj.pm b/contrib/buildsystems/Generators/Vcxproj.pm index 5c666f9ac03b01..07bc54e8d6dd53 100644 --- a/contrib/buildsystems/Generators/Vcxproj.pm +++ b/contrib/buildsystems/Generators/Vcxproj.pm @@ -180,9 +180,8 @@ sub createProject { EOM if ($target eq 'libgit') { print F << "EOM"; - - Initialize VCPKG - del "$cdup\\compat\\vcbuild\\vcpkg" + + Initialize or update VCPKG call "$cdup\\compat\\vcbuild\\vcpkg_install.bat" EOM