Skip to content

Commit

Permalink
Cache Android NDK, tools and platform tools on Travis CI.
Browse files Browse the repository at this point in the history
  • Loading branch information
pietro authored and briansmith committed Jun 8, 2017
1 parent 52c645b commit b7073f4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ cache:
directories:
- $HOME/kcov-i686-unknown-linux-gnu
- $HOME/kcov-x86_64-unknown-linux-gnu
- $HOME/android/android-sdk-linux
- $HOME/android/android-18-arm-linux-androideabi-4.8
- $HOME/android/android-ndk
- $HOME/android/android-sdk-linux/platform-tools
- $HOME/android/android-sdk-linux/tools
matrix:
fast_finish: true
allow_failures:
Expand Down
20 changes: 12 additions & 8 deletions mk/travis-install-android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,24 @@ ANDROID_NDK_VERSION=${ANDROID_NDK_VERSION:-14}
ANDROID_NDK_URL=https://dl.google.com/android/repository/android-ndk-r${ANDROID_NDK_VERSION}-linux-x86_64.zip

ANDROID_INSTALL_PREFIX="${HOME}/android"
ANDROID_SDK_INSTALL_DIR="${HOME}/android/android-sdk-linux"
ANDROID_NDK_INSTALL_DIR="${ANDROID_INSTALL_PREFIX}/android-18-arm-linux-androideabi-4.8"
ANDROID_SDK_INSTALL_DIR="${ANDROID_INSTALL_PREFIX}/android-sdk-linux"
ANDROID_NDK_INSTALL_DIR="${ANDROID_INSTALL_PREFIX}/android-ndk"

if [[ ! -f $ANDROID_SDK_INSTALL_DIR/tools/emulator ]];then
mkdir -p "${ANDROID_INSTALL_PREFIX}"
pushd "${ANDROID_INSTALL_PREFIX}"
ANDROID_PKGS="android-18,android-18,sys-img-armeabiv7a-android-18"

curl ${ANDROID_SDK_URL} | tar -zxf -
mkdir -p "${ANDROID_INSTALL_PREFIX}"
pushd "${ANDROID_INSTALL_PREFIX}"

echo y | ./android-sdk-linux/tools/android update sdk -a --no-ui --filter tools,platform-tools,android-18,sys-img-armeabi-v7a-android-18
if [[ ! -f $ANDROID_SDK_INSTALL_DIR/tools/emulator ]];then
curl ${ANDROID_SDK_URL} | tar -zxf -

popd
ANDROID_PKGS="tools,platform-tools,${ANDROID_PKGS}"
fi

echo y | ./android-sdk-linux/tools/android update sdk -a --no-ui --filter ${ANDROID_PKGS}

popd

if [[ ! -d $ANDROID_NDK_INSTALL_DIR/sysroot/usr/include/arm-linux-androideabi ]];then
mkdir -p "${ANDROID_INSTALL_PREFIX}/downloads"
pushd "${ANDROID_INSTALL_PREFIX}/downloads"
Expand Down
2 changes: 1 addition & 1 deletion mk/travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ armv7-linux-androideabi)
# install the android sdk/ndk
mk/travis-install-android.sh

export PATH=$HOME/android/android-18-arm-linux-androideabi-4.8/bin:$PATH
export PATH=$HOME/android/android-ndk/bin:$PATH
export PATH=$HOME/android/android-sdk-linux/platform-tools:$PATH
export PATH=$HOME/android/android-sdk-linux/tools:$PATH
;;
Expand Down

0 comments on commit b7073f4

Please sign in to comment.