version: 0.2
#this build spec assumes the ubuntu aws/codebuild/java:openjdk-8 image
phases:
  install:
    runtime-versions:
      java: "corretto8"
    commands:
      - add-apt-repository ppa:openjdk-r/ppa
      - add-apt-repository ppa:ubuntu-toolchain-r/test
      - apt-get update -y
      - apt-get install gcc-7 cmake ninja-build -y
      - git submodule update --init --recursive
      - git clone https://github.com/aws/aws-sdk-java-v2.git
      # change the version from SDK to local SNAPSHOT version
      - sed -i 's/<awscrt.version>.*<\/awscrt.version>/<awscrt.version>1.0.0-SNAPSHOT<\/awscrt.version>/g' aws-sdk-java-v2/pom.xml
      # check if it works
      - cat aws-sdk-java-v2/pom.xml | grep -E '<awscrt.version>.*'
  pre_build:
    commands:
      - export CC=gcc-7
  build:
    commands:
      - echo Build started on `date`
      - mvn install -DskipTests
      - cd aws-sdk-java-v2/
      - mvn clean install -P crt-tests
  post_build:
    commands:
      - echo Build completed on `date`

artifacts:
  discard-paths: yes
  files:
    - "target/surefire-reports/**"
    - "hs_err_pid*"
    - "core*"
