Skip to content

Commit a1d99e3

Browse files
committed
Fix #207 - Add Travis CI support
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.)
1 parent dba3b0d commit a1d99e3

File tree

5 files changed

+61
-3
lines changed

5 files changed

+61
-3
lines changed

.travis.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
language: android
2+
jdk: oraclejdk7
3+
# Use the Travis Container-Based Infrastructure
4+
sudo: false
5+
6+
cache:
7+
directories:
8+
- ${TRAVIS_BUILD_DIR}/gradle/caches/
9+
- ${TRAVIS_BUILD_DIR}/gradle/wrapper/dists/
10+
11+
env:
12+
global:
13+
- ANDROID_API_LEVEL=21
14+
- ANDROID_BUILD_TOOLS_VERSION=23.0.0
15+
- ANDROID_ABI=google_apis/armeabi-v7a
16+
- ADB_INSTALL_TIMEOUT=20 # minutes (2 minutes by default)
17+
18+
android:
19+
components:
20+
- platform-tools
21+
- tools
22+
- build-tools-$ANDROID_BUILD_TOOLS_VERSION
23+
- android-$ANDROID_API_LEVEL
24+
# For Google APIs
25+
- addon-google_apis-google-$ANDROID_API_LEVEL
26+
# Google Play Services
27+
- extra-google-google_play_services
28+
# Support library
29+
- extra-android-support
30+
# Latest artifacts in local repository
31+
- extra-google-m2repository
32+
- extra-android-m2repository
33+
# Specify at least one system image
34+
- sys-img-armeabi-v7a-addon-google_apis-google-$ANDROID_API_LEVEL
35+
36+
before_script:
37+
# Create and start emulator
38+
- echo no | android create avd --force -n test -t "Google Inc.:Google APIs:"$ANDROID_API_LEVEL --abi $ANDROID_ABI
39+
- emulator -avd test -no-skin -no-audio -no-window &
40+
- android-wait-for-emulator
41+
42+
script:
43+
- ./gradlew connectedCheck -x library:signArchives -PdisablePreDex

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![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)
1+
[![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)
22

33
# Google Maps Android API utility library
44

build.gradle

+15
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,18 @@ buildscript {
77
classpath 'com.android.tools.build:gradle:1.3.0'
88
}
99
}
10+
/**
11+
* Improve build server performance by allowing disabling of pre-dexing
12+
* (see http://tools.android.com/tech-docs/new-build-system/tips#TOC-Improving-Build-Server-performance.)
13+
*/
14+
project.ext.preDexLibs = !project.hasProperty('disablePreDex')
15+
16+
subprojects {
17+
project.plugins.whenPluginAdded { plugin ->
18+
if ("com.android.build.gradle.AppPlugin".equals(plugin.class.name)) {
19+
project.android.dexOptions.preDexLibraries = rootProject.ext.preDexLibs
20+
} else if ("com.android.build.gradle.LibraryPlugin".equals(plugin.class.name)) {
21+
project.android.dexOptions.preDexLibraries = rootProject.ext.preDexLibs
22+
}
23+
}
24+
}

demo/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ dependencies {
1818
}
1919

2020
android {
21-
compileSdkVersion 23
21+
compileSdkVersion "Google Inc.:Google APIs:21"
2222
buildToolsVersion "23.0.0"
2323

2424
sourceSets {

library/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ dependencies {
2121

2222

2323
android {
24-
compileSdkVersion 23
24+
compileSdkVersion "Google Inc.:Google APIs:21"
2525
buildToolsVersion "23.0.0"
2626

2727
sourceSets {

0 commit comments

Comments
 (0)