From 807f515f535a4cea06ed8b4299548ed74350a126 Mon Sep 17 00:00:00 2001 From: Sean Barbeau <sjbarbeau@gmail.com> Date: Tue, 6 Oct 2015 17:14:58 -0400 Subject: [PATCH] Fix #207 - Add Travis CI support * This patch keeps the project at `compileSdkVersion 23` while running on the API Level 21 Google API emulator on Travis, because: a) Google API emulator image is needed to run tests that require Google Play Services (see https://developers.google.com/android/guides/setup, https://github.com/googlemaps/android-maps-utils/pull/203#issuecomment-141721720) b) API Level 23 Google API emulator seems to have a bug preventing use on Travis - see https://github.com/googlemaps/android-maps-utils/issues/207#issuecomment-144904766 * When the issue with the API Level 23 Google API emulator is resolved, the `EMULATOR_API_LEVEL` variable in .travis.yml can be bumped to 23 as well. * This patch also adds a command-line option to disable pre-dexing, which is used on Travis to decrease build times (see http://tools.android.com/tech-docs/new-build-system/tips#TOC-Improving-Build-Server-performance.) --- .travis.yml | 47 +++++++++++++++++++++++++++++++++++++++++++++++ README.md | 2 +- build.gradle | 15 +++++++++++++++ 3 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..e19bfc58d --- /dev/null +++ b/.travis.yml @@ -0,0 +1,47 @@ +language: android +jdk: oraclejdk7 +# Use the Travis Container-Based Infrastructure +sudo: false + +cache: + directories: + - ${TRAVIS_BUILD_DIR}/gradle/caches/ + - ${TRAVIS_BUILD_DIR}/gradle/wrapper/dists/ + +env: + global: + - ANDROID_API_LEVEL=23 + - EMULATOR_API_LEVEL=21 + - ANDROID_BUILD_TOOLS_VERSION=23.0.0 + - ANDROID_ABI=google_apis/armeabi-v7a + - ADB_INSTALL_TIMEOUT=20 # minutes (2 minutes by default) + +android: + components: + - platform-tools + - tools + - build-tools-$ANDROID_BUILD_TOOLS_VERSION + - android-$ANDROID_API_LEVEL + - android-$EMULATOR_API_LEVEL + # For Google APIs + - addon-google_apis-google-$ANDROID_API_LEVEL + - addon-google_apis-google-$EMULATOR_API_LEVEL + # Google Play Services + - extra-google-google_play_services + # Support library + - extra-android-support + # Latest artifacts in local repository + - extra-google-m2repository + - extra-android-m2repository + # Specify at least one system image + - sys-img-armeabi-v7a-addon-google_apis-google-$ANDROID_API_LEVEL + - sys-img-armeabi-v7a-addon-google_apis-google-$EMULATOR_API_LEVEL + +before_script: + # Create and start emulator + - echo no | android create avd --force -n test -t "Google Inc.:Google APIs:"$EMULATOR_API_LEVEL --abi $ANDROID_ABI + - emulator -avd test -no-skin -no-audio -no-window & + - android-wait-for-emulator + +script: + - ./gradlew connectedCheck -x library:signArchives -PdisablePreDex \ No newline at end of file diff --git a/README.md b/README.md index 67f57b30d..5de668963 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[](https://maven-badges.herokuapp.com/maven-central/com.google.maps.android/android-maps-utils) +[](https://maven-badges.herokuapp.com/maven-central/com.google.maps.android/android-maps-utils)[](https://travis-ci.org/googlemaps/android-maps-utils) # Google Maps Android API utility library diff --git a/build.gradle b/build.gradle index a953b8340..83261960f 100644 --- a/build.gradle +++ b/build.gradle @@ -7,3 +7,18 @@ buildscript { classpath 'com.android.tools.build:gradle:1.3.0' } } +/** + * Improve build server performance by allowing disabling of pre-dexing + * (see http://tools.android.com/tech-docs/new-build-system/tips#TOC-Improving-Build-Server-performance.) + */ +project.ext.preDexLibs = !project.hasProperty('disablePreDex') + +subprojects { + project.plugins.whenPluginAdded { plugin -> + if ("com.android.build.gradle.AppPlugin".equals(plugin.class.name)) { + project.android.dexOptions.preDexLibraries = rootProject.ext.preDexLibs + } else if ("com.android.build.gradle.LibraryPlugin".equals(plugin.class.name)) { + project.android.dexOptions.preDexLibraries = rootProject.ext.preDexLibs + } + } +} \ No newline at end of file