blob: cd37a2d52ea066dd302ae9616ef407564562b06a [file] [log] [blame]
Michael Wrightc55d79b2024-04-23 17:20:13 +00001#!/bin/bash
2
Mårten Kongstad76460bd2024-04-18 16:11:48 +02003# Copyright (C) 2024 The Android Open Source Project
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17# Run check-flagged-apis for public APIs and the three @SystemApi flavours
18# Usage: lunch <your-target> && source <this script>
19
Michael Wrightc55d79b2024-04-23 17:20:13 +000020source $(cd $(dirname $BASH_SOURCE) &> /dev/null && pwd)/../../shell_utils.sh
21require_top
22
23function m() {
24 $(gettop)/build/soong/soong_ui.bash --build-mode --all-modules --dir="$(pwd)" "$@"
25}
26
Mårten Kongstad76460bd2024-04-18 16:11:48 +020027function build() {
28 m sdk dist && m \
29 check-flagged-apis \
30 all_aconfig_declarations \
31 frameworks-base-api-current.txt \
32 frameworks-base-api-system-current.txt \
33 frameworks-base-api-system-server-current.txt \
34 frameworks-base-api-module-lib-current.txt
35}
36
37function run() {
38 local errors=0
39
40 echo "# current"
41 check-flagged-apis \
42 --api-signature $(gettop)/out/target/product/mainline_x86/obj/ETC/frameworks-base-api-current.txt_intermediates/frameworks-base-api-current.txt \
43 --flag-values $(gettop)/out/soong/.intermediates/all_aconfig_declarations.pb \
44 --api-versions $(gettop)/out/dist/data/api-versions.xml
45 (( errors += $? ))
46
47 echo
48 echo "# system-current"
49 check-flagged-apis \
50 --api-signature $(gettop)/out/target/product/mainline_x86/obj/ETC/frameworks-base-api-system-current.txt_intermediates/frameworks-base-api-system-current.txt \
51 --flag-values $(gettop)/out/soong/.intermediates/all_aconfig_declarations.pb \
52 --api-versions $(gettop)/out/dist/system-data/api-versions.xml
53 (( errors += $? ))
54
55 echo
56 echo "# system-server-current"
57 check-flagged-apis \
58 --api-signature $(gettop)/out/target/product/mainline_x86/obj/ETC/frameworks-base-api-system-server-current.txt_intermediates/frameworks-base-api-system-server-current.txt \
59 --flag-values $(gettop)/out/soong/.intermediates/all_aconfig_declarations.pb \
60 --api-versions $(gettop)/out/dist/system-server-data/api-versions.xml
61 (( errors += $? ))
62
63 echo
64 echo "# module-lib"
65 check-flagged-apis \
66 --api-signature $(gettop)/out/target/product/mainline_x86/obj/ETC/frameworks-base-api-module-lib-current.txt_intermediates/frameworks-base-api-module-lib-current.txt \
67 --flag-values $(gettop)/out/soong/.intermediates/all_aconfig_declarations.pb \
68 --api-versions $(gettop)/out/dist/module-lib-data/api-versions.xml
69 (( errors += $? ))
70
71 return $errors
72}
73
74if [[ "$1" != "--skip-build" ]]; then
75 build && run
76else
77 run
78fi