Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1b216d84 authored by Mathew Inwood's avatar Mathew Inwood Committed by android-build-merger
Browse files

Merge "Add presubmit hook for hidden API lists." into pi-dev

am: 02033386

Change-Id: I6c437a6ffa62794f1fc88d0c8bcdcef798b68d8c
parents 4c161911 02033386
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -12,3 +12,5 @@ checkstyle_hook = ${REPO_ROOT}/prebuilts/checkstyle/checkstyle.py --sha ${PREUPL
api_lint_hook = ${REPO_ROOT}/frameworks/base/tools/apilint/apilint_sha.sh ${PREUPLOAD_COMMIT}

strings_lint_hook = ${REPO_ROOT}/frameworks/base/tools/stringslint/stringslint_sha.sh ${PREUPLOAD_COMMIT}

hidden_api_txt_hook = ${REPO_ROOT}/frameworks/base/tools/hiddenapi/checksorted_sha.sh ${PREUPLOAD_COMMIT} ${REPO_ROOT}
+541 −541

File changed.

Preview size limit exceeded, changes collapsed.

+78 −78

File changed.

Preview size limit exceeded, changes collapsed.

+10 −0
Original line number Diff line number Diff line
#!/bin/bash
set -e
LOCAL_DIR="$( dirname ${BASH_SOURCE} )"
git show --name-only --pretty=format: $1 | grep "config/hiddenapi-.*txt" | while read file; do
    diff <(git show $1:$file) <(git show $1:$file | $LOCAL_DIR/sort_api.sh )  || {
      echo -e "\e[1m\e[31m$file $1 is not sorted or contains duplicates. To sort it correctly:\e[0m"
      echo -e "\e[33m${LOCAL_DIR}/sort_api.sh $2/frameworks/base/$file\e[0m"
      exit 1
    }
done
+18 −0
Original line number Diff line number Diff line
#!/bin/bash
set -e
if [ -z "$1" ]; then
  source_list=/dev/stdin
  dest_list=/dev/stdout
else
  source_list="$1"
  dest_list="$1"
fi
# Load the file
readarray A < "$source_list"
# Sort
IFS=$'\n'
A=( $(LC_COLLATE=C sort -f <<< "${A[*]}") )
A=( $(uniq <<< "${A[*]}") )
unset IFS
# Dump array back into the file
printf '%s\n' "${A[@]}" > "$dest_list"