Update toolkit we consume (#11)

This commit is contained in:
Danny McCormick 2019-06-24 15:09:39 -04:00 committed by GitHub
parent 7c614ea4aa
commit e4990368a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 537 additions and 320 deletions

View file

@ -62,10 +62,17 @@ export declare function cacheDir(sourceDir: string, tool: string, version: strin
*/
export declare function cacheFile(sourceFile: string, targetFile: string, tool: string, version: string, arch?: string): Promise<string>;
/**
* finds the path to a tool in the local installed tool cache
* Finds the path to a tool version in the local installed tool cache
*
* @param toolName name of the tool
* @param versionSpec version of the tool
* @param arch optional arch. defaults to arch of computer
*/
export declare function find(toolName: string, versionSpec: string, arch?: string): string;
/**
* Finds the paths to all versions of a tool that are installed in the local tool cache
*
* @param toolName name of the tool
* @param arch optional arch. defaults to arch of computer
*/
export declare function findAllVersions(toolName: string, arch?: string): string[];

View file

@ -31,8 +31,6 @@ const userAgent = 'actions/tool-cache';
// On load grab temp directory and cache directory and remove them from env (currently don't want to expose this)
let tempDirectory = process.env['RUNNER_TEMPDIRECTORY'] || '';
let cacheRoot = process.env['RUNNER_TOOLSDIRECTORY'] || '';
process.env['RUNNER_TEMPDIRECTORY'] = '';
process.env['RUNNER_TOOLSDIRECTORY'] = '';
// If directories not found, place them in common temp locations
if (!tempDirectory || !cacheRoot) {
let baseLocation;
@ -315,7 +313,7 @@ function cacheFile(sourceFile, targetFile, tool, version, arch) {
}
exports.cacheFile = cacheFile;
/**
* finds the path to a tool in the local installed tool cache
* Finds the path to a tool version in the local installed tool cache
*
* @param toolName name of the tool
* @param versionSpec version of the tool
@ -331,7 +329,7 @@ function find(toolName, versionSpec, arch) {
arch = arch || os.arch();
// attempt to resolve an explicit version
if (!_isExplicitVersion(versionSpec)) {
const localVersions = _findLocalToolVersions(toolName, arch);
const localVersions = findAllVersions(toolName, arch);
const match = _evaluateVersions(localVersions, versionSpec);
versionSpec = match;
}
@ -352,6 +350,30 @@ function find(toolName, versionSpec, arch) {
return toolPath;
}
exports.find = find;
/**
* Finds the paths to all versions of a tool that are installed in the local tool cache
*
* @param toolName name of the tool
* @param arch optional arch. defaults to arch of computer
*/
function findAllVersions(toolName, arch) {
const versions = [];
arch = arch || os.arch();
const toolPath = path.join(cacheRoot, toolName);
if (fs.existsSync(toolPath)) {
const children = fs.readdirSync(toolPath);
for (const child of children) {
if (_isExplicitVersion(child)) {
const fullPath = path.join(toolPath, child, arch || '');
if (fs.existsSync(fullPath) && fs.existsSync(`${fullPath}.complete`)) {
versions.push(child);
}
}
}
}
return versions;
}
exports.findAllVersions = findAllVersions;
function _createExtractFolder(dest) {
return __awaiter(this, void 0, void 0, function* () {
if (!dest) {
@ -411,21 +433,4 @@ function _evaluateVersions(versions, versionSpec) {
}
return version;
}
function _findLocalToolVersions(toolName, arch) {
const versions = [];
arch = arch || os.arch();
const toolPath = path.join(cacheRoot, toolName);
if (fs.existsSync(toolPath)) {
const children = fs.readdirSync(toolPath);
for (const child of children) {
if (_isExplicitVersion(child)) {
const fullPath = path.join(toolPath, child, arch || '');
if (fs.existsSync(fullPath) && fs.existsSync(`${fullPath}.complete`)) {
versions.push(child);
}
}
}
}
return versions;
}
//# sourceMappingURL=tool-cache.js.map

File diff suppressed because one or more lines are too long

View file

@ -1,44 +1,41 @@
{
"_args": [
[
"@actions/tool-cache@file:toolkit\\actions-tool-cache-1.0.0.tgz",
"C:\\Users\\damccorm\\Documents\\setup-node"
]
],
"_from": "@actions/tool-cache@file:toolkit/actions-tool-cache-1.0.0.tgz",
"_id": "@actions/tool-cache@file:toolkit/actions-tool-cache-1.0.0.tgz",
"_from": "file:toolkit\\actions-tool-cache-0.0.0.tgz",
"_id": "@actions/tool-cache@0.0.0",
"_inBundle": false,
"_integrity": "sha512-hx8Z1ip11aZVA47uSCIB7Y9ec4Ty9zNPUyFyBsr0YI5vJ64TR/JoySbr0ck7l2EI0zqYAdef11Ynwz/qUkXVyg==",
"_integrity": "sha512-NavDg5VFXDfbe9TpFuj+uOHacjg1bT3Wmo3DQuul3gsGRBEXyzhh2MWKnBZs/Zh7FE3prLmIqpbtymafNBFkIA==",
"_location": "/@actions/tool-cache",
"_phantomChildren": {},
"_requested": {
"type": "file",
"where": "C:\\Users\\damccorm\\Documents\\setup-node",
"raw": "@actions/tool-cache@file:toolkit/actions-tool-cache-1.0.0.tgz",
"raw": "@actions/tool-cache@file:toolkit/actions-tool-cache-0.0.0.tgz",
"name": "@actions/tool-cache",
"escapedName": "@actions%2ftool-cache",
"scope": "@actions",
"rawSpec": "file:toolkit/actions-tool-cache-1.0.0.tgz",
"saveSpec": "file:toolkit\\actions-tool-cache-1.0.0.tgz",
"fetchSpec": "C:\\Users\\damccorm\\Documents\\setup-node\\toolkit\\actions-tool-cache-1.0.0.tgz"
"rawSpec": "file:toolkit/actions-tool-cache-0.0.0.tgz",
"saveSpec": "file:toolkit\\actions-tool-cache-0.0.0.tgz",
"fetchSpec": "C:\\Users\\damccorm\\Documents\\setup-node\\toolkit\\actions-tool-cache-0.0.0.tgz"
},
"_requiredBy": [
"/"
],
"_resolved": false,
"_spec": "file:toolkit/actions-tool-cache-1.0.0.tgz",
"_resolved": "C:\\Users\\damccorm\\Documents\\setup-node\\toolkit\\actions-tool-cache-0.0.0.tgz",
"_shasum": "fa216c10f724010a74602fd14881f25f5b008070",
"_spec": "@actions/tool-cache@file:toolkit/actions-tool-cache-0.0.0.tgz",
"_where": "C:\\Users\\damccorm\\Documents\\setup-node",
"bugs": {
"url": "https://github.com/actions/toolkit/issues"
},
"bundleDependencies": false,
"dependencies": {
"@actions/core": "^0.1.0",
"@actions/exec": "^1.0.0",
"@actions/io": "^1.0.0",
"@actions/core": "^0.0.0",
"@actions/exec": "^0.0.0",
"@actions/io": "^0.0.0",
"semver": "^6.1.0",
"typed-rest-client": "^1.4.0",
"uuid": "^3.3.2"
},
"deprecated": false,
"description": "Actions tool-cache lib",
"devDependencies": {
"@types/nock": "^10.0.3",
@ -73,5 +70,5 @@
"test": "echo \"Error: run tests from root\" && exit 1",
"tsc": "tsc"
},
"version": "1.0.0"
"version": "0.0.0"
}