language: android
sudo: required
jdk: oraclejdk8

env:
  global:
  - ANDROID_API_LEVEL=26
  - ANDROID_BUILD_TOOLS_VERSION=26.0.0
  - ANDROID_ABI=armeabi-v7a
  - ANDROID_ABI=X86
  - ANDROID_ABI=ARMEABI_V7A

android:
  components:
    - tools
    - build-tools-$ANDROID_BUILD_TOOLS_VERSION
    - android-$ANDROID_API_LEVEL
    - extra-android-m2repository
  licenses:
    - yes | sudo sdkmanager --licenses
    - 'android-sdk-preview-license-52d11cd2'
    - 'android-sdk-license-.+'
    - 'google-gdk-license-.+'

before_install:  
  - yes | sdkmanager "platforms;android-26"
  - yes | sdkmanager "build-tools;26.0.0"
  - yes | sdkmanager "platforms;android-28"
  - yes | sdkmanager "build-tools;28.0.3"

before_cache:
  - rm -f  $HOME/.gradle/caches/modules-2/modules-2.lock
  - rm -fr $HOME/.gradle/caches/*/plugin-resolution/

cache:
  directories:
  - $HOME/.gradle/caches/
  - $HOME/.gradle/wrapper/
  - $HOME/.android/build-cache

before_script:
  - chmod +x gradlew

script:
  - ./gradlew clean build
  - ./gradlew test

deploy:
  provider: releases
  api-key: $GITHUB_API_KEY
  file: $TRAVIS_BUILD_DIR/app/build/outputs/apk/debug/app-debug.apk
  skip_cleanup: true
  name: PojavLauncher-v3_DevBuild-$TRAVIS_COMMIT
  body: Automatic build of PojavLauncher from the latest source commit ($TRAVIS_COMMIT) built by Travis CI on $(date +'%F %T %Z').
  prerelease: true
  overwrite: true
  target_commitish: $TRAVIS_COMMIT
#  on: [push]
