mirror of
https://github.com/reactivecircus/android-emulator-runner.git
synced 2026-09-06 19:59:32 +00:00
Add option to specify AVD heap size (#245)
This commit is contained in:
@@ -144,6 +144,7 @@ jobs:
|
|||||||
| `profile` | Optional | N/A | Hardware profile used for creating the AVD - e.g. `Nexus 6`. For a list of all profiles available, run `avdmanager list device`. |
|
| `profile` | Optional | N/A | Hardware profile used for creating the AVD - e.g. `Nexus 6`. For a list of all profiles available, run `avdmanager list device`. |
|
||||||
| `cores` | Optional | 2 | Number of cores to use for the emulator (`hw.cpu.ncore` in config.ini). |
|
| `cores` | Optional | 2 | Number of cores to use for the emulator (`hw.cpu.ncore` in config.ini). |
|
||||||
| `ram-size` | Optional | N/A | Size of RAM to use for this AVD, in KB or MB, denoted with K or M. - e.g. `2048M` |
|
| `ram-size` | Optional | N/A | Size of RAM to use for this AVD, in KB or MB, denoted with K or M. - e.g. `2048M` |
|
||||||
|
| `heap-size` | Optional | N/A | Heap size to use for this AVD, in KB or MB, denoted with K or M. - e.g. `512M` |
|
||||||
| `sdcard-path-or-size` | Optional | N/A | Path to the SD card image for this AVD or the size of a new SD card image to create for this AVD, in KB or MB, denoted with K or M. - e.g. `path/to/sdcard`, or `1000M`. |
|
| `sdcard-path-or-size` | Optional | N/A | Path to the SD card image for this AVD or the size of a new SD card image to create for this AVD, in KB or MB, denoted with K or M. - e.g. `path/to/sdcard`, or `1000M`. |
|
||||||
| `disk-size` | Optional | N/A | Disk size to use for this AVD. Either in bytes or KB, MB or GB, when denoted with K, M or G. - e.g. `2048M` |
|
| `disk-size` | Optional | N/A | Disk size to use for this AVD. Either in bytes or KB, MB or GB, when denoted with K, M or G. - e.g. `2048M` |
|
||||||
| `avd-name` | Optional | `test` | Custom AVD name used for creating the Android Virtual Device. |
|
| `avd-name` | Optional | `test` | Custom AVD name used for creating the Android Virtual Device. |
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ inputs:
|
|||||||
default: 2
|
default: 2
|
||||||
ram-size:
|
ram-size:
|
||||||
description: 'size of RAM to use for this AVD, in KB or MB, denoted with K or M. - e.g. `2048M`'
|
description: 'size of RAM to use for this AVD, in KB or MB, denoted with K or M. - e.g. `2048M`'
|
||||||
|
heap-size:
|
||||||
|
description: 'size of heap to use for this AVD in MB. - e.g. `512M`'
|
||||||
sdcard-path-or-size:
|
sdcard-path-or-size:
|
||||||
description: 'path to the SD card image for this AVD or the size of a new SD card image to create for this AVD, in KB or MB, denoted with K or M. - e.g. `path/to/sdcard`, or `1000M`'
|
description: 'path to the SD card image for this AVD or the size of a new SD card image to create for this AVD, in KB or MB, denoted with K or M. - e.g. `path/to/sdcard`, or `1000M`'
|
||||||
disk-size:
|
disk-size:
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ const EMULATOR_BOOT_TIMEOUT_SECONDS = 600;
|
|||||||
/**
|
/**
|
||||||
* Creates and launches a new AVD instance with the specified configurations.
|
* Creates and launches a new AVD instance with the specified configurations.
|
||||||
*/
|
*/
|
||||||
function launchEmulator(apiLevel, target, arch, profile, cores, ramSize, sdcardPathOrSize, diskSize, avdName, forceAvdCreation, emulatorOptions, disableAnimations, disableSpellChecker, disableLinuxHardwareAcceleration, enableHardwareKeyboard) {
|
function launchEmulator(apiLevel, target, arch, profile, cores, ramSize, heapSize, sdcardPathOrSize, diskSize, avdName, forceAvdCreation, emulatorOptions, disableAnimations, disableSpellChecker, disableLinuxHardwareAcceleration, enableHardwareKeyboard) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
try {
|
try {
|
||||||
console.log(`::group::Launch Emulator`);
|
console.log(`::group::Launch Emulator`);
|
||||||
@@ -53,6 +53,9 @@ function launchEmulator(apiLevel, target, arch, profile, cores, ramSize, sdcardP
|
|||||||
if (ramSize) {
|
if (ramSize) {
|
||||||
yield exec.exec(`sh -c \\"printf 'hw.ramSize=${ramSize}\n' >> ${process.env.ANDROID_AVD_HOME}/"${avdName}".avd"/config.ini`);
|
yield exec.exec(`sh -c \\"printf 'hw.ramSize=${ramSize}\n' >> ${process.env.ANDROID_AVD_HOME}/"${avdName}".avd"/config.ini`);
|
||||||
}
|
}
|
||||||
|
if (heapSize) {
|
||||||
|
yield exec.exec(`sh -c \\"printf 'hw.heapSize=${heapSize}\n' >> ${process.env.ANDROID_AVD_HOME}/"${avdName}".avd"/config.ini`);
|
||||||
|
}
|
||||||
if (enableHardwareKeyboard) {
|
if (enableHardwareKeyboard) {
|
||||||
yield exec.exec(`sh -c \\"printf 'hw.keyboard=yes\n' >> ${process.env.ANDROID_AVD_HOME}/"${avdName}".avd"/config.ini`);
|
yield exec.exec(`sh -c \\"printf 'hw.keyboard=yes\n' >> ${process.env.ANDROID_AVD_HOME}/"${avdName}".avd"/config.ini`);
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-1
@@ -71,6 +71,9 @@ function run() {
|
|||||||
// RAM to use for AVD
|
// RAM to use for AVD
|
||||||
const ramSize = core.getInput('ram-size');
|
const ramSize = core.getInput('ram-size');
|
||||||
console.log(`RAM size: ${ramSize}`);
|
console.log(`RAM size: ${ramSize}`);
|
||||||
|
// Heap size to use for AVD
|
||||||
|
const heapSize = core.getInput('heap-size');
|
||||||
|
console.log(`Heap size: ${heapSize}`);
|
||||||
// SD card path or size used for creating the AVD
|
// SD card path or size used for creating the AVD
|
||||||
const sdcardPathOrSize = core.getInput('sdcard-path-or-size');
|
const sdcardPathOrSize = core.getInput('sdcard-path-or-size');
|
||||||
console.log(`SD card path or size: ${sdcardPathOrSize}`);
|
console.log(`SD card path or size: ${sdcardPathOrSize}`);
|
||||||
@@ -149,7 +152,7 @@ function run() {
|
|||||||
// install SDK
|
// install SDK
|
||||||
yield sdk_installer_1.installAndroidSdk(apiLevel, target, arch, channelId, emulatorBuild, ndkVersion, cmakeVersion);
|
yield sdk_installer_1.installAndroidSdk(apiLevel, target, arch, channelId, emulatorBuild, ndkVersion, cmakeVersion);
|
||||||
// launch an emulator
|
// launch an emulator
|
||||||
yield emulator_manager_1.launchEmulator(apiLevel, target, arch, profile, cores, ramSize, sdcardPathOrSize, diskSize, avdName, forceAvdCreation, emulatorOptions, disableAnimations, disableSpellchecker, disableLinuxHardwareAcceleration, enableHardwareKeyboard);
|
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
|
// execute the custom script
|
||||||
try {
|
try {
|
||||||
// move to custom working directory if set
|
// move to custom working directory if set
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ export async function launchEmulator(
|
|||||||
profile: string,
|
profile: string,
|
||||||
cores: string,
|
cores: string,
|
||||||
ramSize: string,
|
ramSize: string,
|
||||||
|
heapSize: string,
|
||||||
sdcardPathOrSize: string,
|
sdcardPathOrSize: string,
|
||||||
diskSize: string,
|
diskSize: string,
|
||||||
avdName: string,
|
avdName: string,
|
||||||
@@ -44,6 +45,10 @@ export async function launchEmulator(
|
|||||||
await exec.exec(`sh -c \\"printf 'hw.ramSize=${ramSize}\n' >> ${process.env.ANDROID_AVD_HOME}/"${avdName}".avd"/config.ini`);
|
await exec.exec(`sh -c \\"printf 'hw.ramSize=${ramSize}\n' >> ${process.env.ANDROID_AVD_HOME}/"${avdName}".avd"/config.ini`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (heapSize) {
|
||||||
|
await exec.exec(`sh -c \\"printf 'hw.heapSize=${heapSize}\n' >> ${process.env.ANDROID_AVD_HOME}/"${avdName}".avd"/config.ini`);
|
||||||
|
}
|
||||||
|
|
||||||
if (enableHardwareKeyboard) {
|
if (enableHardwareKeyboard) {
|
||||||
await exec.exec(`sh -c \\"printf 'hw.keyboard=yes\n' >> ${process.env.ANDROID_AVD_HOME}/"${avdName}".avd"/config.ini`);
|
await exec.exec(`sh -c \\"printf 'hw.keyboard=yes\n' >> ${process.env.ANDROID_AVD_HOME}/"${avdName}".avd"/config.ini`);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,6 +61,10 @@ async function run() {
|
|||||||
const ramSize = core.getInput('ram-size');
|
const ramSize = core.getInput('ram-size');
|
||||||
console.log(`RAM size: ${ramSize}`);
|
console.log(`RAM size: ${ramSize}`);
|
||||||
|
|
||||||
|
// Heap size to use for AVD
|
||||||
|
const heapSize = core.getInput('heap-size');
|
||||||
|
console.log(`Heap size: ${heapSize}`);
|
||||||
|
|
||||||
// SD card path or size used for creating the AVD
|
// SD card path or size used for creating the AVD
|
||||||
const sdcardPathOrSize = core.getInput('sdcard-path-or-size');
|
const sdcardPathOrSize = core.getInput('sdcard-path-or-size');
|
||||||
console.log(`SD card path or size: ${sdcardPathOrSize}`);
|
console.log(`SD card path or size: ${sdcardPathOrSize}`);
|
||||||
@@ -162,6 +166,7 @@ async function run() {
|
|||||||
profile,
|
profile,
|
||||||
cores,
|
cores,
|
||||||
ramSize,
|
ramSize,
|
||||||
|
heapSize,
|
||||||
sdcardPathOrSize,
|
sdcardPathOrSize,
|
||||||
diskSize,
|
diskSize,
|
||||||
avdName,
|
avdName,
|
||||||
|
|||||||
Reference in New Issue
Block a user