#!/bin/bash -e

script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $script_dir/../..

if [[ ! -d $ANDROID_TOOLCHAIN ]] ; then
    echo "error: android toolchain not present in $ANDROID_TOOLCHAIN"
    exit 1
fi

if [[ $TRAVIS_EVENT_TYPE == 'cron' ]] ; then
    scripts/live-ci-tools/nightly-checkout.py \
        --needy=needy/scripts/needy \
        --needy-args='-t android' \
        jshackle
fi

./scripts/build --target=android --install
