Skip to content

Commit c93d04a

Browse files
authored
chore(deps): update vcpkg to latest release (#9936)
Also change the scripts to work with both releases and SHAs.
1 parent 6f2519e commit c93d04a

6 files changed

Lines changed: 23 additions & 12 deletions

File tree

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
fetch-depth: 0
3232
- name: Checkout pinned vcpkg version
3333
run: >
34-
git -C build/vcpkg checkout -q $(<ci/etc/vcpkg-commit.txt)
34+
git -C build/vcpkg checkout -q $(<ci/etc/vcpkg-version.txt)
3535
- name: cache-vcpkg
3636
id: cache-vcpkg
3737
uses: actions/cache@v3

ci/cloudbuild/builds/lib/vcpkg.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ source module ci/lib/io.sh
2424

2525
TIMEFORMAT="==> 🕑 vcpkg installed in %R seconds"
2626
time {
27-
VCPKG_COMMIT="$(<ci/etc/vcpkg-commit.txt)"
28-
VCPKG_ROOT_DIR="${HOME}/vcpkg-${VCPKG_COMMIT}"
29-
io::log_h2 "Installing vcpkg ${VCPKG_COMMIT} -> ${VCPKG_ROOT_DIR}"
27+
VCPKG_VERSION="$(<ci/etc/vcpkg-version.txt)"
28+
VCPKG_ROOT_DIR="${HOME}/vcpkg-${VCPKG_VERSION}"
29+
io::log_h2 "Installing vcpkg ${VCPKG_VERSION} -> ${VCPKG_ROOT_DIR}"
3030
if [[ ! -d "${VCPKG_ROOT_DIR}" ]]; then
3131
mkdir -p "${VCPKG_ROOT_DIR}"
3232
# vcpkg needs git history to support versioning, so we clone a recent
3333
# release tag rather than just extracting a tarball without history.
3434
git clone https://github.com/microsoft/vcpkg.git "${VCPKG_ROOT_DIR}"
35-
git -C "${VCPKG_ROOT_DIR}" checkout "${VCPKG_COMMIT}"
35+
git -C "${VCPKG_ROOT_DIR}" checkout "${VCPKG_VERSION}"
3636
pwd
3737
fi
3838
env -C "${VCPKG_ROOT_DIR}" VCPKG_ROOT="${VCPKG_ROOT_DIR}" \

ci/etc/vcpkg-commit.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

ci/etc/vcpkg-version.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2022.09.27

ci/kokoro/lib/vcpkg.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,17 @@ source module /ci/kokoro/lib/gcloud.sh
2626

2727
install_vcpkg() {
2828
local -r vcpkg_dir="$1"
29+
local url
2930

3031
mkdir -p "${vcpkg_dir}"
3132
io::log "Downloading vcpkg into ${vcpkg_dir}..."
32-
VCPKG_COMMIT="$(<ci/etc/vcpkg-commit.txt)"
33-
ci/retry-command.sh 3 120 curl -sSL "https://github.com/microsoft/vcpkg/archive/${VCPKG_COMMIT}.tar.gz" |
33+
VCPKG_VERSION="$(<ci/etc/vcpkg-version.txt)"
34+
url="https://github.com/microsoft/vcpkg/archive/${VCPKG_VERSION}.tar.gz"
35+
if [[ "${VCPKG_VERSION}" =~ [0-9]{4}.[0-9]{2}.[0-9]{2} ]]; then
36+
# vcpkg uses date-like tags for releases
37+
url="https://github.com/microsoft/vcpkg/archive/refs/tags/${VCPKG_VERSION}.tar.gz"
38+
fi
39+
ci/retry-command.sh 3 120 curl -sSL "${url}" |
3440
tar -C "${vcpkg_dir}" --strip-components=1 -zxf -
3541

3642
io::log_h2 "Configure VCPKG to use GCS as a cache"

ci/kokoro/windows/lib/vcpkg.ps1

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,24 +61,29 @@ function Install-Vcpkg {
6161
$vcpkg_root = "${env:SystemDrive}/vcpkg${suffix}"
6262
$extract_root = "${env:SystemDrive}"
6363
}
64-
$vcpkg_version = Get-Content -Path "${project_root}\ci\etc\vcpkg-commit.txt"
6564
# In manual builds the directory already exists, assume it is a good directory and return
6665
if (Test-Path "${vcpkg_root}") {
6766
Write-Host -ForegroundColor Green "$(Get-Date -Format o) vcpkg directory already exists."
6867
return "${vcpkg_root}"
6968
}
7069

70+
$vcpkg_version = Get-Content -Path "${project_root}\ci\etc\vcpkg-version.txt"
71+
$vcpkg_url = "https://github.com/microsoft/vcpkg/archive/${vcpkg_version}.zip"
72+
if ($vcpkg_version -match "[0-9]{4}.[0-9]{2}.[0-9]{2}" ) {
73+
$vcpkg_url = "https://github.com/microsoft/vcpkg/archive/refs/tags/${vcpkg_version}.zip"
74+
}
75+
Write-Host "$(Get-Date -Format o) Downloading vcpkg archive from $vcpkg_url"
76+
7177
# Download the right version of `vcpkg`
7278
ForEach($_ in (1, 2, 3)) {
7379
if ($_ -ne 1) { Start-Sleep -Seconds (60 * $_) }
7480
Write-Host "$(Get-Date -Format o) Downloading vcpkg ports archive [$_]"
7581
try {
76-
(New-Object System.Net.WebClient).Downloadfile(
77-
"https://github.com/microsoft/vcpkg/archive/${vcpkg_version}.zip",
82+
(New-Object System.Net.WebClient).Downloadfile($vcpkg_url,
7883
"${env:TEMP}/${vcpkg_version}.zip") | Write-Host
7984
break
8085
} catch {
81-
Write-Host -ForegroundColor Yellow "`n$(Get-Date -Format o) download error"
86+
Write-Host -ForegroundColor Yellow "`n$(Get-Date -Format o) download error for $vcpkg_url"
8287
}
8388
}
8489
7z x -o"${extract_root}" "${env:TEMP}/${vcpkg_version}.zip" -aoa -bsp0 | Write-Host

0 commit comments

Comments
 (0)