summaryrefslogtreecommitdiffstats
path: root/support-api/import_api.sh
blob: 7b79535eb3a2bc3e8bf2ce868f7ce3beebdc0b5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash

if [ $# -ne 2 ]; then
  echo "Usage: $0 <path_to_frameworks_support> <support_version>"
  echo "  <path_to_frameworks_support>: Path to frameworks/support"
  echo "  <support_version>: Support version. This must match the API filenames exactly"
  echo 
  echo "  Example: import_api.sh ../../../frameworks/support 22.0.0"
  exit 1
fi

# Make sure we are in prebuilts/sdk/support-api
if [ $(realpath $(dirname $0)) != $(realpath $(pwd)) ]; then
  echo "The script must be run from $(dirname $0)."
  exit 1
fi

# Remove any existing file (if they exist)
if [ -e "$2.txt" ]; then
  rm "$2.txt"
fi

# Now create the concatentated API file
touch "$2.txt"

# Find all of the various API files and append them to our
# API file
find $1 -name "$2.txt" -exec cat {} >> "$2.txt" \;