From 738f919418893e5720ef89bb454e9ca60eb934c4 Mon Sep 17 00:00:00 2001 From: Paul Duffin Date: Wed, 14 Apr 2021 13:36:53 +0100 Subject: [PATCH] Move hiddenapi sort preupload tools to tools/platform-compat Bug: 179354495 Test: try and upload changes to hiddenapi flag files Change-Id: Iedc21893bbc62adaaca4de353d022e77fc70ace2 --- PREUPLOAD.cfg | 2 +- tools/hiddenapi/checksorted_sha.sh | 10 ---------- tools/hiddenapi/sort_api.sh | 26 -------------------------- 3 files changed, 1 insertion(+), 37 deletions(-) delete mode 100755 tools/hiddenapi/checksorted_sha.sh delete mode 100755 tools/hiddenapi/sort_api.sh diff --git a/PREUPLOAD.cfg b/PREUPLOAD.cfg index 33fd39907ef4..f67174ac1e1a 100644 --- a/PREUPLOAD.cfg +++ b/PREUPLOAD.cfg @@ -17,7 +17,7 @@ checkstyle_hook = ${REPO_ROOT}/prebuilts/checkstyle/checkstyle.py --sha ${PREUPL strings_lint_hook = ${REPO_ROOT}/frameworks/base/tools/stringslint/stringslint_sha.sh ${PREUPLOAD_COMMIT} -hidden_api_txt_checksorted_hook = ${REPO_ROOT}/frameworks/base/tools/hiddenapi/checksorted_sha.sh ${PREUPLOAD_COMMIT} ${REPO_ROOT} +hidden_api_txt_checksorted_hook = ${REPO_ROOT}/tools/platform-compat/hiddenapi/checksorted_sha.sh ${PREUPLOAD_COMMIT} ${REPO_ROOT} hidden_api_txt_exclude_hook = ${REPO_ROOT}/frameworks/base/tools/hiddenapi/exclude.sh ${PREUPLOAD_COMMIT} ${REPO_ROOT} diff --git a/tools/hiddenapi/checksorted_sha.sh b/tools/hiddenapi/checksorted_sha.sh deleted file mode 100755 index 72fb86737488..000000000000 --- a/tools/hiddenapi/checksorted_sha.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -set -e -LOCAL_DIR="$( dirname ${BASH_SOURCE} )" -git show --name-only --pretty=format: $1 | grep "hiddenapi/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 $PWD/$file\e[0m" - exit 1 - } -done diff --git a/tools/hiddenapi/sort_api.sh b/tools/hiddenapi/sort_api.sh deleted file mode 100755 index 710da40585ac..000000000000 --- a/tools/hiddenapi/sort_api.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/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' -# Stash away comments -C=( $(grep -E '^#' <<< "${A[*]}" || :) ) -A=( $(grep -v -E '^#' <<< "${A[*]}" || :) ) -# Sort entries -A=( $(LC_COLLATE=C sort -f <<< "${A[*]}") ) -A=( $(uniq <<< "${A[*]}") ) -# Concatenate comments and entries -A=( ${C[*]} ${A[*]} ) -unset IFS -# Dump array back into the file -if [ ${#A[@]} -ne 0 ]; then - printf '%s\n' "${A[@]}" > "$dest_list" -fi