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