---

machine:
  java:
    version: oraclejdk8
  environment:
    TERM: dumb
    GRADLE_OPTS: -Xmx3g

checkout:
  override:
    - git clone https://github.com/DMDirc/Meta.git $HOME/meta
    - git submodule update --init --remote:
        pwd:
          ../meta
    - git remote set-url origin https://github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME.git:
        pwd:
          ../meta/plugins
    - >
      cd ../meta/plugins;
      if [ -n "$CIRCLE_PR_NUMBER" ]; then
          git fetch origin pull/$CIRCLE_PR_NUMBER/head:circleci;
      else
          git fetch origin $CIRCLE_BRANCH:circleci;
      fi
    - git fetch --tags:
        pwd:
          ../meta/plugins
    - git checkout circleci:
        pwd:
          ../meta/plugins

dependencies:
  override:
    - ./gradlew --parallel client:dependencies plugins:dependencies:
        pwd:
          ../meta

test:
  override:
    - ./gradlew --stacktrace --parallel plugins:jar plugins:test:
        pwd:
          ../meta

general:
  artifacts:
    - ../meta/plugins/dist/
