From 7ea50439cef9600fbf993346d676ff9b17c19f2a Mon Sep 17 00:00:00 2001 From: Pascal Hartig Date: Fri, 21 Jul 2017 03:07:01 -0700 Subject: [PATCH] Fix travis NDK setup Summary: Phew, this took a while. Buck had some changes in how it picks up SDK/NDK configs. In order to satisfy the new demands, I'm now installing the NDK manually and no longer through the SDK manager. I'm also trying to cache as much as possible to reduce the flakiness here. Reviewed By: emilsjolander Differential Revision: D5465206 fbshipit-source-id: 61a4b9006fe96fc9a99fb9d75b822589064a9d1a --- .buckconfig | 2 +- .travis.yml | 4 ++++ scripts/android-setup.sh | 25 ++++++++++++++++++------- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/.buckconfig b/.buckconfig index 12667fb3..90ed0005 100644 --- a/.buckconfig +++ b/.buckconfig @@ -1,7 +1,7 @@ [cxx] gtest_dep = //lib/gtest:gtest [android] - target = android-23 + target = android-25 [ndk] ndk_version = 13.1.3345770 compiler = clang diff --git a/.travis.yml b/.travis.yml index fc9610db..91f79aac 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,8 @@ compiler: clang cache: directories: - $HOME/Library/Caches/Homebrew + - $HOME/android-sdk + - $HOME/android-ndk env: - TARGET=c @@ -73,6 +75,8 @@ before_install: export TERMINAL=dumb; source scripts/android-setup.sh && installAndroidSDK export ANDROID_SDK=$ANDROID_HOME + export ANDROID_NDK_REPOSITORY=$HOME/android-ndk + export ANDROID_NDK_HOME=$ANDROID_NDK_REPOSITORY/android-ndk-13b fi # JavaScript diff --git a/scripts/android-setup.sh b/scripts/android-setup.sh index 47207041..0ed7adc6 100644 --- a/scripts/android-setup.sh +++ b/scripts/android-setup.sh @@ -21,17 +21,28 @@ function installsdk() { } function installAndroidSDK { - TMP=/tmp/sdk$$.zip - download 'https://dl.google.com/android/repository/tools_r25.2.3-linux.zip' $TMP - unzip -d $HOME/android-sdk $TMP - rm $TMP - export ANDROID_HOME=$HOME/android-sdk + export ANDROID_NDK_REPOSITORY=$HOME/android-ndk export PATH="$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$PATH" + if [[ ! -d "$ANDROID_HOME" ]]; then + TMP=/tmp/sdk$$.zip + download 'https://dl.google.com/android/repository/sdk-tools-darwin-3859397.zip' $TMP + unzip -qod $ANDROID_HOME $TMP + rm $TMP + fi + + if [[ ! -d "$ANDROID_NDK_REPOSITORY" ]]; then + TMP=/tmp/ndk$$.zip + mkdir -p $ANDROID_NDK_REPOSITORY + download 'https://dl.google.com/android/repository/android-ndk-r13b-darwin-x86_64.zip' $TMP + unzip -qod $ANDROID_NDK_REPOSITORY $TMP + rm $TMP + fi + mkdir -p $ANDROID_HOME/licenses/ echo > $ANDROID_HOME/licenses/android-sdk-license - echo -n 8933bad161af4178b1185d1a37fbf41ea5269c55 > $ANDROID_HOME/licenses/android-sdk-license + echo -n 8933bad161af4178b1185d1a37fbf41ea5269c55 >> $ANDROID_HOME/licenses/android-sdk-license - installsdk 'build-tools;23.0.2' 'build-tools;25.0.2' 'build-tools;25.0.1' 'platforms;android-23' 'platforms;android-25' 'ndk-bundle' 'extras;android;m2repository' + installsdk 'build-tools;23.0.2' 'build-tools;25.0.2' 'build-tools;25.0.1' 'platform-tools' 'platforms;android-23' 'platforms;android-25' 'extras;android;m2repository' }