mirror of
https://github.com/reactivecircus/android-emulator-runner.git
synced 2026-09-05 11:39:31 +00:00
Only install / update required components.
This commit is contained in:
@@ -31,7 +31,7 @@ function launchEmulator(apiLevel, target, arch, profile, headless, disableAnimat
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log(`Creating AVD without custom profile.`);
|
console.log(`Creating AVD without custom profile.`);
|
||||||
yield exec.exec(`bash -c \\"echo no | ${AVD_MANAGER_PATH} create avd --force -n test --abi '${target}/${arch}' --package 'system-images;android-${apiLevel};${target};${arch}'`);
|
yield exec.exec(`bash -c \\"echo no | ${AVD_MANAGER_PATH} create avd --force -n test --abi '${target}/${arch}' --package 'system-images;android-${apiLevel};${target};${arch}'"`);
|
||||||
}
|
}
|
||||||
// start emulator
|
// start emulator
|
||||||
console.log('Starting emulator.');
|
console.log('Starting emulator.');
|
||||||
|
|||||||
+5
-20
@@ -16,33 +16,18 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const exec = __importStar(require("@actions/exec"));
|
const exec = __importStar(require("@actions/exec"));
|
||||||
const tc = __importStar(require("@actions/tool-cache"));
|
|
||||||
const fs = __importStar(require("fs"));
|
|
||||||
const BUILD_TOOLS_VERSION = '29.0.2';
|
const BUILD_TOOLS_VERSION = '29.0.2';
|
||||||
const SDK_URL = 'https://dl.google.com/android/repository/sdk-tools-darwin-4333796.zip';
|
|
||||||
/**
|
/**
|
||||||
* Downloads and installs the Android SDK for the macOS platform, including SDK platform for the chosen API level, latest build tools, platform tools, Android Emulator,
|
* Installs & updates the Android SDK for the macOS platform, including SDK platform for the chosen API level, latest build tools, platform tools, Android Emulator,
|
||||||
* and the system image for the chosen API level, CPU arch, and target.
|
* and the system image for the chosen API level, CPU arch, and target.
|
||||||
*/
|
*/
|
||||||
function installAndroidSdk(apiLevel, target, arch) {
|
function installAndroidSdk(apiLevel, target, arch) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
// download Android SDK if not already installed
|
|
||||||
if (fs.existsSync(`${process.env.ANDROID_HOME}/tools/bin/sdkmanager`)) {
|
|
||||||
console.log('Android SDK already installed.');
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
console.log('Downloading Android SDK.');
|
|
||||||
const downloadedSdkPath = yield tc.downloadTool(SDK_URL);
|
|
||||||
yield tc.extractZip(downloadedSdkPath, process.env.ANDROID_HOME);
|
|
||||||
}
|
|
||||||
// install specific SDK tools
|
|
||||||
console.log('Installing build tools, platform tools, platform and system image.');
|
|
||||||
const sdkmangerPath = `${process.env.ANDROID_HOME}/tools/bin/sdkmanager`;
|
const sdkmangerPath = `${process.env.ANDROID_HOME}/tools/bin/sdkmanager`;
|
||||||
yield exec.exec(`echo "y" | ${sdkmangerPath} --licenses > /dev/null`);
|
console.log('Installing build tools, platform tools, and platform.');
|
||||||
yield exec.exec(`${sdkmangerPath} "build-tools;${BUILD_TOOLS_VERSION}"`);
|
yield exec.exec(`bash -c \\"${sdkmangerPath} --install 'build-tools;${BUILD_TOOLS_VERSION}' platform-tools 'platforms;android-${apiLevel}' > /dev/null"`);
|
||||||
yield exec.exec(`${sdkmangerPath} platform-tools "platforms;android-${apiLevel}"`);
|
console.log('Installing system images.');
|
||||||
yield exec.exec(`${sdkmangerPath} "system-images;android-${apiLevel};${target};${arch}"`);
|
yield exec.exec(`bash -c \\"${sdkmangerPath} --install 'system-images;android-${apiLevel};${target};${arch}' > /dev/null"`);
|
||||||
yield exec.exec(`bash -c \\"${sdkmangerPath} --update > /dev/null"`);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.installAndroidSdk = installAndroidSdk;
|
exports.installAndroidSdk = installAndroidSdk;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ export async function launchEmulator(apiLevel: number, target: string, arch: str
|
|||||||
await exec.exec(`${AVD_MANAGER_PATH} create avd --force -n test --abi "${target}/${arch}" --package "system-images;android-${apiLevel};${target};${arch}" --device "${profile}"`);
|
await exec.exec(`${AVD_MANAGER_PATH} create avd --force -n test --abi "${target}/${arch}" --package "system-images;android-${apiLevel};${target};${arch}" --device "${profile}"`);
|
||||||
} else {
|
} else {
|
||||||
console.log(`Creating AVD without custom profile.`);
|
console.log(`Creating AVD without custom profile.`);
|
||||||
await exec.exec(`bash -c \\"echo no | ${AVD_MANAGER_PATH} create avd --force -n test --abi '${target}/${arch}' --package 'system-images;android-${apiLevel};${target};${arch}'`);
|
await exec.exec(`bash -c \\"echo no | ${AVD_MANAGER_PATH} create avd --force -n test --abi '${target}/${arch}' --package 'system-images;android-${apiLevel};${target};${arch}'"`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// start emulator
|
// start emulator
|
||||||
|
|||||||
+5
-20
@@ -1,30 +1,15 @@
|
|||||||
import * as exec from '@actions/exec';
|
import * as exec from '@actions/exec';
|
||||||
import * as tc from '@actions/tool-cache';
|
|
||||||
import * as fs from 'fs';
|
|
||||||
|
|
||||||
const BUILD_TOOLS_VERSION = '29.0.2';
|
const BUILD_TOOLS_VERSION = '29.0.2';
|
||||||
const SDK_URL = 'https://dl.google.com/android/repository/sdk-tools-darwin-4333796.zip';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Downloads and installs the Android SDK for the macOS platform, including SDK platform for the chosen API level, latest build tools, platform tools, Android Emulator,
|
* Installs & updates the Android SDK for the macOS platform, including SDK platform for the chosen API level, latest build tools, platform tools, Android Emulator,
|
||||||
* and the system image for the chosen API level, CPU arch, and target.
|
* and the system image for the chosen API level, CPU arch, and target.
|
||||||
*/
|
*/
|
||||||
export async function installAndroidSdk(apiLevel: number, target: string, arch: string): Promise<void> {
|
export async function installAndroidSdk(apiLevel: number, target: string, arch: string): Promise<void> {
|
||||||
// download Android SDK if not already installed
|
|
||||||
if (fs.existsSync(`${process.env.ANDROID_HOME}/tools/bin/sdkmanager`)) {
|
|
||||||
console.log('Android SDK already installed.');
|
|
||||||
} else {
|
|
||||||
console.log('Downloading Android SDK.');
|
|
||||||
const downloadedSdkPath = await tc.downloadTool(SDK_URL);
|
|
||||||
await tc.extractZip(downloadedSdkPath, process.env.ANDROID_HOME);
|
|
||||||
}
|
|
||||||
|
|
||||||
// install specific SDK tools
|
|
||||||
console.log('Installing build tools, platform tools, platform and system image.');
|
|
||||||
const sdkmangerPath = `${process.env.ANDROID_HOME}/tools/bin/sdkmanager`;
|
const sdkmangerPath = `${process.env.ANDROID_HOME}/tools/bin/sdkmanager`;
|
||||||
await exec.exec(`echo "y" | ${sdkmangerPath} --licenses > /dev/null`);
|
console.log('Installing build tools, platform tools, and platform.');
|
||||||
await exec.exec(`${sdkmangerPath} "build-tools;${BUILD_TOOLS_VERSION}"`);
|
await exec.exec(`bash -c \\"${sdkmangerPath} --install 'build-tools;${BUILD_TOOLS_VERSION}' platform-tools 'platforms;android-${apiLevel}' > /dev/null"`);
|
||||||
await exec.exec(`${sdkmangerPath} platform-tools "platforms;android-${apiLevel}"`);
|
console.log('Installing system images.');
|
||||||
await exec.exec(`${sdkmangerPath} "system-images;android-${apiLevel};${target};${arch}"`);
|
await exec.exec(`bash -c \\"${sdkmangerPath} --install 'system-images;android-${apiLevel};${target};${arch}' > /dev/null"`);
|
||||||
await exec.exec(`bash -c \\"${sdkmangerPath} --update > /dev/null"`);
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user