Skip to content

Commit

Permalink
- doNotCache default's is true
Browse files Browse the repository at this point in the history
- add vcpkg to PATH
- code fix ups
  • Loading branch information
lukka committed Apr 2, 2023
1 parent a5d1f94 commit 6c327c7
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 67 deletions.
4 changes: 2 additions & 2 deletions action.yml
Expand Up @@ -28,9 +28,9 @@ inputs:
required: false
description: "Avoid to update vcpkg (launching git) in the specified 'vcpkgDirectory'. This is useful when vcpkg is being checkout independently of the run-vcpkg action. Default is false."
doNotCache:
default: false
default: true
required: false
description: "Disable the run-vcpkg's automatic caching mechanism by setting it to true. Default is false. This does not disable vcpkg's binary cache which is always on."
description: "Enable the caching of the vcpkg executable and its data files (e.g. ports) by setting it to false. Default is true. Set this input to false when the vcpkg's executable is not delivered as a prebuilt file upon bootstrapping vcpkg. This does not disable vcpkg's binary cache which is always on and can be controlled by the user with the env var VCPKG_BINARY_SOURCES."

# The following inputs are rarely set by the user, since the default values suffice the most common scenarios.
vcpkgJsonGlob:
Expand Down
16 changes: 11 additions & 5 deletions dist/index.js
Expand Up @@ -94,17 +94,19 @@ class VcpkgAction {
constructor(baseUtilLib) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
this.baseUtilLib = baseUtilLib;
this.doNotCache = false;
this.doNotCache = true;
this.runVcpkgInstall = false;
this.doNotUpdateVcpkg = false;
// Fetch inputs.
const vcpkgRootDir = baseUtilLib.baseLib.getPathInput(exports.vcpkgDirectoryInput, false, false);
this.vcpkgRootDir = vcpkgRootDir ? path.normalize(path.resolve(vcpkgRootDir)) : null;
this.userProvidedCommitId = (_a = baseUtilLib.baseLib.getInput(exports.vcpkgCommitIdInput, false)) !== null && _a !== void 0 ? _a : null;
this.runVcpkgFormatString = (_b = baseUtilLib.baseLib.getInput(exports.runVcpkgFormatStringInput, false)) !== null && _b !== void 0 ? _b : null;
this.vcpkgJsonGlob = (_c = baseUtilLib.baseLib.getInput(exports.vcpkgJsonGlobInput, false)) !== null && _c !== void 0 ? _c : VcpkgAction.VCPKGJSON_GLOB;
this.vcpkgJsonIgnores = eval((_d = baseUtilLib.baseLib.getInput(exports.vcpkgJsonIgnoresInput, false)) !== null && _d !== void 0 ? _d : VcpkgAction.VCPKGJSON_IGNORES);
this.runVcpkgInstall = (_e = baseUtilLib.baseLib.getBoolInput(exports.runVcpkgInstallInput, false)) !== null && _e !== void 0 ? _e : false;
this.doNotCache = (_f = baseUtilLib.baseLib.getBoolInput(exports.doNotCacheInput, false)) !== null && _f !== void 0 ? _f : false;
this.doNotUpdateVcpkg = (_g = baseUtilLib.baseLib.getBoolInput(exports.doNotUpdateVcpkgInput, false)) !== null && _g !== void 0 ? _g : false;
this.runVcpkgInstall = (_e = baseUtilLib.baseLib.getBoolInput(exports.runVcpkgInstallInput, false)) !== null && _e !== void 0 ? _e : this.runVcpkgInstall;
this.doNotCache = (_f = baseUtilLib.baseLib.getBoolInput(exports.doNotCacheInput, false)) !== null && _f !== void 0 ? _f : this.doNotCache;
this.doNotUpdateVcpkg = (_g = baseUtilLib.baseLib.getBoolInput(exports.doNotUpdateVcpkgInput, false)) !== null && _g !== void 0 ? _g : this.doNotUpdateVcpkg;
this.vcpkgUrl = (_h = baseUtilLib.baseLib.getInput(exports.vcpkgUrlInput, false)) !== null && _h !== void 0 ? _h : VcpkgAction.DEFAULTVCPKGURL;
this.vcpkgCommitId = (_j = baseUtilLib.baseLib.getInput(exports.vcpkgCommitIdInput, false)) !== null && _j !== void 0 ? _j : null;
this.logCollectionRegExps = (_k = baseUtilLib.baseLib.getDelimitedInput(exports.logCollectionRegExpsInput, ';', false)) !== null && _k !== void 0 ? _k : [];
Expand Down Expand Up @@ -149,7 +151,7 @@ class VcpkgAction {
const isCacheHit = yield this.baseUtilLib.wrapOp('Restore vcpkg installation from cache (not the packages, that is done by vcpkg via binary caching using GitHub Action cache)', () => __awaiter(this, void 0, void 0, function* () { return yield this.restoreCache(keys); }));
const vcpkgJsonPath = yield this.getCurrentDirectoryForRunningVcpkg(vcpkgJsonFilePath);
yield runvcpkglib.VcpkgRunner.run(this.baseUtilLib, this.vcpkgRootDir, this.vcpkgUrl, this.vcpkgCommitId, this.runVcpkgInstall, this.doNotUpdateVcpkg, this.logCollectionRegExps, vcpkgJsonPath, this.runVcpkgFormatString);
yield this.saveCache(isCacheHit, keys, vcpkgutil.Utils.getAllCachedPaths(this.baseUtilLib.baseLib, this.vcpkgRootDir // HACK: if it were not set it would have thrown before.
yield this.saveCache(isCacheHit, keys, vcpkgutil.Utils.getAllCachedPaths(this.baseUtilLib.baseLib, this.vcpkgRootDir // HACK: if it were not set it would have thrown an exception before.
), this.doNotCache, true);
this.baseUtilLib.baseLib.debug("run()>>");
});
Expand Down Expand Up @@ -42276,6 +42278,9 @@ class ActionLib {
hashFiles(fileGlob, options) {
return actionglob.hashFiles(fileGlob, options);
}
addPath(path) {
core.addPath(path);
}
}
exports.ActionLib = ActionLib;
//# sourceMappingURL=action-lib.js.map
Expand Down Expand Up @@ -44154,6 +44159,7 @@ class VcpkgRunner {
if (needRebuild) {
yield this.baseUtils.wrapOp("Build vcpkg executable", () => this.build());
}
this.baseUtils.wrapOpSync(`Add to PATH vcpkg at '${this.vcpkgDestPath}'`, () => this.baseUtils.baseLib.addPath(this.vcpkgDestPath));
yield this.runVcpkgInstall();
this.baseUtils.wrapOpSync("Set output environment variables", () => this.setOutputs());
this.baseUtils.baseLib.debug("runImpl()>>");
Expand Down
94 changes: 47 additions & 47 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.1",
"@actions/github": "^5.0.3",
"@actions/io": "^1.1.2",
"@lukka/action-lib": "3.5.0",
"@lukka/assets-lib": "3.5.0",
"@lukka/base-lib": "3.5.0",
"@lukka/base-util-lib": "3.5.0",
"@lukka/run-vcpkg-lib": "3.5.0",
"@lukka/action-lib": "3.5.1",
"@lukka/assets-lib": "3.5.1",
"@lukka/base-lib": "3.5.1",
"@lukka/base-util-lib": "3.5.1",
"@lukka/run-vcpkg-lib": "3.5.1",
"@types/adm-zip": "^0.4.32",
"@types/follow-redirects": "^1.14.1",
"@types/jest": "^26.0.14",
Expand Down
17 changes: 9 additions & 8 deletions src/vcpkg-action.ts
Expand Up @@ -27,13 +27,13 @@ export class VcpkgAction {
private static readonly VCPKGJSON_GLOB = "**/vcpkg.json";
private static readonly VCPKGJSON_IGNORES = "['**/vcpkg/**']";
private static readonly DEFAULTVCPKGURL = 'https://github.com/microsoft/vcpkg.git';
private readonly doNotCache: boolean = false;
private readonly doNotCache: boolean = true;
private readonly runVcpkgFormatString: string | null;
private readonly vcpkgJsonGlob: string;
private readonly vcpkgJsonIgnores: string[];
private readonly runVcpkgInstall: boolean;
private readonly runVcpkgInstall: boolean = false;
private readonly userProvidedCommitId: string | null;
private readonly doNotUpdateVcpkg: boolean;
private readonly doNotUpdateVcpkg: boolean = false;
private readonly vcpkgUrl: string | null;
private readonly vcpkgCommitId: string | null;
private readonly logCollectionRegExps: string[];
Expand All @@ -48,9 +48,9 @@ export class VcpkgAction {
this.runVcpkgFormatString = baseUtilLib.baseLib.getInput(runVcpkgFormatStringInput, false) ?? null;
this.vcpkgJsonGlob = baseUtilLib.baseLib.getInput(vcpkgJsonGlobInput, false) ?? VcpkgAction.VCPKGJSON_GLOB;
this.vcpkgJsonIgnores = eval(baseUtilLib.baseLib.getInput(vcpkgJsonIgnoresInput, false) ?? VcpkgAction.VCPKGJSON_IGNORES) as string[];
this.runVcpkgInstall = baseUtilLib.baseLib.getBoolInput(runVcpkgInstallInput, false) ?? false;
this.doNotCache = baseUtilLib.baseLib.getBoolInput(doNotCacheInput, false) ?? false;
this.doNotUpdateVcpkg = baseUtilLib.baseLib.getBoolInput(doNotUpdateVcpkgInput, false) ?? false;
this.runVcpkgInstall = baseUtilLib.baseLib.getBoolInput(runVcpkgInstallInput, false) ?? this.runVcpkgInstall;
this.doNotCache = baseUtilLib.baseLib.getBoolInput(doNotCacheInput, false) ?? this.doNotCache;
this.doNotUpdateVcpkg = baseUtilLib.baseLib.getBoolInput(doNotUpdateVcpkgInput, false) ?? this.doNotUpdateVcpkg;
this.vcpkgUrl = baseUtilLib.baseLib.getInput(vcpkgUrlInput, false) ?? VcpkgAction.DEFAULTVCPKGURL;
this.vcpkgCommitId = baseUtilLib.baseLib.getInput(vcpkgCommitIdInput, false) ?? null;
this.logCollectionRegExps = baseUtilLib.baseLib.getDelimitedInput(logCollectionRegExpsInput, ';', false) ?? [];
Expand Down Expand Up @@ -123,9 +123,10 @@ export class VcpkgAction {
isCacheHit,
keys,
vcpkgutil.Utils.getAllCachedPaths(this.baseUtilLib.baseLib,
this.vcpkgRootDir as string // HACK: if it were not set it would have thrown before.
this.vcpkgRootDir as string // HACK: if it were not set it would have thrown an exception before.
),
this.doNotCache, true);
this.doNotCache,
true);

this.baseUtilLib.baseLib.debug("run()>>");
}
Expand Down

0 comments on commit 6c327c7

Please sign in to comment.