blob: 4ffcf6846947986bd98563dfbb6808c2f26ec6ea [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 \
Paul Duffin352956b2018-12-07 11:52:19 +000014 com.android.i18n.phonenumbers \
Paul Duffin00537c12018-11-28 12:22:14 +000015 com.android.okhttp \
16 com.sun \
17 dalvik \
18 java \
19 javax \
20 libcore \
21 org.apache.harmony \
22 org.json \
23 org.w3c.dom \
24 org.xml.sax \
25 sun \
26 "
27LIBCORE_EMAIL=libcore-team@android.com
28
29# List of teams.
30TEAMS=LIBCORE
31
32# Generate the list of packages and convert to a regular expression.
33PACKAGES=$(for t in $TEAMS; do echo $(eval echo \${${t}_PACKAGES}); done)
34RE=$(echo ${PACKAGES} | sed "s/ /|/g")
35git show --name-only --pretty=format: $1 | grep "config/hiddenapi-.*txt" | while read file; do
36 ENTRIES=$(grep -E "^L(${RE})/" <(git show $1:$file))
37 if [[ -n "${ENTRIES}" ]]; then
38 echo -e "\e[1m\e[31m$file $1 contains the following entries\e[0m"
39 echo -e "\e[1m\e[31mfor packages that are handled using UnsupportedAppUsage. Please remove\e[0m"
40 echo -e "\e[1m\e[31mthese entries and add annotations instead.\e[0m"
41 # Partition the entries by team and provide contact details to aid in fixing the issue.
42 for t in ${TEAMS}
43 do
44 PACKAGES=$(eval echo \${${t}_PACKAGES})
45 RE=$(echo ${PACKAGES} | sed "s/ /|/g")
46 TEAM_ENTRIES=$(grep -E "^L(${RE})/" <(echo "${ENTRIES}"))
47 if [[ -n "${TEAM_ENTRIES}" ]]; then
48 EMAIL=$(eval echo \${${t}_EMAIL})
49 echo -e "\e[33mContact ${EMAIL} or compat- for help with the following:\e[0m"
50 for i in ${ENTRIES}
51 do
52 echo -e "\e[33m ${i}\e[0m"
53 done
54 fi
55 done
56 exit 1
57 fi
58done