mirror of
https://github.com/reactivecircus/android-emulator-runner.git
synced 2026-09-04 11:29:31 +00:00
Support multi-line script.
This commit is contained in:
+18
-5
@@ -20,6 +20,7 @@ const sdk_installer_1 = require("./sdk-installer");
|
||||
const input_validator_1 = require("./input-validator");
|
||||
const emulator_manager_1 = require("./emulator-manager");
|
||||
const exec = __importStar(require("@actions/exec"));
|
||||
const script_parser_1 = require("./script-parser");
|
||||
function run() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
@@ -39,7 +40,7 @@ function run() {
|
||||
// CPU architecture of the system image
|
||||
const arch = core.getInput('arch');
|
||||
input_validator_1.checkArch(arch);
|
||||
console.log(`CPI architecture: ${arch}`);
|
||||
console.log(`CPU architecture: ${arch}`);
|
||||
// Hardware profile used for creating the AVD
|
||||
const profile = core.getInput('profile');
|
||||
console.log(`Hardware profile: ${profile}`);
|
||||
@@ -51,19 +52,31 @@ function run() {
|
||||
input_validator_1.checkDisableAnimations(disableAnimationsInput);
|
||||
const disableAnimations = disableAnimationsInput === 'true';
|
||||
console.log(`disable animations: ${disableAnimations}`);
|
||||
// custom scrpt to run
|
||||
const script = core.getInput('script', { required: true });
|
||||
// custom script to run
|
||||
const scriptInput = core.getInput('script', { required: true });
|
||||
const scripts = script_parser_1.parseScript(scriptInput);
|
||||
console.log(`Script:`);
|
||||
scripts.forEach((script) => __awaiter(this, void 0, void 0, function* () {
|
||||
console.log(`${script}`);
|
||||
}));
|
||||
try {
|
||||
// install SDK
|
||||
yield sdk_installer_1.installAndroidSdk(apiLevel, target, arch);
|
||||
// launch an emulator
|
||||
yield emulator_manager_1.launchEmulator(apiLevel, target, arch, profile, emulatorOptions, disableAnimations);
|
||||
// execute the custom script
|
||||
yield exec.exec(`${script}`);
|
||||
}
|
||||
catch (error) {
|
||||
core.setFailed(error.message);
|
||||
}
|
||||
// execute the custom script
|
||||
scripts.forEach((script) => __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
yield exec.exec(`${script}`);
|
||||
}
|
||||
catch (error) {
|
||||
core.setFailed(error.message);
|
||||
}
|
||||
}));
|
||||
// finally kill the emulator
|
||||
yield emulator_manager_1.killEmulator();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user