#!/usr/bin/env bash
set -euo pipefail

DEPOT_TOOLS_DIR="${DEPOT_TOOLS_DIR:-$HOME/depot_tools}"

if [[ ! -d "${DEPOT_TOOLS_DIR}/.git" ]]; then
  git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git "${DEPOT_TOOLS_DIR}"
fi

echo
echo "depot_tools ready: ${DEPOT_TOOLS_DIR}"
echo "Add to PATH in your shell profile:"
echo "  export PATH=\"${DEPOT_TOOLS_DIR}:\$PATH\""
