mirror of
https://github.com/reactivecircus/android-emulator-runner.git
synced 2026-08-31 17:49:33 +00:00
Update dependencies (#282)
* Update packages * Fix TS errors * rebuild * Update eslint See https://github.com/prettier/eslint-config-prettier/blob/main/CHANGELOG.md#version-800-2021-02-21 * Fix linting errors * rebuild
This commit is contained in:
committed by
GitHub
parent
a47c099672
commit
a4845e8d39
+13
-9
@@ -1,7 +1,11 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
@@ -14,7 +18,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
@@ -75,8 +79,8 @@ function launchEmulator(apiLevel, target, arch, profile, cores, ramSize, heapSiz
|
||||
if (data.toString().includes('invalid command-line parameter')) {
|
||||
throw new Error(data.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
// wait for emulator to complete booting
|
||||
yield waitForDevice();
|
||||
@@ -110,7 +114,7 @@ function killEmulator() {
|
||||
yield exec.exec(`adb -s emulator-5554 emu kill`);
|
||||
}
|
||||
catch (error) {
|
||||
console.log(error.message);
|
||||
console.log(error instanceof Error ? error.message : error);
|
||||
}
|
||||
finally {
|
||||
console.log(`::endgroup::`);
|
||||
@@ -134,8 +138,8 @@ function waitForDevice() {
|
||||
listeners: {
|
||||
stdout: (data) => {
|
||||
result += data.toString();
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
if (result.trim() === '1') {
|
||||
console.log('Emulator booted.');
|
||||
@@ -144,7 +148,7 @@ function waitForDevice() {
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
console.warn(error.message);
|
||||
console.warn(error instanceof Error ? error.message : error);
|
||||
}
|
||||
if (attempts < maxAttempts) {
|
||||
yield delay(retryInterval * 1000);
|
||||
@@ -157,5 +161,5 @@ function waitForDevice() {
|
||||
});
|
||||
}
|
||||
function delay(ms) {
|
||||
return new Promise(resolve => setTimeout(resolve, ms));
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
}
|
||||
|
||||
+29
-25
@@ -1,7 +1,11 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
@@ -14,7 +18,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
@@ -45,7 +49,7 @@ function run() {
|
||||
if (process.platform !== 'darwin') {
|
||||
if (process.platform === 'linux') {
|
||||
try {
|
||||
fs_1.accessSync('/dev/kvm', fs_1.constants.R_OK | fs_1.constants.W_OK);
|
||||
(0, fs_1.accessSync)('/dev/kvm', fs_1.constants.R_OK | fs_1.constants.W_OK);
|
||||
linuxSupportKVM = true;
|
||||
}
|
||||
catch (_a) {
|
||||
@@ -58,17 +62,17 @@ function run() {
|
||||
}
|
||||
// API level of the platform and system image
|
||||
const apiLevelInput = core.getInput('api-level', { required: true });
|
||||
input_validator_1.checkApiLevel(apiLevelInput);
|
||||
(0, input_validator_1.checkApiLevel)(apiLevelInput);
|
||||
const apiLevel = Number(apiLevelInput);
|
||||
console.log(`API level: ${apiLevel}`);
|
||||
// target of the system image
|
||||
const targetInput = core.getInput('target');
|
||||
const target = targetInput == 'playstore' ? 'google_apis_playstore' : targetInput;
|
||||
input_validator_1.checkTarget(target);
|
||||
(0, input_validator_1.checkTarget)(target);
|
||||
console.log(`target: ${target}`);
|
||||
// CPU architecture of the system image
|
||||
const arch = core.getInput('arch');
|
||||
input_validator_1.checkArch(arch);
|
||||
(0, input_validator_1.checkArch)(arch);
|
||||
console.log(`CPU architecture: ${arch}`);
|
||||
// Hardware profile used for creating the AVD
|
||||
const profile = core.getInput('profile');
|
||||
@@ -86,14 +90,14 @@ function run() {
|
||||
const sdcardPathOrSize = core.getInput('sdcard-path-or-size');
|
||||
console.log(`SD card path or size: ${sdcardPathOrSize}`);
|
||||
const diskSize = core.getInput('disk-size');
|
||||
input_validator_1.checkDiskSize(diskSize);
|
||||
(0, input_validator_1.checkDiskSize)(diskSize);
|
||||
console.log(`Disk size: ${diskSize}`);
|
||||
// custom name used for creating the AVD
|
||||
const avdName = core.getInput('avd-name');
|
||||
console.log(`AVD name: ${avdName}`);
|
||||
// force AVD creation
|
||||
const forceAvdCreationInput = core.getInput('force-avd-creation');
|
||||
input_validator_1.checkForceAvdCreation(forceAvdCreationInput);
|
||||
(0, input_validator_1.checkForceAvdCreation)(forceAvdCreationInput);
|
||||
const forceAvdCreation = forceAvdCreationInput === 'true';
|
||||
console.log(`force avd creation: ${forceAvdCreation}`);
|
||||
// emulator options
|
||||
@@ -101,17 +105,17 @@ function run() {
|
||||
console.log(`emulator options: ${emulatorOptions}`);
|
||||
// disable animations
|
||||
const disableAnimationsInput = core.getInput('disable-animations');
|
||||
input_validator_1.checkDisableAnimations(disableAnimationsInput);
|
||||
(0, input_validator_1.checkDisableAnimations)(disableAnimationsInput);
|
||||
const disableAnimations = disableAnimationsInput === 'true';
|
||||
console.log(`disable animations: ${disableAnimations}`);
|
||||
// disable spellchecker
|
||||
const disableSpellcheckerInput = core.getInput('disable-spellchecker');
|
||||
input_validator_1.checkDisableSpellchecker(disableSpellcheckerInput);
|
||||
(0, input_validator_1.checkDisableSpellchecker)(disableSpellcheckerInput);
|
||||
const disableSpellchecker = disableSpellcheckerInput === 'true';
|
||||
console.log(`disable spellchecker: ${disableSpellchecker}`);
|
||||
// disable linux hardware acceleration
|
||||
let disableLinuxHardwareAccelerationInput = core.getInput('disable-linux-hw-accel');
|
||||
input_validator_1.checkDisableLinuxHardwareAcceleration(disableLinuxHardwareAccelerationInput);
|
||||
(0, input_validator_1.checkDisableLinuxHardwareAcceleration)(disableLinuxHardwareAccelerationInput);
|
||||
if (disableLinuxHardwareAccelerationInput === 'auto' && process.platform === 'linux') {
|
||||
disableLinuxHardwareAccelerationInput = linuxSupportKVM ? 'false' : 'true';
|
||||
}
|
||||
@@ -119,13 +123,13 @@ function run() {
|
||||
console.log(`disable Linux hardware acceleration: ${disableLinuxHardwareAcceleration}`);
|
||||
// enable hardware keyboard
|
||||
const enableHardwareKeyboardInput = core.getInput('enable-hw-keyboard');
|
||||
input_validator_1.checkEnableHardwareKeyboard(enableHardwareKeyboardInput);
|
||||
(0, input_validator_1.checkEnableHardwareKeyboard)(enableHardwareKeyboardInput);
|
||||
const enableHardwareKeyboard = enableHardwareKeyboardInput === 'true';
|
||||
console.log(`enable hardware keyboard: ${enableHardwareKeyboard}`);
|
||||
// emulator build
|
||||
const emulatorBuildInput = core.getInput('emulator-build');
|
||||
if (emulatorBuildInput) {
|
||||
input_validator_1.checkEmulatorBuild(emulatorBuildInput);
|
||||
(0, input_validator_1.checkEmulatorBuild)(emulatorBuildInput);
|
||||
console.log(`using emulator build: ${emulatorBuildInput}`);
|
||||
}
|
||||
const emulatorBuild = !emulatorBuildInput ? undefined : emulatorBuildInput;
|
||||
@@ -149,26 +153,26 @@ function run() {
|
||||
const cmakeVersion = !cmakeInput ? undefined : cmakeInput;
|
||||
// channelId (up to and including) to download the SDK packages from
|
||||
const channelName = core.getInput('channel');
|
||||
input_validator_1.checkChannel(channelName);
|
||||
const channelId = channel_id_mapper_1.getChannelId(channelName);
|
||||
(0, input_validator_1.checkChannel)(channelName);
|
||||
const channelId = (0, channel_id_mapper_1.getChannelId)(channelName);
|
||||
console.log(`Channel: ${channelId} (${channelName})`);
|
||||
// custom script to run
|
||||
const scriptInput = core.getInput('script', { required: true });
|
||||
const scripts = script_parser_1.parseScript(scriptInput);
|
||||
const scripts = (0, script_parser_1.parseScript)(scriptInput);
|
||||
console.log(`Script:`);
|
||||
scripts.forEach((script) => __awaiter(this, void 0, void 0, function* () {
|
||||
console.log(`${script}`);
|
||||
}));
|
||||
// custom pre emulator launch script
|
||||
const preEmulatorLaunchScriptInput = core.getInput('pre-emulator-launch-script');
|
||||
const preEmulatorLaunchScripts = !preEmulatorLaunchScriptInput ? undefined : script_parser_1.parseScript(preEmulatorLaunchScriptInput);
|
||||
const preEmulatorLaunchScripts = !preEmulatorLaunchScriptInput ? undefined : (0, script_parser_1.parseScript)(preEmulatorLaunchScriptInput);
|
||||
console.log(`Pre emulator launch script:`);
|
||||
preEmulatorLaunchScripts === null || preEmulatorLaunchScripts === void 0 ? void 0 : preEmulatorLaunchScripts.forEach((script) => __awaiter(this, void 0, void 0, function* () {
|
||||
console.log(`${script}`);
|
||||
}));
|
||||
console.log(`::endgroup::`);
|
||||
// install SDK
|
||||
yield sdk_installer_1.installAndroidSdk(apiLevel, target, arch, channelId, emulatorBuild, ndkVersion, cmakeVersion);
|
||||
yield (0, sdk_installer_1.installAndroidSdk)(apiLevel, target, arch, channelId, emulatorBuild, ndkVersion, cmakeVersion);
|
||||
// execute pre emulator launch script if set
|
||||
if (preEmulatorLaunchScripts !== undefined) {
|
||||
console.log(`::group::Run pre emulator launch script`);
|
||||
@@ -177,17 +181,17 @@ function run() {
|
||||
// use array form to avoid various quote escaping problems
|
||||
// caused by exec(`sh -c "${preEmulatorLaunchScript}"`)
|
||||
yield exec.exec('sh', ['-c', preEmulatorLaunchScript], {
|
||||
cwd: workingDirectory
|
||||
cwd: workingDirectory,
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
core.setFailed(error.message);
|
||||
core.setFailed(error instanceof Error ? error.message : error);
|
||||
}
|
||||
console.log(`::endgroup::`);
|
||||
}
|
||||
// launch an emulator
|
||||
yield emulator_manager_1.launchEmulator(apiLevel, target, arch, profile, cores, ramSize, heapSize, sdcardPathOrSize, diskSize, avdName, forceAvdCreation, emulatorOptions, disableAnimations, disableSpellchecker, disableLinuxHardwareAcceleration, enableHardwareKeyboard);
|
||||
yield (0, emulator_manager_1.launchEmulator)(apiLevel, target, arch, profile, cores, ramSize, heapSize, sdcardPathOrSize, diskSize, avdName, forceAvdCreation, emulatorOptions, disableAnimations, disableSpellchecker, disableLinuxHardwareAcceleration, enableHardwareKeyboard);
|
||||
// execute the custom script
|
||||
try {
|
||||
// move to custom working directory if set
|
||||
@@ -201,15 +205,15 @@ function run() {
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
core.setFailed(error.message);
|
||||
core.setFailed(error instanceof Error ? error.message : error);
|
||||
}
|
||||
// finally kill the emulator
|
||||
yield emulator_manager_1.killEmulator();
|
||||
yield (0, emulator_manager_1.killEmulator)();
|
||||
}
|
||||
catch (error) {
|
||||
// kill the emulator so the action can exit
|
||||
yield emulator_manager_1.killEmulator();
|
||||
core.setFailed(error.message);
|
||||
yield (0, emulator_manager_1.killEmulator)();
|
||||
core.setFailed(error instanceof Error ? error.message : error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
@@ -14,7 +18,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user