mirror of https://github.com/aminya/setup-cpp
fix: allow specifying the vcpkg version
This commit is contained in:
parent
55af62e5b4
commit
1818c421dc
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,5 +1,5 @@
|
||||||
import { grantUserWriteAccess } from "admina"
|
import { grantUserWriteAccess } from "admina"
|
||||||
import { notice } from "ci-log"
|
import { info, notice } from "ci-log"
|
||||||
import { execaSync } from "execa"
|
import { execaSync } from "execa"
|
||||||
import { pathExists } from "path-exists"
|
import { pathExists } from "path-exists"
|
||||||
import { addShExt, addShRelativePrefix, dirname, join } from "patha"
|
import { addShExt, addShRelativePrefix, dirname, join } from "patha"
|
||||||
|
@ -16,7 +16,7 @@ import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
|
||||||
let hasVCPKG = false
|
let hasVCPKG = false
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
export async function setupVcpkg(_version: string, setupDir: string, _arch: string): Promise<InstallationInfo> {
|
export async function setupVcpkg(version: string, setupDir: string, _arch: string): Promise<InstallationInfo> {
|
||||||
if (!hasVCPKG || which.sync("vcpkg", { nothrow: true }) === null) {
|
if (!hasVCPKG || which.sync("vcpkg", { nothrow: true }) === null) {
|
||||||
if (process.platform === "linux") {
|
if (process.platform === "linux") {
|
||||||
// vcpkg download and extraction dependencies
|
// vcpkg download and extraction dependencies
|
||||||
|
@ -50,12 +50,23 @@ export async function setupVcpkg(_version: string, setupDir: string, _arch: stri
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// clone if not already exists
|
||||||
if (!(await pathExists(join(setupDir, addShExt("bootstrap-vcpkg", ".bat"))))) {
|
if (!(await pathExists(join(setupDir, addShExt("bootstrap-vcpkg", ".bat"))))) {
|
||||||
execaSync("git", ["clone", "https://github.com/microsoft/vcpkg"], { cwd: dirname(setupDir), stdio: "inherit" })
|
execaSync("git", ["clone", "https://github.com/microsoft/vcpkg"], { cwd: dirname(setupDir), stdio: "inherit" })
|
||||||
} else {
|
} else {
|
||||||
notice(`Vcpkg folder already exists at ${setupDir}. This might mean that ~/vcpkg is restored from the cache.`)
|
notice(`Vcpkg folder already exists at ${setupDir}. Skipping the clone`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if version specified, checkout the version
|
||||||
|
if (!(version in ["", "true"])) {
|
||||||
|
info(`Checking out vcpkg version ${version}`)
|
||||||
|
execaSync("git", ["checkout", version], {
|
||||||
|
cwd: setupDir,
|
||||||
|
stdio: "inherit",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// bootstrap vcpkg
|
||||||
execaSync(addShExt(addShRelativePrefix("bootstrap-vcpkg"), ".bat"), {
|
execaSync(addShExt(addShRelativePrefix("bootstrap-vcpkg"), ".bat"), {
|
||||||
cwd: setupDir,
|
cwd: setupDir,
|
||||||
shell: true,
|
shell: true,
|
||||||
|
|
Loading…
Reference in New Issue