version: 2

general:
  branches:
    - master

jobs:
  build:
    docker:
      - image: circleci/openjdk:8-jdk
    
    working_directory: ~/repo

    environment:
      JVM_OPTS: -Xmx3200m
      TERM: dumb

    steps:
      - checkout

      - restore_cache:
          keys:
            - v1-dependencies-{{ checksum "build.gradle" }}
            - v1-dependencies-

      - run: sed -i 's/def buildmode = "IDE"/def buildmode = "RELEASE"/' build.gradle
      - run: ./gradlew clean
      - run: ./gradlew setupDecompWorkspace
      - run: ./gradlew build

      - store_artifacts:
          path: build/libs/

      - save_cache:
          paths:
            - ~/.gradle
          key: v1-dependencies-{{ checksum "build.gradle" }}
