notifications:
  irc: chat.freenode.net#reicast
language: android
android:
  components:
    - platform-tools
    - tools
    - build-tools-22.0.0
    - android-21
sudo: false
before_install:
- openssl aes-256-cbc -K $encrypted_c726d225a9d9_key -iv $encrypted_c726d225a9d9_iv
  -in debug.keystore.enc -out debug.keystore -d
- GIT_HASH=`git log --pretty=format:'%h' -n 1`
- GIT_BUILD=`git describe --all`-$GIT_HASH
install:
- wget http://dl.google.com/android/ndk/android-ndk-r10d-linux-x86_64.bin
- chmod +x android-ndk-r10d-linux-x86_64.bin
- ./android-ndk-r10d-linux-x86_64.bin -y | grep -v Extracting
- mv android-ndk-r10d android-ndk
- rm android-ndk-r10d-linux-x86_64.bin
- 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-21"
- 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"
