ai-planning-val
Version:
Javascript/typescript wrapper for VAL (AI Planning plan validation and evaluation tools from KCL Planning department and the planning community around the ICAPS conference).
61 lines • 3.04 kB
JavaScript
;
/* --------------------------------------------------------------------------------------------
* Copyright (c) Jan Dolejsi 2020. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const ValDownloader_1 = require("./ValDownloader");
const yargs_1 = __importDefault(require("yargs"));
const path_1 = __importDefault(require("path"));
/**
* This script wraps the `ValDownloader` into a Node.js command-line utility.
* This is CLI is used by the CI workflow!
*/
const argv = yargs_1.default.option('buildId', {
description: 'VAL Build ID (see ID of the latest from https://dev.azure.com/schlumberger/ai-planning-validation/_build/latest?definitionId=2&branchName=master)',
default: 60,
type: "number"
}).option('destination', {
description: 'Target for the binaries to be unzipped into',
type: "string",
default: '.'
}).option('platform', {
description: 'Optionally specify the platform (defaults to the local machine operating system)',
choices: [ValDownloader_1.WIN32, ValDownloader_1.LINUX, ValDownloader_1.DARWIN],
default: undefined,
type: "string"
}).option('architecture', {
description: 'Optionally specify the CPU architecture (defaults to local machine CPU architecture)',
choices: [ValDownloader_1.X32, ValDownloader_1.X64],
default: undefined,
type: "string"
})
.help()
.argv;
function download(buildId, destination, platform, architecture) {
return __awaiter(this, void 0, void 0, function* () {
const manifest = yield new ValDownloader_1.ValDownloader().download(buildId, destination, platform, architecture);
if (!manifest) {
throw new Error('Failed to download VAL.');
}
return yield (0, ValDownloader_1.writeValManifest)(path_1.default.join(destination, 'val.json'), manifest);
});
}
download(argv.buildId, argv.destination).catch(err => {
console.error(err);
process.exit(-1);
});
//# sourceMappingURL=downloadVal.js.map