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