image: registry.gitlab.com/fdroid/ci-images-base:latest

cache:
  paths:
    - .gradle/wrapper
    - .gradle/caches

before_script:
  - set -e
  - export GRADLE_USER_HOME=$PWD/.gradle
  # Accept the license for the Android build tools
  - echo y | /opt/android-sdk/tools/bin/sdkmanager "build-tools;26.0.2"
  # Download OpenJDK 6 so we can compile against its standard library
  - JDK_FILE=openjdk-6-jre-headless_6b38-1.13.10-1~deb7u1_amd64.deb
  - if [ ! -d openjdk ]
  - then
  - wget -q http://ftp.uk.debian.org/debian/pool/main/o/openjdk-6/$JDK_FILE
  - dpkg-deb -x $JDK_FILE openjdk
  - fi
  - export JAVA_6_HOME=$PWD/openjdk/usr/lib/jvm/java-6-openjdk-amd64

test:
  script:
    - ./gradlew test

after_script:
    # this file changes every time but should not be cached
    - rm -f $GRADLE_USER_HOME/caches/modules-2/modules-2.lock
    - rm -fr $GRADLE_USER_HOME/caches/*/plugin-resolution/
