git:
  depth: false

language: java

env:
  global:
    - LC_ALL=en_US.UTF-8
    - GRADLE_OPTS=-Dorg.gradle.parallel=false
    - JAVA8_JDK=https://cdn.azul.com/zulu/bin/zulu8.40.0.25-ca-jdk8.0.222-linux_x64.tar.gz
    - JAVA11_JDK=https://cdn.azul.com/zulu/bin/zulu11.33.15-ca-jdk11.0.4-linux_x64.tar.gz
    - JAVA12_JDK=https://cdn.azul.com/zulu/bin/zulu12.3.11-ca-jdk12.0.2-linux_x64.tar.gz

matrix:
  include:
    - name: "OpenJDK8"
      env:
        - secure: JuFTmYTsnmzZzWTvf/hNkRDkpQhLrtl8BRLBdxGR79pzGxmoq961pgaYO615DFJUBggmZm1VkLSao3sC8eWfanTng9Qm1r1CUVsHbLiBDrIR2kwUU7DFiPOEkqwuf9YDjlTl1D4bRKwOZXPVMzlbwfWNr5yj2iRS8PSRS/76f3k=
    - name: "OpenJDK11"
      install:
        - "source install-jdk.sh --url $JAVA11_JDK"
    - name: "OpenJDK12"
      install:
        - "source install-jdk.sh --url $JAVA12_JDK"
    - name: "Local rebuild"
      script: 
        - "./gradlew --no-daemon -Dmaven.repo.local=maven/target/m2 :biz.aQute.bnd.gradle:build :biz.aQute.bnd.gradle:releaseNeeded"
        - "./gradlew --no-daemon -Dmaven.repo.local=maven/target/m2 -Pbnd_repourl=./dist/bundles :buildscriptDependencies :build"
    - name: "Documentation"
      install:
        - "ruby --version"
        - "gem update --system"
        - "gem --version"
        - "gem install bundler -v '~> 2.0'"
        - "bundle --version"
      before_script:
        - "cd docs"
      script: 
        - "./build.sh"
  allow_failures:
    - env: ALLOW_FAILURE=true

before_install:
  - "unset _JAVA_OPTIONS"
  - "curl -O -L --retry 3 https://github.com/sormuras/bach/raw/master/install-jdk.sh"

install:
  - "source install-jdk.sh --url $JAVA8_JDK"

before_script:
  - "./gradlew --no-daemon --version"
  - "./mvnw --version"

script:
  - "./gradlew --no-daemon -Dmaven.repo.local=maven/target/m2 --continue :build :maven:deploy"
