Add support for configuring hardware profile and running custom script.

This commit is contained in:
Yang Chen
2019-11-08 19:51:51 +11:00
parent 34df1eaf0e
commit 0f9b17b151
12 changed files with 150 additions and 81 deletions
+6 -4
View File
@@ -18,12 +18,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
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 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,
* and the system image for the chosen API level, cpu/abi, and target.
* and the system image for the chosen API level, CPU arch, and target.
*/
function installAndroidSdk(apiLevel, target, abi) {
function installAndroidSdk(apiLevel, target, arch) {
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`)) {
@@ -38,8 +39,9 @@ function installAndroidSdk(apiLevel, target, abi) {
console.log('Installing build tools, platform tools, platform and system image.');
const sdkmangerPath = `${process.env.ANDROID_HOME}/tools/bin/sdkmanager`;
yield exec.exec(`echo "y" | ${sdkmangerPath} --licenses > /dev/null`);
yield exec.exec(`${sdkmangerPath} tools platform-tools "platforms;android-${apiLevel}"`);
yield exec.exec(`${sdkmangerPath} "system-images;android-${apiLevel};${target};${abi}"`);
yield exec.exec(`${sdkmangerPath} "build-tools;${BUILD_TOOLS_VERSION}"`);
yield exec.exec(`${sdkmangerPath} platform-tools "platforms;android-${apiLevel}"`);
yield exec.exec(`${sdkmangerPath} "system-images;android-${apiLevel};${target};${arch}"`);
yield exec.exec(`bash -c \\"${sdkmangerPath} --update > /dev/null"`);
});
}