1#!/usr/bin/env bash
2#
3# Updates the crypto support JSON data file by running the appropriate tools.
4
5# Ensure that the files we need are in the place we expect
6if [ ! -f libcore/tools/docs/crypto/src/java/libcore/java/security/ListProviders.java -o ! -f libcore/tools/docs/crypto/data/crypto_support.json ]; then
7  echo "This command must be run from the repo root."
8  exit 1
9fi
10
11if [ -z "$1" ]; then
12  echo "The current API level must be specified as an argument."
13  exit 1
14fi
15
16make -j48 vogar dx
17vogar --mode=activity --multidex=false libcore/tools/docs/crypto/src/java/libcore/java/security/ListProviders.java | libcore/tools/docs/crypto/update_crypto_support.py --api_level=$1 --rewrite_file libcore/tools/docs/crypto/data/crypto_support.json
18