Skip to content

Commit

Permalink
Travis CI: refactoring build script
Browse files Browse the repository at this point in the history
  • Loading branch information
serso committed Nov 2, 2013
1 parent 9e5b7e6 commit 1633218
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 36 deletions.
20 changes: 5 additions & 15 deletions .travis.yml
@@ -1,25 +1,15 @@
language: java
jdk: oraclejdk7

before_install:
# Install base Android SDK
- sudo apt-get update -qq
- sudo apt-get install expect
- if [ `uname -m` = x86_64 ]; then sudo apt-get install -qq libstdc++6:i386 lib32z1; fi
- wget -O android-sdk.tgz http://dl.google.com/android/android-sdk_r22.0.4-linux.tgz
- tar xzf android-sdk.tgz
- export ANDROID_HOME=$PWD/android-sdk-linux
- export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools
- chmod +x $PWD/.travis_install_android.sh
- $PWD/.travis_install_android.sh

- git clone git://github.com/mosabua/maven-android-sdk-deployer.git
- cd ./maven-android-sdk-deployer/
- mvn install -P4.2
- cd ..
- chmod +x $PWD/.travis_install_android_dependencies.sh
- $PWD/.travis_install_android_dependencies.sh

# Create and start emulator
- echo no | android create avd --force -n Default -t android-17 --abi armeabi-v7a
- emulator -avd Default -no-skin -no-audio -no-window &
- chmod +x $PWD/.travis_start_emulator.sh
- $PWD/.travis_start_emulator.sh

before_script:
- chmod +x $PWD/.travis_wait_for_emulator.sh
Expand Down
34 changes: 13 additions & 21 deletions .travis_install_android.sh
@@ -1,22 +1,14 @@
#!/usr/bin/expect -f
spawn android update sdk --filter tools,platform-tools,build-tools-19.0.0,extra-android-support,android-17,sysimg-17,addon-google_apis-google-17,android-19,sysimg-19,addon-google_apis-google-19,addon-google_apis-google-19,extra-google-play_billing,extra-google-m2repository,extra-google-analytics_sdk_v2,extra-google-gcm,extra-google-google_play_services,extra-google-play_apk_expansion,extra-android-m2repository --no-ui --force --all
expect "Do you accept the license *:"
send -- "y\r"
expect "Do you accept the license *:"
send -- "y\r"
expect "Do you accept the license *:"
send -- "y\r"
expect "Do you accept the license *:"
send -- "y\r"
expect "Do you accept the license *:"
send -- "y\r"
expect "Do you accept the license *:"
send -- "y\r"
expect "Do you accept the license *:"
send -- "y\r"
interact
#!/bin/bash

spawn android update sdk --filter extra-google-admob_ads_sdk,extra-google-play_licensing --no-ui --force --all
expect "Do you accept the license *:"
send -- "y\r"
interact
# Script installs Android SDK

sudo apt-get update -qq
if [ `uname -m` = x86_64 ]; then sudo apt-get install -qq libstdc++6:i386 lib32z1; fi
wget -O android-sdk.tgz http://dl.google.com/android/android-sdk_r22.0.4-linux.tgz
tar xzf android-sdk.tgz
export ANDROID_HOME=$PWD/android-sdk-linux
export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools

sudo apt-get install expect
chmod +x $PWD/.travis_install_android_sdk.sh
$PWD/.travis_install_android_sdk.sh
9 changes: 9 additions & 0 deletions .travis_install_android_dependencies.sh
@@ -0,0 +1,9 @@
#!/bin/bash

# Scripts installs Android SDK artifacts in local Maven repository

git clone git://github.com/serso/maven-android-sdk-deployer.git
cd ./maven-android-sdk-deployer/
git checkout tags/api-19
mvn install -P4.2
cd ..
26 changes: 26 additions & 0 deletions .travis_install_android_sdk.sh
@@ -0,0 +1,26 @@
#!/usr/bin/expect -f

# Script installs Android SDK components

spawn android update sdk --filter tools,platform-tools,build-tools-19.0.0,extra-android-support,android-17,sysimg-17,addon-google_apis-google-17,android-19,sysimg-19,addon-google_apis-google-19,addon-google_apis-google-19,extra-google-play_billing,extra-google-m2repository,extra-google-analytics_sdk_v2,extra-google-gcm,extra-google-google_play_services,extra-google-play_apk_expansion,extra-android-m2repository --no-ui --force --all
expect "Do you accept the license *:"
send -- "y\r"
expect "Do you accept the license *:"
send -- "y\r"
expect "Do you accept the license *:"
send -- "y\r"
expect "Do you accept the license *:"
send -- "y\r"
expect "Do you accept the license *:"
send -- "y\r"
expect "Do you accept the license *:"
send -- "y\r"
expect "Do you accept the license *:"
send -- "y\r"
interact

# WORKAROUND: for some reason we need to download following extras separately (otherwise we will get PkgVersion=2 instead of PkgVersion=2.0.0)
spawn android update sdk --filter extra-google-admob_ads_sdk,extra-google-play_licensing --no-ui --force --all
expect "Do you accept the license *:"
send -- "y\r"
interact
6 changes: 6 additions & 0 deletions .travis_start_emulator.sh
@@ -0,0 +1,6 @@
#!/bin/bash

# Scripts starts Android emulator with name 'Default'

echo no | android create avd --force -n Default -t android-17 --abi armeabi-v7a
emulator -avd Default -no-skin -no-audio -no-window &
2 changes: 2 additions & 0 deletions .travis_wait_for_emulator.sh
@@ -1,5 +1,7 @@
#!/bin/bash

# Script waits for Android emulator to be started

bootanim=""
failcounter=0
until [[ "$bootanim" =~ "stopped" ]]; do
Expand Down

0 comments on commit 1633218

Please sign in to comment.