The path to the generated API signature files used with --api-signature in the check-flagged-apis.sh script are different based on the lunch target used: sometimes it's under $ANDROID_PRODUCT_OUT, other times under out/target/product/mainline_x86. Teach check-flagged-apis.sh to dynamically find the correct path by querying ninja. Bug: 334870672 Test: croot && build/tools/check-flagged-apis/check-flagged-apis.sh Change-Id: I1b0b41ef3ad1bc7113a3b31323d81251e7e65933
88 lines
2.9 KiB
Bash
Executable File
88 lines
2.9 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Copyright (C) 2024 The Android Open Source Project
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
# Run check-flagged-apis for public APIs and the three @SystemApi flavours
|
|
# Usage: lunch <your-target> && source <this script>
|
|
|
|
source $(cd $(dirname $BASH_SOURCE) &> /dev/null && pwd)/../../shell_utils.sh
|
|
require_top
|
|
|
|
function m() {
|
|
$(gettop)/build/soong/soong_ui.bash --build-mode --all-modules --dir="$(pwd)" "$@"
|
|
}
|
|
|
|
function build() {
|
|
m sdk dist && m \
|
|
check-flagged-apis \
|
|
all_aconfig_declarations \
|
|
frameworks-base-api-current.txt \
|
|
frameworks-base-api-system-current.txt \
|
|
frameworks-base-api-system-server-current.txt \
|
|
frameworks-base-api-module-lib-current.txt
|
|
}
|
|
|
|
function aninja() {
|
|
local T="$(gettop)"
|
|
(\cd "${T}" && prebuilts/build-tools/linux-x86/bin/ninja -f out/combined-${TARGET_PRODUCT}.ninja "$@")
|
|
}
|
|
|
|
function path_to_api_signature_file {
|
|
aninja -t query device_"$1"_all_targets | grep -A1 -e input: | tail -n1
|
|
}
|
|
|
|
function run() {
|
|
local errors=0
|
|
|
|
echo "# current"
|
|
check-flagged-apis \
|
|
--api-signature $(path_to_api_signature_file "frameworks-base-api-current.txt") \
|
|
--flag-values $(gettop)/out/soong/.intermediates/all_aconfig_declarations.pb \
|
|
--api-versions $(gettop)/out/dist/data/api-versions.xml
|
|
(( errors += $? ))
|
|
|
|
echo
|
|
echo "# system-current"
|
|
check-flagged-apis \
|
|
--api-signature $(path_to_api_signature_file "frameworks-base-api-system-current.txt") \
|
|
--flag-values $(gettop)/out/soong/.intermediates/all_aconfig_declarations.pb \
|
|
--api-versions $(gettop)/out/dist/system-data/api-versions.xml
|
|
(( errors += $? ))
|
|
|
|
echo
|
|
echo "# system-server-current"
|
|
check-flagged-apis \
|
|
--api-signature $(path_to_api_signature_file "frameworks-base-api-system-server-current.txt") \
|
|
--flag-values $(gettop)/out/soong/.intermediates/all_aconfig_declarations.pb \
|
|
--api-versions $(gettop)/out/dist/system-server-data/api-versions.xml
|
|
(( errors += $? ))
|
|
|
|
echo
|
|
echo "# module-lib"
|
|
check-flagged-apis \
|
|
--api-signature $(path_to_api_signature_file "frameworks-base-api-module-lib-current.txt") \
|
|
--flag-values $(gettop)/out/soong/.intermediates/all_aconfig_declarations.pb \
|
|
--api-versions $(gettop)/out/dist/module-lib-data/api-versions.xml
|
|
(( errors += $? ))
|
|
|
|
return $errors
|
|
}
|
|
|
|
if [[ "$1" != "--skip-build" ]]; then
|
|
build && run
|
|
else
|
|
run
|
|
fi
|