fix: use notice for ~/vcpkg existence

This commit is contained in:
Amin Yahyaabadi 2022-05-02 21:38:39 -07:00
parent 27b4144004
commit 5b1c9b8d45
4 changed files with 9 additions and 4 deletions

2
dist/setup_cpp.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -13,6 +13,10 @@ export function warning(msg: string) {
return isGitHubCI() ? core.warning(msg) : console.log(`\x1b[33m${msg}\x1b[0m`) return isGitHubCI() ? core.warning(msg) : console.log(`\x1b[33m${msg}\x1b[0m`)
} }
export function notice(msg: string) {
return isGitHubCI() ? core.notice(msg) : console.log(`\x1b[94m${msg}\x1b[0m`)
}
export function info(msg: string) { export function info(msg: string) {
return isGitHubCI() ? core.info(msg) : console.log(msg) return isGitHubCI() ? core.info(msg) : console.log(msg)
} }

View File

@ -1,11 +1,12 @@
import { addPath, warning } from "@actions/core"
import execa from "execa" import execa from "execa"
import { existsSync } from "fs" import { existsSync } from "fs"
import { dirname, join } from "path" import { dirname, join } from "path"
import which from "which" import which from "which"
import { addPath } from "../utils/env/addEnv"
import { isRoot } from "../utils/env/sudo" import { isRoot } from "../utils/env/sudo"
import { execSudo } from "../utils/exec/sudo" import { execSudo } from "../utils/exec/sudo"
import { addShellExtension, addShellHere } from "../utils/extension/extension" import { addShellExtension, addShellHere } from "../utils/extension/extension"
import { notice } from "../utils/io/io"
import { setupAptPack } from "../utils/setup/setupAptPack" import { setupAptPack } from "../utils/setup/setupAptPack"
import { InstallationInfo } from "../utils/setup/setupBin" import { InstallationInfo } from "../utils/setup/setupBin"
@ -27,7 +28,7 @@ export function setupVcpkg(_version: string, setupDir: string, _arch: string): I
if (!existsSync(join(setupDir, addShellExtension("bootstrap-vcpkg")))) { if (!existsSync(join(setupDir, addShellExtension("bootstrap-vcpkg")))) {
execa.sync("git", ["clone", "https://github.com/microsoft/vcpkg"], { cwd: dirname(setupDir), stdio: "inherit" }) execa.sync("git", ["clone", "https://github.com/microsoft/vcpkg"], { cwd: dirname(setupDir), stdio: "inherit" })
} else { } else {
warning(`Vcpkg folder already exists at ${setupDir}`) notice(`Vcpkg folder already exists at ${setupDir}. This might mean that ~/vcpkg is restored from the cache.`)
} }
execa.sync(addShellExtension(addShellHere("bootstrap-vcpkg")), { cwd: setupDir, shell: true, stdio: "inherit" }) execa.sync(addShellExtension(addShellHere("bootstrap-vcpkg")), { cwd: setupDir, shell: true, stdio: "inherit" })