From a4a40c66855b117cddbdc7a8ec73683df40dc308 Mon Sep 17 00:00:00 2001 From: shad0wshayd3 Date: Wed, 7 Feb 2024 11:32:30 -0700 Subject: [PATCH] vcpkg@2024.01.12: Add git repo integration for versioning (#5455) * vcpkg: add git repo integration for versioning * fix schema validation error * persist_dir/dir in quotes, windows style slashes * change git dependency to git suggestion * check for git in PATH to run pre_install steps --- bucket/vcpkg.json | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/bucket/vcpkg.json b/bucket/vcpkg.json index 0ced618cde..268247dbb6 100644 --- a/bucket/vcpkg.json +++ b/bucket/vcpkg.json @@ -3,21 +3,41 @@ "description": "C/C++ dependency manager from Microsoft For all platforms, buildsystems, and workflows", "homepage": "https://vcpkg.io/", "license": "MIT", + "suggest": { + "Git": "git" + }, "url": "https://github.com/microsoft/vcpkg/archive/refs/tags/2024.01.12.zip", "hash": "7d954679548c2b149e101b69223937bb2949fc64d405b31465d07db8363b7f73", "extract_dir": "vcpkg-2024.01.12", + "pre_install": [ + "if (Get-Command \"git.exe\" -ErrorAction SilentlyContinue) {", + " if (!(Test-Path \"$persist_dir\")) {", + " New-Item -ItemType Directory -Path \"$persist_dir\" | Out-Null", + " }", + " if (!(Test-Path \"$persist_dir\\.git\")) {", + " git -C \"$dir\" init --quiet --separate-git-dir \"$persist_dir\\.git\"", + " git -C \"$dir\" remote add -t master origin https://github.com/microsoft/vcpkg", + " } else {", + " Write-Output \"gitdir: $persist_dir\\.git\" | Out-File -FilePath \"$dir\\.git\"", + " }", + " git -C \"$dir\" fetch --quiet --tags", + " git -C \"$dir\" reset --quiet --hard $version", + "} else {", + " Write-Host -F Yellow \"Git was not detected in PATH, skipping repository setup.\"", + "}" + ], "installer": { "file": "bootstrap-vcpkg.bat", "keep": true }, - "bin": "vcpkg.exe", - "env_set": { - "VCPKG_ROOT": "$dir" - }, "post_install": "vcpkg integrate install", "uninstaller": { "script": "vcpkg integrate remove" }, + "bin": "vcpkg.exe", + "env_set": { + "VCPKG_ROOT": "$dir" + }, "persist": [ "buildtrees", "downloads",