Single line script.

This commit is contained in:
Yang Chen
2019-11-09 00:20:40 +11:00
parent 0035a64068
commit 9f3feeefc6
4 changed files with 19 additions and 13 deletions
+9 -6
View File
@@ -1,9 +1,10 @@
"use strict";
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) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
@@ -54,16 +55,18 @@ function run() {
const disableAnimations = disableAnimationsInput === 'true';
console.log(`disable animations: ${disableAnimations}`);
// custom scrpt to run
const scriptInput = core.getInput('script', { required: true });
const commands = scriptInput.split(/\r?\n/);
const script = core.getInput('script', { required: true });
// install SDK
yield sdk_installer_1.installAndroidSdk(apiLevel, target, arch);
// launch an emulator
yield emulator_manager_1.launchEmulator(apiLevel, target, arch, profile, headless, disableAnimations);
// execute the custom script
commands.forEach((command) => __awaiter(this, void 0, void 0, function* () {
yield exec.exec(`${command}`);
}));
try {
yield exec.exec(`${script}`);
}
catch (error) {
console.error(error.message);
}
// finally kill the emulator
yield emulator_manager_1.killEmulator();
}