Merge "Improve hiddenapi exclude.sh script" am: b1becf7cfb am: 8637b71f39

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1660362

Change-Id: I4937f663c0da4414a482f1589df72cb5c5191316
This commit is contained in:
Paul Duffin
2021-04-07 16:36:00 +00:00
committed by Automerger Merge Worker

View File

@@ -7,11 +7,9 @@ LOCAL_DIR="$( dirname ${BASH_SOURCE} )"
# the team email to use in the event of this detecting an entry in a <team> package. Also # the team email to use in the event of this detecting an entry in a <team> package. Also
# add <team> to the TEAMS list. # add <team> to the TEAMS list.
LIBCORE_PACKAGES="\ LIBCORE_PACKAGES="\
android.icu \
android.system \ android.system \
android.test \ android.test \
com.android.bouncycastle \ com.android.bouncycastle \
com.android.conscrypt \
com.android.i18n.phonenumbers \ com.android.i18n.phonenumbers \
com.android.okhttp \ com.android.okhttp \
com.sun \ com.sun \
@@ -24,37 +22,54 @@ LIBCORE_PACKAGES="\
org.json \ org.json \
org.w3c.dom \ org.w3c.dom \
org.xml.sax \ org.xml.sax \
org.xmlpull.v1 \
sun \ sun \
" "
LIBCORE_EMAIL=libcore-team@android.com LIBCORE_EMAIL=libcore-team@android.com
I18N_PACKAGES="\
android.icu \
"
I18N_EMAIL=$LIBCORE_EMAIL
CONSCRYPT_PACKAGES="\
com.android.org.conscrypt \
"
CONSCRYPT_EMAIL=$LIBCORE_EMAIL
# List of teams. # List of teams.
TEAMS=LIBCORE TEAMS="LIBCORE I18N CONSCRYPT"
SHA=$1
# Generate the list of packages and convert to a regular expression. # Generate the list of packages and convert to a regular expression.
PACKAGES=$(for t in $TEAMS; do echo $(eval echo \${${t}_PACKAGES}); done) PACKAGES=$(for t in $TEAMS; do echo $(eval echo \${${t}_PACKAGES}); done)
RE=$(echo ${PACKAGES} | sed "s/ /|/g") RE=$(echo ${PACKAGES} | sed "s/ /|/g")
git show --name-only --pretty=format: $1 | grep "config/hiddenapi-.*txt" | while read file; do EXIT_CODE=0
ENTRIES=$(grep -E "^L(${RE})/" || true <(git show $1:$file)) for file in $(git show --name-only --pretty=format: $SHA | grep "config/hiddenapi-.*txt"); do
ENTRIES=$(grep -E "^\+L(${RE})/" <(git diff ${SHA}~1 ${SHA} $file) | sed "s|^\+||" || echo)
if [[ -n "${ENTRIES}" ]]; then if [[ -n "${ENTRIES}" ]]; then
echo -e "\e[1m\e[31m$file $1 contains the following entries\e[0m" echo -e "\e[1m\e[31m$file $SHA contains the following entries\e[0m"
echo -e "\e[1m\e[31mfor packages that are handled using UnsupportedAppUsage. Please remove\e[0m" echo -e "\e[1m\e[31mfor packages that are handled using UnsupportedAppUsage. Please remove\e[0m"
echo -e "\e[1m\e[31mthese entries and add annotations instead.\e[0m" echo -e "\e[1m\e[31mthese entries and add annotations instead.\e[0m"
# Partition the entries by team and provide contact details to aid in fixing the issue. # Partition the entries by team and provide contact details to aid in fixing the issue.
for t in ${TEAMS} for t in ${TEAMS}
do do
PACKAGES=$(eval echo \${${t}_PACKAGES}) PACKAGES=$(eval echo \${${t}_PACKAGES})
RE=$(echo ${PACKAGES} | sed "s/ /|/g") TEAM_RE=$(echo ${PACKAGES} | sed "s/ /|/g")
TEAM_ENTRIES=$(grep -E "^L(${RE})/" <(echo "${ENTRIES}")) TEAM_ENTRIES=$(grep -E "^L(${TEAM_RE})/" <(echo "${ENTRIES}") || echo)
if [[ -n "${TEAM_ENTRIES}" ]]; then if [[ -n "${TEAM_ENTRIES}" ]]; then
EMAIL=$(eval echo \${${t}_EMAIL}) EMAIL=$(eval echo \${${t}_EMAIL})
echo -e "\e[33mContact ${EMAIL} or compat- for help with the following:\e[0m" echo -e "\e[33mContact ${EMAIL} for help with the following:\e[0m"
for i in ${ENTRIES} for i in ${TEAM_ENTRIES}
do do
echo -e "\e[33m ${i}\e[0m" echo -e "\e[33m ${i}\e[0m"
done done
fi fi
done done
exit 1 EXIT_CODE=1
fi fi
done done
exit $EXIT_CODE