Skip to content

Commit

Permalink
Fix #207 - Add Travis CI support
Browse files Browse the repository at this point in the history
As discussed in #207 (comment), requires changing to `compileSdkVersion "Google Inc.:Google APIs:21"`, because:
a) Google API emulator image is needed to run tests that require Google Play Services (see https://developers.google.com/android/guides/setup)
b) the Google API Level 23 emulator seems to have a bug that doesn't allow installing/running tests from the command line

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.)
  • Loading branch information
barbeau committed Oct 5, 2015
1 parent dba3b0d commit a1d99e3
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 3 deletions.
43 changes: 43 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
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=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
# For Google APIs
- addon-google_apis-google-$ANDROID_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

before_script:
# Create and start emulator
- echo no | android create avd --force -n test -t "Google Inc.:Google APIs:"$ANDROID_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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.google.maps.android/android-maps-utils/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.google.maps.android/android-maps-utils)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.google.maps.android/android-maps-utils/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.google.maps.android/android-maps-utils)[![Build Status](https://travis-ci.org/googlemaps/android-maps-utils.svg?branch=master)](https://travis-ci.org/googlemaps/android-maps-utils)

# Google Maps Android API utility library

Expand Down
15 changes: 15 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
2 changes: 1 addition & 1 deletion demo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ dependencies {
}

android {
compileSdkVersion 23
compileSdkVersion "Google Inc.:Google APIs:21"
buildToolsVersion "23.0.0"

sourceSets {
Expand Down
2 changes: 1 addition & 1 deletion library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ dependencies {


android {
compileSdkVersion 23
compileSdkVersion "Google Inc.:Google APIs:21"
buildToolsVersion "23.0.0"

sourceSets {
Expand Down

0 comments on commit a1d99e3

Please sign in to comment.