Michael Wright | c55d79b | 2024-04-23 17:20:13 +0000 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
Mårten Kongstad | 76460bd | 2024-04-18 16:11:48 +0200 | [diff] [blame] | 3 | # 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 Wright | c55d79b | 2024-04-23 17:20:13 +0000 | [diff] [blame] | 20 | source $(cd $(dirname $BASH_SOURCE) &> /dev/null && pwd)/../../shell_utils.sh |
| 21 | require_top |
| 22 | |
| 23 | function m() { |
| 24 | $(gettop)/build/soong/soong_ui.bash --build-mode --all-modules --dir="$(pwd)" "$@" |
| 25 | } |
| 26 | |
Mårten Kongstad | 76460bd | 2024-04-18 16:11:48 +0200 | [diff] [blame] | 27 | function 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 | |
Mårten Kongstad | b9ce4c9 | 2024-05-02 10:51:30 +0200 | [diff] [blame^] | 37 | function aninja() { |
| 38 | local T="$(gettop)" |
| 39 | (\cd "${T}" && prebuilts/build-tools/linux-x86/bin/ninja -f out/combined-${TARGET_PRODUCT}.ninja "$@") |
| 40 | } |
| 41 | |
| 42 | function path_to_api_signature_file { |
| 43 | aninja -t query device_"$1"_all_targets | grep -A1 -e input: | tail -n1 |
| 44 | } |
| 45 | |
Mårten Kongstad | 76460bd | 2024-04-18 16:11:48 +0200 | [diff] [blame] | 46 | function run() { |
| 47 | local errors=0 |
| 48 | |
| 49 | echo "# current" |
| 50 | check-flagged-apis \ |
Mårten Kongstad | b9ce4c9 | 2024-05-02 10:51:30 +0200 | [diff] [blame^] | 51 | --api-signature $(path_to_api_signature_file "frameworks-base-api-current.txt") \ |
Mårten Kongstad | 76460bd | 2024-04-18 16:11:48 +0200 | [diff] [blame] | 52 | --flag-values $(gettop)/out/soong/.intermediates/all_aconfig_declarations.pb \ |
| 53 | --api-versions $(gettop)/out/dist/data/api-versions.xml |
| 54 | (( errors += $? )) |
| 55 | |
| 56 | echo |
| 57 | echo "# system-current" |
| 58 | check-flagged-apis \ |
Mårten Kongstad | b9ce4c9 | 2024-05-02 10:51:30 +0200 | [diff] [blame^] | 59 | --api-signature $(path_to_api_signature_file "frameworks-base-api-system-current.txt") \ |
Mårten Kongstad | 76460bd | 2024-04-18 16:11:48 +0200 | [diff] [blame] | 60 | --flag-values $(gettop)/out/soong/.intermediates/all_aconfig_declarations.pb \ |
| 61 | --api-versions $(gettop)/out/dist/system-data/api-versions.xml |
| 62 | (( errors += $? )) |
| 63 | |
| 64 | echo |
| 65 | echo "# system-server-current" |
| 66 | check-flagged-apis \ |
Mårten Kongstad | b9ce4c9 | 2024-05-02 10:51:30 +0200 | [diff] [blame^] | 67 | --api-signature $(path_to_api_signature_file "frameworks-base-api-system-server-current.txt") \ |
Mårten Kongstad | 76460bd | 2024-04-18 16:11:48 +0200 | [diff] [blame] | 68 | --flag-values $(gettop)/out/soong/.intermediates/all_aconfig_declarations.pb \ |
| 69 | --api-versions $(gettop)/out/dist/system-server-data/api-versions.xml |
| 70 | (( errors += $? )) |
| 71 | |
| 72 | echo |
| 73 | echo "# module-lib" |
| 74 | check-flagged-apis \ |
Mårten Kongstad | b9ce4c9 | 2024-05-02 10:51:30 +0200 | [diff] [blame^] | 75 | --api-signature $(path_to_api_signature_file "frameworks-base-api-module-lib-current.txt") \ |
Mårten Kongstad | 76460bd | 2024-04-18 16:11:48 +0200 | [diff] [blame] | 76 | --flag-values $(gettop)/out/soong/.intermediates/all_aconfig_declarations.pb \ |
| 77 | --api-versions $(gettop)/out/dist/module-lib-data/api-versions.xml |
| 78 | (( errors += $? )) |
| 79 | |
| 80 | return $errors |
| 81 | } |
| 82 | |
| 83 | if [[ "$1" != "--skip-build" ]]; then |
| 84 | build && run |
| 85 | else |
| 86 | run |
| 87 | fi |