mirror of
https://github.com/reactivecircus/android-emulator-runner.git
synced 2026-08-31 17:49:33 +00:00
Pre Emulator Launch Script (#247)
* Add `pre-emulator-launch-script` to `action.yml` * Add `pre-emulator-launch-script` in `main.yml` * Implement pre emulator launch script * Try to use `pushd` * print working directory * Add `README` * Run `npm run build` * Fix `working-directory` * Run `npm run build` * Run pre emulator launch in group * Run `npm run build` * Update README.md Co-authored-by: Yang <reactivecircus@gmail.com> * Add type "pre-emulator-launch-script" Co-authored-by: Yang <reactivecircus@gmail.com>
This commit is contained in:
+24
@@ -159,9 +159,33 @@ function run() {
|
||||
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);
|
||||
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);
|
||||
// execute pre emulator launch script if set
|
||||
if (preEmulatorLaunchScripts !== undefined) {
|
||||
console.log(`::group::Run pre emulator launch script`);
|
||||
try {
|
||||
for (const preEmulatorLaunchScript of preEmulatorLaunchScripts) {
|
||||
// use array form to avoid various quote escaping problems
|
||||
// caused by exec(`sh -c "${preEmulatorLaunchScript}"`)
|
||||
yield exec.exec('sh', ['-c', preEmulatorLaunchScript], {
|
||||
cwd: workingDirectory
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
core.setFailed(error.message);
|
||||
}
|
||||
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);
|
||||
// execute the custom script
|
||||
|
||||
Reference in New Issue
Block a user