blob: 2291e5a927303c371bbc6775e8bcfd162105773f [file] [log] [blame]
Paul Duffin00537c12018-11-28 12:22:14 +00001#!/bin/bash
2set -e
3# Make sure that entries are not added for packages that are already fully handled using
4# annotations.
5LOCAL_DIR="$( dirname ${BASH_SOURCE} )"
6# Each team should add a <team>_PACKAGES and <team>_EMAIL with the list of packages and
7# the team email to use in the event of this detecting an entry in a <team> package. Also
8# add <team> to the TEAMS list.
9LIBCORE_PACKAGES="\
10 android.icu \
11 android.system \
12 com.android.bouncycastle \
13 com.android.conscrypt \
14 com.android.okhttp \
15 com.sun \
16 dalvik \
17 java \
18 javax \
19 libcore \
20 org.apache.harmony \
21 org.json \
22 org.w3c.dom \
23 org.xml.sax \
24 sun \
25 "
26LIBCORE_EMAIL=libcore-team@android.com
27
28# List of teams.
29TEAMS=LIBCORE
30
31# Generate the list of packages and convert to a regular expression.
32PACKAGES=$(for t in $TEAMS; do echo $(eval echo \${${t}_PACKAGES}); done)
33RE=$(echo ${PACKAGES} | sed "s/ /|/g")
34git show --name-only --pretty=format: $1 | grep "config/hiddenapi-.*txt" | while read file; do
35 ENTRIES=$(grep -E "^L(${RE})/" <(git show $1:$file))
36 if [[ -n "${ENTRIES}" ]]; then
37 echo -e "\e[1m\e[31m$file $1 contains the following entries\e[0m"
38 echo -e "\e[1m\e[31mfor packages that are handled using UnsupportedAppUsage. Please remove\e[0m"
39 echo -e "\e[1m\e[31mthese entries and add annotations instead.\e[0m"
40 # Partition the entries by team and provide contact details to aid in fixing the issue.
41 for t in ${TEAMS}
42 do
43 PACKAGES=$(eval echo \${${t}_PACKAGES})
44 RE=$(echo ${PACKAGES} | sed "s/ /|/g")
45 TEAM_ENTRIES=$(grep -E "^L(${RE})/" <(echo "${ENTRIES}"))
46 if [[ -n "${TEAM_ENTRIES}" ]]; then
47 EMAIL=$(eval echo \${${t}_EMAIL})
48 echo -e "\e[33mContact ${EMAIL} or compat- for help with the following:\e[0m"
49 for i in ${ENTRIES}
50 do
51 echo -e "\e[33m ${i}\e[0m"
52 done
53 fi
54 done
55 exit 1
56 fi
57done