version: 2
defaults: &defaults
  working_directory: ~/repo
  environment:
    JVM_OPTS: -Xmx3200m
    TERM: dumb
    CI_NAME: "CircleCI"

defaults_gradle: &defaults_bld
  steps:
    - checkout
    - run:
        name: Download the bld dependencies
        command: ./bld download
    - run:
        name: Compile source with bld
        command: ./bld compile
    - run:
        name: Run tests with bld
        command: ./bld test

jobs:
  bld_jdk17:
    <<: *defaults

    docker:
      - image: cimg/openjdk:17.0

    <<: *defaults_bld

  bld_jdk20:
    <<: *defaults

    docker:
      - image: cimg/openjdk:20.0

    <<: *defaults_bld

workflows:
  version: 2
  bld:
    jobs:
      - bld_jdk17
      - bld_jdk20
