notifications:
  irc: chat.freenode.net#reicast
language: cpp
compiler: gcc
before_install:
- openssl aes-256-cbc -K $encrypted_c726d225a9d9_key -iv $encrypted_c726d225a9d9_iv
  -in debug.keystore.enc -out debug.keystore -d
- sudo apt-get install aria2 -qq
- download_extract() { aria2c -x 16 $1 -o $2 && tar -xf $2; }
- download_extract_zip() { aria2c -x 16 $1 -o $2 && unzip -qq $2; }
- sudo apt-get -qq update
- sudo apt-get -qq -y install openjdk-7-jdk ant lib32z1-dev lib32stdc++6
- GIT_HASH=`git log --pretty=format:'%h' -n 1`
- GIT_BUILD=`git describe --all`-$GIT_HASH
install:
- download_extract http://dl.google.com/android/ndk/android-ndk-r9c-linux-x86_64.tar.bz2
  android-ndk-r9c-linux-x86_64.tar.bz2
- download_extract_zip http://dl.google.com/android/adt/adt-bundle-linux-x86_64-20131030.zip
  adt-bundle-linux-x86_64-20131030.zip
- mv android-ndk-r9c android-ndk
- mv adt-bundle-linux-x86_64-20131030/sdk/ android-sdk
- rm android-ndk-r9c-linux-x86_64.tar.bz2
- rm adt-bundle-linux-x86_64-20131030.zip
- export ANDROID_HOME=$(pwd)/android-sdk
- export NDK=$(pwd)/android-ndk
- export ANDROID_NDK=$(pwd)/android-ndk
- export PATH=${PATH}:$ANDROID_HOME/tools
- export PATH=${PATH}:$ANDROID_HOME/platform-tools
- export PATH=${PATH}:$NDK
- mkdir -p ~/.android
- mv debug.keystore ~/.android/debug.keystore
before_script: 
script:
- cd shell/android
- android update project -p . --target "android-19"
- export NUMBER_OF_PROCESSORS=2
- ant debug
before_deploy:
- cd ../../
- mkdir -p artifacts/$GIT_BUILD/
- cp shell/android/bin/reicast-debug.apk  artifacts/$GIT_BUILD/reicast-android-debug-$GIT_HASH.apk
deploy:
  provider: s3
  access_key_id: AKIAJR5J3OHAQUP5BHHQ
  secret_access_key:
    secure: dDmBiadS1cc2XCWWDZ1kwZGIoLkwEOLsdi5nzVdn1dHMsEKxN3u+3WFuuOfJHZYcdrtN7VhojCarPa+eGDDeiVme4m3y+QKMbI9lecHX9+t4jDNUyYep5TpeIVUkZ7fj4JsMi7U9/YFBTg7QnqvVsMAHE9vobkvjegjAYToBrlM=
  bucket: reicast-builds
  local-dir: artifacts
  upload-dir: builds
  skip_cleanup: true
  on:
    all_branches: true
    repo: reicast/reicast-emulator
after_deploy:
- echo "done"
