Skip to content

Commit 1818c42

Browse files
committed
fix: allow specifying the vcpkg version
1 parent 55af62e commit 1818c42

File tree

7 files changed

+20
-9
lines changed

7 files changed

+20
-9
lines changed

dist/actions/setup-cpp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/actions/setup-cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/legacy/setup-cpp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/legacy/setup-cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/modern/setup-cpp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/modern/setup-cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/vcpkg/vcpkg.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { grantUserWriteAccess } from "admina"
2-
import { notice } from "ci-log"
2+
import { info, notice } from "ci-log"
33
import { execaSync } from "execa"
44
import { pathExists } from "path-exists"
55
import { addShExt, addShRelativePrefix, dirname, join } from "patha"
@@ -16,7 +16,7 @@ import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
1616
let hasVCPKG = false
1717

1818
// eslint-disable-next-line @typescript-eslint/no-unused-vars
19-
export async function setupVcpkg(_version: string, setupDir: string, _arch: string): Promise<InstallationInfo> {
19+
export async function setupVcpkg(version: string, setupDir: string, _arch: string): Promise<InstallationInfo> {
2020
if (!hasVCPKG || which.sync("vcpkg", { nothrow: true }) === null) {
2121
if (process.platform === "linux") {
2222
// vcpkg download and extraction dependencies
@@ -50,12 +50,23 @@ export async function setupVcpkg(_version: string, setupDir: string, _arch: stri
5050
}
5151
}
5252

53+
// clone if not already exists
5354
if (!(await pathExists(join(setupDir, addShExt("bootstrap-vcpkg", ".bat"))))) {
5455
execaSync("git", ["clone", "https://github.com/microsoft/vcpkg"], { cwd: dirname(setupDir), stdio: "inherit" })
5556
} else {
56-
notice(`Vcpkg folder already exists at ${setupDir}. This might mean that ~/vcpkg is restored from the cache.`)
57+
notice(`Vcpkg folder already exists at ${setupDir}. Skipping the clone`)
5758
}
5859

60+
// if version specified, checkout the version
61+
if (!(version in ["", "true"])) {
62+
info(`Checking out vcpkg version ${version}`)
63+
execaSync("git", ["checkout", version], {
64+
cwd: setupDir,
65+
stdio: "inherit",
66+
})
67+
}
68+
69+
// bootstrap vcpkg
5970
execaSync(addShExt(addShRelativePrefix("bootstrap-vcpkg"), ".bat"), {
6071
cwd: setupDir,
6172
shell: true,

0 commit comments

Comments
 (0)