machine:
  environment:
    ANDROID_BUILD_TOOLS: 24.0.1
    ANDROID_PLATFORM: 24

dependencies:
  pre:
    - if [ ! -e $ANDROID_HOME/build-tools/$ANDROID_BUILD_TOOLS ]; then echo y | android update sdk --no-ui --all --filter build-tools-$ANDROID_BUILD_TOOLS; fi
    - if [ ! -e $ANDROID_HOME/platforms/android-$ANDROID_PLATFORM ]; then echo y | android update sdk --no-ui --all --filter "android-$ANDROID_PLATFORM"; fi

  cache_directories:
    - "${ANDROID_HOME}/build-tools/${ANDROID_BUILD_TOOLS}"
    - "${ANDROID_HOME}/platforms/android-${ANDROID_PLATFORM}"
    - "${ANDROID_HOME}/tools}"

test:
  override:
    - ./gradlew lint test assembleDebug countDebugDexMethods -PdisablePreDex
    - scripts/remoteTesting.sh

  post:
    - mkdir $CIRCLE_TEST_REPORTS/dexcount
    - cp -r app/build/outputs/dexcount/debugChart/* $CIRCLE_TEST_REPORTS/dexcount
    - mkdir $CIRCLE_TEST_REPORTS/lint
    - cp app/build/outputs/lint-results-debug.html $CIRCLE_TEST_REPORTS/lint
    - mkdir $CIRCLE_TEST_REPORTS/spoon
    - cp -r app/build/spoon/debug $CIRCLE_TEST_REPORTS/spoon

machine:
  environment:
    ANDROID_BUILD_TOOLS: 24.0.1
    ANDROID_PLATFORM: 24
    
machine:
  post:
    - cp -r $ANDROID_HOME $HOME/android_sdk

dependencies:
  pre:
    - if [ ! -e $ANDROID_HOME/build-tools/$ANDROID_BUILD_TOOLS ]; then echo y | android update sdk --no-ui --all --filter build-tools-$ANDROID_BUILD_TOOLS; fi
    - if [ ! -e $ANDROID_HOME/platforms/android-$ANDROID_PLATFORM ]; then echo y | android update sdk --no-ui --all --filter "android-$ANDROID_PLATFORM"; fi

  cache_directories:
    - "~/android_sdk/build-tools/${ANDROID_BUILD_TOOLS}"
    - "~/android_sdk/platforms/android-${ANDROID_PLATFORM}"
    - "~/android_sdk/tools"
  
  post:
    - cp -r $HOME/android_sdk $ANDROID_HOME

test:
  override:
    - ./gradlew lint test assembleDebug countDebugDexMethods -PdisablePreDex
    - scripts/remoteTesting.sh

  post:
    - mkdir $CIRCLE_TEST_REPORTS/dexcount
    - cp -r app/build/outputs/dexcount/debugChart/* $CIRCLE_TEST_REPORTS/dexcount
    - mkdir $CIRCLE_TEST_REPORTS/lint
    - cp app/build/outputs/lint-results-debug.html $CIRCLE_TEST_REPORTS/lint
    - mkdir $CIRCLE_TEST_REPORTS/spoon
    - cp -r app/build/spoon/debug $CIRCLE_TEST_REPORTS/spoon

Correct caching of android tools
Correct caching of android tools
