mirror of
https://github.com/reactivecircus/android-emulator-runner.git
synced 2026-09-06 11:49:32 +00:00
Unzip specific emulator build into latest emulator build from sdkmanager. Support using modern build id for emulator-build.
This commit is contained in:
@@ -71,16 +71,15 @@ function installAndroidSdk(apiLevel, target, arch, emulatorBuild, ndkVersion, cm
|
|||||||
}
|
}
|
||||||
console.log('Installing latest build tools, platform tools, and platform.');
|
console.log('Installing latest build tools, platform tools, and platform.');
|
||||||
yield exec.exec(`sh -c \\"sdkmanager --install 'build-tools;${BUILD_TOOLS_VERSION}' platform-tools 'platforms;android-${apiLevel}' > /dev/null"`);
|
yield exec.exec(`sh -c \\"sdkmanager --install 'build-tools;${BUILD_TOOLS_VERSION}' platform-tools 'platforms;android-${apiLevel}' > /dev/null"`);
|
||||||
if (emulatorBuild) {
|
|
||||||
console.log(`Installing emulator build ${emulatorBuild}.`);
|
|
||||||
yield exec.exec(`curl -fo emulator.zip https://dl.google.com/android/repository/emulator-${isOnMac ? 'darwin' : 'linux'}-${emulatorBuild}.zip`);
|
|
||||||
yield io.rmRF(`${process.env.ANDROID_SDK_ROOT}/emulator`);
|
|
||||||
yield exec.exec(`unzip -q emulator.zip -d ${process.env.ANDROID_SDK_ROOT}`);
|
|
||||||
yield io.rmRF('emulator.zip');
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
console.log('Installing latest emulator.');
|
console.log('Installing latest emulator.');
|
||||||
yield exec.exec(`sh -c \\"sdkmanager --install emulator > /dev/null"`);
|
yield exec.exec(`sh -c \\"sdkmanager --install emulator > /dev/null"`);
|
||||||
|
if (emulatorBuild) {
|
||||||
|
console.log(`Installing emulator build ${emulatorBuild}.`);
|
||||||
|
// TODO find out the correct download URLs for all build ids
|
||||||
|
const downloadUrlSuffix = Number(emulatorBuild.charAt(0)) > 6 ? `_x64-${emulatorBuild}` : `-${emulatorBuild}`;
|
||||||
|
yield exec.exec(`curl -fo emulator.zip https://dl.google.com/android/repository/emulator-${isOnMac ? 'darwin' : 'linux'}${downloadUrlSuffix}.zip`);
|
||||||
|
yield exec.exec(`unzip -o -q emulator.zip -d ${process.env.ANDROID_SDK_ROOT}`);
|
||||||
|
yield io.rmRF('emulator.zip');
|
||||||
}
|
}
|
||||||
console.log('Installing system images.');
|
console.log('Installing system images.');
|
||||||
yield exec.exec(`sh -c \\"sdkmanager --install 'system-images;android-${apiLevel};${target};${arch}' > /dev/null"`);
|
yield exec.exec(`sh -c \\"sdkmanager --install 'system-images;android-${apiLevel};${target};${arch}' > /dev/null"`);
|
||||||
|
|||||||
@@ -49,15 +49,17 @@ export async function installAndroidSdk(apiLevel: number, target: string, arch:
|
|||||||
console.log('Installing latest build tools, platform tools, and platform.');
|
console.log('Installing latest build tools, platform tools, and platform.');
|
||||||
|
|
||||||
await exec.exec(`sh -c \\"sdkmanager --install 'build-tools;${BUILD_TOOLS_VERSION}' platform-tools 'platforms;android-${apiLevel}' > /dev/null"`);
|
await exec.exec(`sh -c \\"sdkmanager --install 'build-tools;${BUILD_TOOLS_VERSION}' platform-tools 'platforms;android-${apiLevel}' > /dev/null"`);
|
||||||
if (emulatorBuild) {
|
|
||||||
console.log(`Installing emulator build ${emulatorBuild}.`);
|
|
||||||
await exec.exec(`curl -fo emulator.zip https://dl.google.com/android/repository/emulator-${isOnMac ? 'darwin' : 'linux'}-${emulatorBuild}.zip`);
|
|
||||||
await io.rmRF(`${process.env.ANDROID_SDK_ROOT}/emulator`);
|
|
||||||
await exec.exec(`unzip -q emulator.zip -d ${process.env.ANDROID_SDK_ROOT}`);
|
|
||||||
await io.rmRF('emulator.zip');
|
|
||||||
} else {
|
|
||||||
console.log('Installing latest emulator.');
|
console.log('Installing latest emulator.');
|
||||||
await exec.exec(`sh -c \\"sdkmanager --install emulator > /dev/null"`);
|
await exec.exec(`sh -c \\"sdkmanager --install emulator > /dev/null"`);
|
||||||
|
|
||||||
|
if (emulatorBuild) {
|
||||||
|
console.log(`Installing emulator build ${emulatorBuild}.`);
|
||||||
|
// TODO find out the correct download URLs for all build ids
|
||||||
|
const downloadUrlSuffix = Number(emulatorBuild.charAt(0)) > 6 ? `_x64-${emulatorBuild}` : `-${emulatorBuild}`;
|
||||||
|
await exec.exec(`curl -fo emulator.zip https://dl.google.com/android/repository/emulator-${isOnMac ? 'darwin' : 'linux'}${downloadUrlSuffix}.zip`);
|
||||||
|
await exec.exec(`unzip -o -q emulator.zip -d ${process.env.ANDROID_SDK_ROOT}`);
|
||||||
|
await io.rmRF('emulator.zip');
|
||||||
}
|
}
|
||||||
console.log('Installing system images.');
|
console.log('Installing system images.');
|
||||||
await exec.exec(`sh -c \\"sdkmanager --install 'system-images;android-${apiLevel};${target};${arch}' > /dev/null"`);
|
await exec.exec(`sh -c \\"sdkmanager --install 'system-images;android-${apiLevel};${target};${arch}' > /dev/null"`);
|
||||||
|
|||||||
Reference in New Issue
Block a user