diff options
| author | kennytm <kennytm@gmail.com> | 2017-10-28 03:14:25 +0800 |
|---|---|---|
| committer | kennytm <kennytm@gmail.com> | 2017-10-29 05:58:00 +0800 |
| commit | c46b04cbdd1bdf0183b121fac18513c0609962ee (patch) | |
| tree | 28218f82fc287570b185314fefce647a0a7d8ebe /src/ci/docker/scripts | |
| parent | 2e6a1a9fb49f30e41316fb374b12301a3445ae8d (diff) | |
| download | rust-c46b04cbdd1bdf0183b121fac18513c0609962ee.tar.gz rust-c46b04cbdd1bdf0183b121fac18513c0609962ee.zip | |
ci: Upgrade Android SDK/NDK and refactor to use sdkmanager/avdmanager.
* SDK tools is upgraded to 27.0.0.
- Refactored to use `sdkmanager`/`avdmanager` instead of the deprecated
`android` tool.
* The Java version used by Android SDK is downgraded to OpenJDK-8, in order
to download the SDK through HTTPS.
* NDK is upgrade to r15c.
- Dropped support for android-9 (2.3 / Gingerbread), the minimal
supported version is now android-14 (4.0 / Ice Cream Sandwich).
- Changed the default Android compiler from GCC to clang.
- For details of change introduced by NDK r15, see
https://github.com/android-ndk/ndk/wiki/Changelog-r15.
Diffstat (limited to 'src/ci/docker/scripts')
| -rw-r--r-- | src/ci/docker/scripts/android-sdk.sh | 52 |
1 files changed, 32 insertions, 20 deletions
diff --git a/src/ci/docker/scripts/android-sdk.sh b/src/ci/docker/scripts/android-sdk.sh index 3aa2b9d58d5..99c5776c2e8 100644 --- a/src/ci/docker/scripts/android-sdk.sh +++ b/src/ci/docker/scripts/android-sdk.sh @@ -10,40 +10,40 @@ set -ex -URL=https://dl.google.com/android/repository +export ANDROID_HOME=/android/sdk +PATH=$PATH:"${ANDROID_HOME}/tools/bin" download_sdk() { - mkdir -p /android/sdk - cd /android/sdk - curl -fO $URL/$1 - unzip -q $1 - rm -rf $1 + mkdir -p /android + curl -fo sdk.zip "https://dl.google.com/android/repository/sdk-tools-linux-$1.zip" + unzip -q sdk.zip -d "$ANDROID_HOME" + rm -f sdk.zip } download_sysimage() { - # See https://developer.android.com/studio/tools/help/android.html abi=$1 api=$2 - filter="platform-tools,android-$api" - filter="$filter,sys-img-$abi-android-$api" - - # Keep printing yes to accept the licenses - while true; do echo yes; sleep 10; done | \ - /android/sdk/tools/android update sdk -a --no-ui \ - --filter "$filter" --no-https + # See https://developer.android.com/studio/command-line/sdkmanager.html for + # usage of `sdkmanager`. + # + # The output from sdkmanager is so noisy that it will occupy all of the 4 MB + # log extremely quickly. Thus we must silence all output. + yes | sdkmanager --licenses > /dev/null + sdkmanager platform-tools emulator \ + "platforms;android-$api" \ + "system-images;android-$api;default;$abi" > /dev/null } create_avd() { - # See https://developer.android.com/studio/tools/help/android.html abi=$1 api=$2 - echo no | \ - /android/sdk/tools/android create avd \ - --name $abi-$api \ - --target android-$api \ - --abi $abi + # See https://developer.android.com/studio/command-line/avdmanager.html for + # usage of `avdmanager`. + echo no | avdmanager create avd \ + -n "$abi-$api" \ + -k "system-images;android-$api;default;$abi" } download_and_create_avd() { @@ -51,3 +51,15 @@ download_and_create_avd() { download_sysimage $2 $3 create_avd $2 $3 } + +# Usage: +# +# setup_android_sdk 4333796 armeabi-v7a 18 +# +# 4333796 => +# SDK tool version. +# Copy from https://developer.android.com/studio/index.html#command-tools +# armeabi-v7a => +# System image ABI +# 18 => +# Android API Level (18 = Android 4.3 = Jelly Bean MR2) |
