Skip to content

Commit

Permalink
Merge 23dce17 into ec06477
Browse files Browse the repository at this point in the history
  • Loading branch information
lukka committed Jul 13, 2022
2 parents ec06477 + 23dce17 commit bb6f675
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 66 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build-test.yml
Expand Up @@ -72,6 +72,8 @@ jobs:
# This forces the creation of a new cache entry each time the workflow is run.
# It is the same across jobs in the same workflows.
appendedCacheKey: ${{ env.GITHUB_RUN_ID }}
env:
VCPKG_INSTALLED_DIR: ${{ github.workspace }}/vcpkg_installed

tests_with_cache_hit:
needs: tests
Expand Down
6 changes: 5 additions & 1 deletion README.md
Expand Up @@ -72,7 +72,11 @@ jobs:

# This is the glob expression used to locate the vcpkg.json and add its
# hash to the cache key. Change it to match a single manifest file you want
# to use.
# to use.
# Note: do not use `${{ github.context }}` to compose the value as it
# contains backslashes that would be misinterpreted. Instead
# compose a value relative to the root of the repository using
# `**/path/from/root/of/repo/to/vcpkg.json` to match the desired `vcpkg.json`.
# vcpkgJsonGlob: '**/vcpkg.json'

# This is needed to run `vcpkg install` command (after vcpkg is built) in
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Expand Up @@ -39,7 +39,7 @@ inputs:
vcpkgJsonGlob:
default: '**/vcpkg.json'
required: false
description: "Specify the glob expression used to discover the vcpkg.json whose content's hash is added to the cache key."
description: "Specify the glob expression used to discover the vcpkg.json whose content's hash is added to the cache key. On Windows runners using `github.workspace` context to form the expression would not work as expected since it contains backslashes. Use instead `**/path/to/vcpkg.json` to match the desired `vcpkg.json` file."
vcpkgJsonIgnores:
default: "['**/vcpkg/**']"
required: false
Expand Down
16 changes: 11 additions & 5 deletions dist/index.js
Expand Up @@ -5955,7 +5955,7 @@ function copyFile(srcFile, destFile, force) {

"use strict";

// Copyright (c) 2019-2020-2021 Luca Cappa
// Copyright (c) 2019-2020-2021-2022 Luca Cappa
// Released under the term specified in file LICENSE.txt
// SPDX short identifier: MIT
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
Expand Down Expand Up @@ -6445,7 +6445,7 @@ __exportStar(__nccwpck_require__(7447), exports);

"use strict";

// Copyright (c) 2019-2020-2021 Luca Cappa
// Copyright (c) 2019-2020-2021-2022 Luca Cappa
// Released under the term specified in file LICENSE.txt
// SPDX short identifier: MIT
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
Expand Down Expand Up @@ -6856,6 +6856,7 @@ function _debug(msg) {
if (process.env.DEBUG)
console.log(`DEBUG: '${msg}'`);
}
// Remark: the output of replaceFromEnvVar is always passed thru eval().
function replaceFromEnvVar(text, values) {
return text.replace(/\$\[(.*?)\]/gi, (a, b) => {
var _a;
Expand All @@ -6864,6 +6865,9 @@ function replaceFromEnvVar(text, values) {
if (b.startsWith("env.")) {
b = b.slice(4);
ret = (_a = process.env[b]) !== null && _a !== void 0 ? _a : `${b}-is-undefined`;
// Issue https://github.com/lukka/run-vcpkg/issues/144
// Ensure backslashes are preserved: escape them before passing the value into 'eval()'.
ret = ret.replace(/\\/g, '\\\\');
}
else {
ret = `${b}-is-undefined`;
Expand Down Expand Up @@ -6933,7 +6937,7 @@ __exportStar(__nccwpck_require__(6188), exports);

"use strict";

// Copyright (c) 2019-2020-2021 Luca Cappa
// Copyright (c) 2019-2020-2021-2022 Luca Cappa
// Released under the term specified in file LICENSE.txt
// SPDX short identifier: MIT
Object.defineProperty(exports, "__esModule", ({ value: true }));
Expand All @@ -6954,7 +6958,7 @@ exports.VCPKG_CONFIGURATION_JSON = "vcpkg-configuration.json";

"use strict";

// Copyright (c) 2019-2020-2021 Luca Cappa
// Copyright (c) 2019-2020-2021-2022 Luca Cappa
// Released under the term specified in file LICENSE.txt
// SPDX short identifier: MIT
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
Expand Down Expand Up @@ -7025,7 +7029,9 @@ class VcpkgRunner {
else {
vcpkgInstallCmd = baseutillib.replaceFromEnvVar(vcpkgInstallCmd);
}
baseUtil.baseLib.debug(`vcpkgInstallCmd=${vcpkgInstallCmd}`);
const vcpkgInstallArgs = eval(vcpkgInstallCmd);
baseUtil.baseLib.debug(`vcpkgInstallArgs=${vcpkgInstallArgs}`);
// Git update or clone depending on content of vcpkgDestPath input parameter.
const pathToLastBuiltCommitId = path.join(vcpkgDestPath, globals.vcpkgLastBuiltCommitId);
const logFilesCollector = new baseutillib.LogFileCollector(baseUtil.baseLib, logCollectionRegExps, (path) => baseutillib.dumpFile(baseUtil.baseLib, path));
Expand Down Expand Up @@ -7340,7 +7346,7 @@ VcpkgRunner.VCPKG_DISABLE_METRICS = "VCPKG_DISABLE_METRICS";

"use strict";

// Copyright (c) 2020-2021 Luca Cappa
// Copyright (c) 2020-2021-2022 Luca Cappa
// Released under the term specified in file LICENSE.txt
// SPDX short identifier: MIT
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
Expand Down
16 changes: 11 additions & 5 deletions dist/post/index.js
Expand Up @@ -6018,7 +6018,7 @@ function copyFile(srcFile, destFile, force) {

"use strict";

// Copyright (c) 2019-2020-2021 Luca Cappa
// Copyright (c) 2019-2020-2021-2022 Luca Cappa
// Released under the term specified in file LICENSE.txt
// SPDX short identifier: MIT
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
Expand Down Expand Up @@ -6508,7 +6508,7 @@ __exportStar(__nccwpck_require__(7447), exports);

"use strict";

// Copyright (c) 2019-2020-2021 Luca Cappa
// Copyright (c) 2019-2020-2021-2022 Luca Cappa
// Released under the term specified in file LICENSE.txt
// SPDX short identifier: MIT
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
Expand Down Expand Up @@ -6919,6 +6919,7 @@ function _debug(msg) {
if (process.env.DEBUG)
console.log(`DEBUG: '${msg}'`);
}
// Remark: the output of replaceFromEnvVar is always passed thru eval().
function replaceFromEnvVar(text, values) {
return text.replace(/\$\[(.*?)\]/gi, (a, b) => {
var _a;
Expand All @@ -6927,6 +6928,9 @@ function replaceFromEnvVar(text, values) {
if (b.startsWith("env.")) {
b = b.slice(4);
ret = (_a = process.env[b]) !== null && _a !== void 0 ? _a : `${b}-is-undefined`;
// Issue https://github.com/lukka/run-vcpkg/issues/144
// Ensure backslashes are preserved: escape them before passing the value into 'eval()'.
ret = ret.replace(/\\/g, '\\\\');
}
else {
ret = `${b}-is-undefined`;
Expand Down Expand Up @@ -6996,7 +7000,7 @@ __exportStar(__nccwpck_require__(6188), exports);

"use strict";

// Copyright (c) 2019-2020-2021 Luca Cappa
// Copyright (c) 2019-2020-2021-2022 Luca Cappa
// Released under the term specified in file LICENSE.txt
// SPDX short identifier: MIT
Object.defineProperty(exports, "__esModule", ({ value: true }));
Expand All @@ -7017,7 +7021,7 @@ exports.VCPKG_CONFIGURATION_JSON = "vcpkg-configuration.json";

"use strict";

// Copyright (c) 2019-2020-2021 Luca Cappa
// Copyright (c) 2019-2020-2021-2022 Luca Cappa
// Released under the term specified in file LICENSE.txt
// SPDX short identifier: MIT
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
Expand Down Expand Up @@ -7088,7 +7092,9 @@ class VcpkgRunner {
else {
vcpkgInstallCmd = baseutillib.replaceFromEnvVar(vcpkgInstallCmd);
}
baseUtil.baseLib.debug(`vcpkgInstallCmd=${vcpkgInstallCmd}`);
const vcpkgInstallArgs = eval(vcpkgInstallCmd);
baseUtil.baseLib.debug(`vcpkgInstallArgs=${vcpkgInstallArgs}`);
// Git update or clone depending on content of vcpkgDestPath input parameter.
const pathToLastBuiltCommitId = path.join(vcpkgDestPath, globals.vcpkgLastBuiltCommitId);
const logFilesCollector = new baseutillib.LogFileCollector(baseUtil.baseLib, logCollectionRegExps, (path) => baseutillib.dumpFile(baseUtil.baseLib, path));
Expand Down Expand Up @@ -7403,7 +7409,7 @@ VcpkgRunner.VCPKG_DISABLE_METRICS = "VCPKG_DISABLE_METRICS";

"use strict";

// Copyright (c) 2020-2021 Luca Cappa
// Copyright (c) 2020-2021-2022 Luca Cappa
// Released under the term specified in file LICENSE.txt
// SPDX short identifier: MIT
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
Expand Down
98 changes: 49 additions & 49 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Expand Up @@ -43,11 +43,11 @@
"@actions/exec": "^1.1.0",
"@actions/github": "^5.0.0",
"@actions/io": "^1.0.1",
"@lukka/action-lib": "2.0.5",
"@lukka/assets-lib": "2.0.5",
"@lukka/base-lib": "2.0.5",
"@lukka/base-util-lib": "2.0.5",
"@lukka/run-vcpkg-lib": "2.0.5",
"@lukka/action-lib": "2.0.6",
"@lukka/assets-lib": "2.0.6",
"@lukka/base-lib": "2.0.6",
"@lukka/base-util-lib": "2.0.6",
"@lukka/run-vcpkg-lib": "2.0.6",
"@types/adm-zip": "^0.4.32",
"@types/follow-redirects": "^1.8.0",
"@types/jest": "^26.0.14",
Expand Down

0 comments on commit bb6f675

Please sign in to comment.