Add emulator-launcher.

This commit is contained in:
Yang Chen
2019-11-07 15:26:16 +11:00
parent f5529b9551
commit 34df1eaf0e
13 changed files with 247 additions and 38 deletions
+17 -5
View File
@@ -18,6 +18,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
const core = __importStar(require("@actions/core"));
const sdk_installer_1 = require("./sdk-installer");
const input_validator_1 = require("./input-validator");
const emulator_launcher_1 = require("./emulator-launcher");
function run() {
return __awaiter(this, void 0, void 0, function* () {
try {
@@ -26,8 +27,9 @@ function run() {
throw new Error('This action is expected to be run within a macOS virtual machine to enable hardware acceleration.');
}
// API level of the platform and system image
const apiLevel = core.getInput('api-level', { required: true });
input_validator_1.checkApiLevel(apiLevel);
const apiLevelInput = core.getInput('api-level', { required: true });
input_validator_1.checkApiLevel(apiLevelInput);
const apiLevel = Number(apiLevelInput);
console.log(`API level: ${apiLevel}`);
// target of the system image
const target = core.getInput('target');
@@ -38,11 +40,21 @@ function run() {
input_validator_1.checkAbi(abi);
console.log(`cpu/abi: ${abi}`);
// headless mode
const headless = core.getInput('headless');
input_validator_1.checkHeadless(headless);
const headlessInput = core.getInput('headless');
input_validator_1.checkHeadless(headlessInput);
const headless = headlessInput === 'true';
console.log(`headless mode: ${headless}`);
// disable animations
const disableAnimationsInput = core.getInput('disable-animations');
input_validator_1.checkDisableAnimations(disableAnimationsInput);
const disableAnimations = disableAnimationsInput === 'true';
console.log(`disable animations: ${disableAnimations}`);
// install SDK
yield sdk_installer_1.installAndroidSdk(Number(apiLevel), target, abi);
yield sdk_installer_1.installAndroidSdk(apiLevel, target, abi);
// launch emulator
// TODO get from input (source list of all profiles)
const device = 'Nexus 6P';
yield emulator_launcher_1.launchEmulator(apiLevel, target, abi, device, headless, disableAnimations);
// TODO start emulator
}
catch (error) {