Add input validations with tests.

This commit is contained in:
Yang Chen
2019-11-06 18:59:27 +11:00
parent d6aab89c3b
commit 137c96a972
9 changed files with 168 additions and 54 deletions
+2 -3
View File
@@ -24,7 +24,7 @@ const SDK_URL = 'https://dl.google.com/android/repository/sdk-tools-darwin-43337
* 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.
*/
function installAndroidSdk(apiLevel, abi, target) {
function installAndroidSdk(apiLevel, target, abi) {
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`)) {
@@ -37,8 +37,7 @@ function installAndroidSdk(apiLevel, abi, target) {
}
// install specific SDK tools
console.log('Installing build tools, platform tools, platform and system image.');
yield exec.exec(`yes | ${process.env.ANDROID_HOME}/tools/bin/sdkmanager --licenses`);
yield exec.exec(`${process.env.ANDROID_HOME}/tools/bin/sdkmanager --update`);
yield exec.exec(`echo "y" | ${process.env.ANDROID_HOME}/tools/bin/sdkmanager --licenses > /dev/null`);
yield exec.exec(`${process.env.ANDROID_HOME}/tools/bin/sdkmanager "build-tools;${BUILD_TOOLS_VERSION}"`);
yield exec.exec(`${process.env.ANDROID_HOME}/tools/bin/sdkmanager "platform-tools"`);
yield exec.exec(`${process.env.ANDROID_HOME}/tools/bin/sdkmanager "platforms;android-${apiLevel}"`);