Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 1 | // Copyright (C) 2019 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 | // How stubs are generated: |
| 16 | // |
| 17 | // raw source files --(metalava)--> stub source files --(javac)--> stub jar files |
| 18 | // |
| 19 | // The metalava conversion is done by droidstub modules *-api-stubs-docs. |
| 20 | // The javac compilation is done by java_library modules android_*_stubs_current. |
| 21 | // The metalava conversion is also responsible for creating API signature files |
| 22 | // and comparing them against the last API signature in api/*-current.txt files |
| 23 | // and also against the latest frozen API signature in prebuilts/sdk/*/*/api/android.txt |
| 24 | // files. |
| 25 | |
| 26 | ///////////////////////////////////////////////////////////////////// |
| 27 | // Common metalava configs |
| 28 | ///////////////////////////////////////////////////////////////////// |
| 29 | |
| 30 | packages_to_document = [ |
| 31 | "android", |
| 32 | "dalvik", |
| 33 | "java", |
| 34 | "javax", |
| 35 | "junit", |
| 36 | "org.apache.http", |
| 37 | "org.json", |
| 38 | "org.w3c.dom", |
| 39 | "org.xml.sax", |
| 40 | "org.xmlpull", |
| 41 | ] |
| 42 | |
| 43 | stubs_defaults { |
Anton Hansson | 822cdb3 | 2020-03-06 17:16:06 +0000 | [diff] [blame] | 44 | name: "metalava-base-api-stubs-default", |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 45 | srcs: [ |
| 46 | ":framework-non-updatable-sources", |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 47 | "core/java/**/*.logtags", |
| 48 | ":opt-telephony-srcs", |
| 49 | ":opt-net-voip-srcs", |
| 50 | ":core-current-stubs-source", |
| 51 | ":core_public_api_files", |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 52 | ], |
Chen Xu | 546ce5e | 2020-01-10 08:38:31 -0800 | [diff] [blame] | 53 | // TODO(b/147699819): remove below aidl includes. |
| 54 | aidl: { |
| 55 | local_include_dirs: ["telephony/java"], |
| 56 | }, |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 57 | libs: ["framework-internal-utils"], |
| 58 | installable: false, |
| 59 | annotations_enabled: true, |
| 60 | previous_api: ":last-released-public-api", |
| 61 | merge_annotations_dirs: [ |
| 62 | "metalava-manual", |
| 63 | ], |
Aurimas Liutikas | 6bb95ad | 2020-03-12 17:06:12 -0700 | [diff] [blame] | 64 | api_levels_annotations_enabled: false, |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 65 | filter_packages: packages_to_document, |
| 66 | } |
| 67 | |
Jiyong Park | e309516 | 2019-12-20 15:30:28 +0900 | [diff] [blame] | 68 | stubs_defaults { |
Anton Hansson | 822cdb3 | 2020-03-06 17:16:06 +0000 | [diff] [blame] | 69 | name: "metalava-full-api-stubs-default", |
| 70 | defaults: ["metalava-base-api-stubs-default"], |
Jiyong Park | e309516 | 2019-12-20 15:30:28 +0900 | [diff] [blame] | 71 | srcs: [":framework-updatable-sources"], |
| 72 | sdk_version: "core_platform", |
| 73 | } |
| 74 | |
Anton Hansson | 822cdb3 | 2020-03-06 17:16:06 +0000 | [diff] [blame] | 75 | stubs_defaults { |
| 76 | name: "metalava-non-updatable-api-stubs-default", |
| 77 | defaults: ["metalava-base-api-stubs-default"], |
Anton Hansson | 92d79fd | 2020-03-20 09:12:52 +0000 | [diff] [blame] | 78 | sdk_version: "core_platform", |
| 79 | libs: ["framework-all"], |
| 80 | aidl: { |
| 81 | local_include_dirs: ["apex/media/framework/java"], |
| 82 | }, |
Anton Hansson | 822cdb3 | 2020-03-06 17:16:06 +0000 | [diff] [blame] | 83 | } |
| 84 | |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 85 | ///////////////////////////////////////////////////////////////////// |
| 86 | // *-api-stubs-docs modules providing source files for the stub libraries |
| 87 | ///////////////////////////////////////////////////////////////////// |
| 88 | |
Jiyong Park | e309516 | 2019-12-20 15:30:28 +0900 | [diff] [blame] | 89 | // api-stubs-docs, system-api-stubs-docs, and test-api-stubs-docs have APIs |
| 90 | // from the non-updatable part of the platform as well as from the updatable |
| 91 | // modules |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 92 | droidstubs { |
| 93 | name: "api-stubs-docs", |
Anton Hansson | 822cdb3 | 2020-03-06 17:16:06 +0000 | [diff] [blame] | 94 | defaults: ["metalava-full-api-stubs-default"], |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 95 | api_filename: "public_api.txt", |
| 96 | private_api_filename: "private.txt", |
| 97 | removed_api_filename: "removed.txt", |
Artur Satayev | 7e7fdde | 2020-03-25 16:45:56 +0000 | [diff] [blame] | 98 | removed_dex_api_filename: "removed-dex.txt", |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 99 | arg_files: [ |
| 100 | "core/res/AndroidManifest.xml", |
| 101 | ], |
| 102 | args: metalava_framework_docs_args, |
| 103 | check_api: { |
| 104 | current: { |
| 105 | api_file: "api/current.txt", |
| 106 | removed_api_file: "api/removed.txt", |
| 107 | }, |
| 108 | last_released: { |
| 109 | api_file: ":last-released-public-api", |
| 110 | removed_api_file: "api/removed.txt", |
| 111 | baseline_file: ":public-api-incompatibilities-with-last-released", |
| 112 | }, |
| 113 | api_lint: { |
| 114 | enabled: true, |
| 115 | new_since: ":last-released-public-api", |
| 116 | baseline_file: "api/lint-baseline.txt", |
| 117 | }, |
| 118 | }, |
Anton Hansson | d9a3fee | 2020-03-23 18:08:55 +0000 | [diff] [blame] | 119 | dist: { |
| 120 | targets: ["sdk", "win_sdk"], |
| 121 | dir: "apistubs/android/public/api", |
| 122 | dest: "android.txt", |
| 123 | }, |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 124 | jdiff_enabled: true, |
| 125 | } |
| 126 | |
Anton Hansson | 81969c2 | 2020-02-03 20:45:56 +0000 | [diff] [blame] | 127 | priv_apps = " " + |
| 128 | "--show-annotation android.annotation.SystemApi\\(" + |
| 129 | "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" + |
| 130 | "\\) " |
| 131 | |
| 132 | module_libs = " " + |
| 133 | " --show-annotation android.annotation.SystemApi\\(" + |
| 134 | "client=android.annotation.SystemApi.Client.MODULE_LIBRARIES" + |
| 135 | "\\) " |
| 136 | |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 137 | droidstubs { |
| 138 | name: "system-api-stubs-docs", |
Anton Hansson | 822cdb3 | 2020-03-06 17:16:06 +0000 | [diff] [blame] | 139 | defaults: ["metalava-full-api-stubs-default"], |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 140 | api_tag_name: "SYSTEM", |
| 141 | api_filename: "system-api.txt", |
| 142 | private_api_filename: "system-private.txt", |
| 143 | private_dex_api_filename: "system-private-dex.txt", |
| 144 | removed_api_filename: "system-removed.txt", |
Artur Satayev | 7e7fdde | 2020-03-25 16:45:56 +0000 | [diff] [blame] | 145 | removed_dex_api_filename: "system-removed-dex.txt", |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 146 | arg_files: [ |
| 147 | "core/res/AndroidManifest.xml", |
| 148 | ], |
Anton Hansson | 81969c2 | 2020-02-03 20:45:56 +0000 | [diff] [blame] | 149 | args: metalava_framework_docs_args + priv_apps, |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 150 | check_api: { |
| 151 | current: { |
| 152 | api_file: "api/system-current.txt", |
| 153 | removed_api_file: "api/system-removed.txt", |
| 154 | }, |
| 155 | last_released: { |
| 156 | api_file: ":last-released-system-api", |
| 157 | removed_api_file: "api/system-removed.txt", |
| 158 | baseline_file: ":system-api-incompatibilities-with-last-released" |
| 159 | }, |
| 160 | api_lint: { |
| 161 | enabled: true, |
| 162 | new_since: ":last-released-system-api", |
| 163 | baseline_file: "api/system-lint-baseline.txt", |
| 164 | }, |
| 165 | }, |
Anton Hansson | d9a3fee | 2020-03-23 18:08:55 +0000 | [diff] [blame] | 166 | dist: { |
| 167 | targets: ["sdk", "win_sdk"], |
| 168 | dir: "apistubs/android/system/api", |
| 169 | dest: "android.txt", |
| 170 | }, |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 171 | jdiff_enabled: true, |
| 172 | } |
| 173 | |
| 174 | droidstubs { |
| 175 | name: "test-api-stubs-docs", |
Anton Hansson | 822cdb3 | 2020-03-06 17:16:06 +0000 | [diff] [blame] | 176 | defaults: ["metalava-full-api-stubs-default"], |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 177 | api_tag_name: "TEST", |
| 178 | api_filename: "test-api.txt", |
| 179 | removed_api_filename: "test-removed.txt", |
| 180 | arg_files: [ |
| 181 | "core/res/AndroidManifest.xml", |
| 182 | ], |
| 183 | args: metalava_framework_docs_args + " --show-annotation android.annotation.TestApi", |
| 184 | check_api: { |
| 185 | current: { |
| 186 | api_file: "api/test-current.txt", |
| 187 | removed_api_file: "api/test-removed.txt", |
| 188 | }, |
| 189 | api_lint: { |
| 190 | enabled: true, |
| 191 | baseline_file: "api/test-lint-baseline.txt", |
| 192 | }, |
| 193 | }, |
Anton Hansson | d9a3fee | 2020-03-23 18:08:55 +0000 | [diff] [blame] | 194 | dist: { |
| 195 | targets: ["sdk", "win_sdk"], |
| 196 | dir: "apistubs/android/test/api", |
| 197 | dest: "android.txt", |
| 198 | }, |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 199 | } |
| 200 | |
| 201 | ///////////////////////////////////////////////////////////////////// |
Jiyong Park | e309516 | 2019-12-20 15:30:28 +0900 | [diff] [blame] | 202 | // Following droidstubs modules are for extra APIs for modules. |
| 203 | // The framework currently have two more API surfaces for modules: |
| 204 | // @SystemApi(client=MODULE_APPS) and @SystemApi(client=MODULE_LIBRARIES) |
| 205 | ///////////////////////////////////////////////////////////////////// |
| 206 | |
Anton Hansson | 81969c2 | 2020-02-03 20:45:56 +0000 | [diff] [blame] | 207 | // TODO(b/146727827) remove the *-api module when we can teach metalava |
Jiyong Park | e309516 | 2019-12-20 15:30:28 +0900 | [diff] [blame] | 208 | // about the relationship among the API surfaces. Currently, these modules are only to generate |
| 209 | // the API signature files and ensure that the APIs evolve in a backwards compatible manner. |
| 210 | // They however are NOT used for building the API stub. |
Jiyong Park | e309516 | 2019-12-20 15:30:28 +0900 | [diff] [blame] | 211 | |
| 212 | droidstubs { |
| 213 | name: "module-lib-api", |
Anton Hansson | 822cdb3 | 2020-03-06 17:16:06 +0000 | [diff] [blame] | 214 | defaults: ["metalava-full-api-stubs-default"], |
Anton Hansson | 7b0414b | 2020-03-19 15:09:44 +0000 | [diff] [blame] | 215 | api_tag_name: "MODULE_LIB", |
Jiyong Park | e309516 | 2019-12-20 15:30:28 +0900 | [diff] [blame] | 216 | arg_files: ["core/res/AndroidManifest.xml"], |
Anton Hansson | 81969c2 | 2020-02-03 20:45:56 +0000 | [diff] [blame] | 217 | args: metalava_framework_docs_args + module_libs, |
Jiyong Park | e309516 | 2019-12-20 15:30:28 +0900 | [diff] [blame] | 218 | check_api: { |
| 219 | current: { |
| 220 | api_file: "api/module-lib-current.txt", |
| 221 | removed_api_file: "api/module-lib-removed.txt", |
| 222 | }, |
Anton Hansson | 79e35c3 | 2020-02-11 14:36:40 +0000 | [diff] [blame] | 223 | last_released: { |
| 224 | api_file: ":last-released-module-lib-api", |
| 225 | removed_api_file: "api/module-lib-removed.txt", |
| 226 | baseline_file: ":module-lib-api-incompatibilities-with-last-released" |
| 227 | }, |
| 228 | api_lint: { |
| 229 | enabled: true, |
| 230 | new_since: ":last-released-module-lib-api", |
| 231 | baseline_file: "api/module-lib-lint-baseline.txt", |
| 232 | }, |
Jiyong Park | e309516 | 2019-12-20 15:30:28 +0900 | [diff] [blame] | 233 | }, |
Anton Hansson | d9a3fee | 2020-03-23 18:08:55 +0000 | [diff] [blame] | 234 | dist: { |
| 235 | targets: ["sdk", "win_sdk"], |
| 236 | dir: "apistubs/android/module-lib/api", |
| 237 | dest: "android.txt", |
| 238 | }, |
Jiyong Park | e309516 | 2019-12-20 15:30:28 +0900 | [diff] [blame] | 239 | } |
| 240 | |
Anton Hansson | 81969c2 | 2020-02-03 20:45:56 +0000 | [diff] [blame] | 241 | |
| 242 | // The following droidstub module generates source files for the API stub library for |
| 243 | // modules. Note that it not only includes its own APIs but also other APIs that have |
| 244 | // narrower scope (all @SystemApis, not just the ones with 'client=MODULE_LIBRARIES'). |
Jiyong Park | e309516 | 2019-12-20 15:30:28 +0900 | [diff] [blame] | 245 | |
| 246 | droidstubs { |
| 247 | name: "module-lib-api-stubs-docs", |
Anton Hansson | 822cdb3 | 2020-03-06 17:16:06 +0000 | [diff] [blame] | 248 | defaults: ["metalava-non-updatable-api-stubs-default"], |
Jiyong Park | e309516 | 2019-12-20 15:30:28 +0900 | [diff] [blame] | 249 | arg_files: ["core/res/AndroidManifest.xml"], |
Anton Hansson | 81969c2 | 2020-02-03 20:45:56 +0000 | [diff] [blame] | 250 | args: metalava_framework_docs_args + priv_apps + module_libs, |
Jiyong Park | e309516 | 2019-12-20 15:30:28 +0900 | [diff] [blame] | 251 | } |
| 252 | |
| 253 | ///////////////////////////////////////////////////////////////////// |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 254 | // android_*_stubs_current modules are the stubs libraries compiled |
| 255 | // from *-api-stubs-docs |
| 256 | ///////////////////////////////////////////////////////////////////// |
| 257 | |
| 258 | java_defaults { |
Anton Hansson | 87c7d28 | 2020-04-09 14:16:37 +0100 | [diff] [blame] | 259 | name: "android_defaults_stubs_current", |
Anton Hansson | 08b48bb | 2020-02-08 20:43:19 +0000 | [diff] [blame] | 260 | libs: [ "stub-annotations" ], |
| 261 | static_libs: [ "private-stub-annotations-jar" ], |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 262 | errorprone: { |
| 263 | javacflags: [ |
| 264 | "-XepDisableAllChecks", |
| 265 | ], |
| 266 | }, |
Anton Hansson | 87c7d28 | 2020-04-09 14:16:37 +0100 | [diff] [blame] | 267 | java_resources: [":notices-for-framework-stubs"], |
| 268 | sdk_version: "none", |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 269 | system_modules: "none", |
| 270 | java_version: "1.8", |
| 271 | compile_dex: true, |
| 272 | } |
| 273 | |
| 274 | java_library_static { |
| 275 | name: "android_stubs_current", |
Anton Hansson | 08b48bb | 2020-02-08 20:43:19 +0000 | [diff] [blame] | 276 | srcs: [ ":api-stubs-docs" ], |
Anton Hansson | 87c7d28 | 2020-04-09 14:16:37 +0100 | [diff] [blame] | 277 | defaults: ["android_defaults_stubs_current"], |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 278 | } |
| 279 | |
| 280 | java_library_static { |
| 281 | name: "android_system_stubs_current", |
Anton Hansson | 08b48bb | 2020-02-08 20:43:19 +0000 | [diff] [blame] | 282 | srcs: [ ":system-api-stubs-docs" ], |
Anton Hansson | 87c7d28 | 2020-04-09 14:16:37 +0100 | [diff] [blame] | 283 | defaults: ["android_defaults_stubs_current"], |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 284 | } |
| 285 | |
| 286 | java_library_static { |
| 287 | name: "android_test_stubs_current", |
Anton Hansson | 08b48bb | 2020-02-08 20:43:19 +0000 | [diff] [blame] | 288 | srcs: [ ":test-api-stubs-docs" ], |
Anton Hansson | 87c7d28 | 2020-04-09 14:16:37 +0100 | [diff] [blame] | 289 | defaults: ["android_defaults_stubs_current"], |
Jiyong Park | e309516 | 2019-12-20 15:30:28 +0900 | [diff] [blame] | 290 | } |
| 291 | |
| 292 | java_library_static { |
Anton Hansson | 1b9cf09 | 2020-01-30 12:09:02 +0000 | [diff] [blame] | 293 | name: "android_module_lib_stubs_current", |
Anton Hansson | 08b48bb | 2020-02-08 20:43:19 +0000 | [diff] [blame] | 294 | srcs: [ ":module-lib-api-stubs-docs" ], |
Anton Hansson | 87c7d28 | 2020-04-09 14:16:37 +0100 | [diff] [blame] | 295 | defaults: ["android_defaults_stubs_current"], |
Anton Hansson | 822cdb3 | 2020-03-06 17:16:06 +0000 | [diff] [blame] | 296 | libs: ["android_system_stubs_current"], |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 297 | } |
| 298 | |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 299 | ///////////////////////////////////////////////////////////////////// |
| 300 | // hwbinder.stubs provides APIs required for building HIDL Java |
| 301 | // libraries. |
| 302 | ///////////////////////////////////////////////////////////////////// |
| 303 | |
| 304 | droidstubs { |
| 305 | name: "hwbinder-stubs-docs", |
| 306 | srcs: [ |
| 307 | "core/java/android/os/HidlSupport.java", |
| 308 | "core/java/android/annotation/IntDef.java", |
| 309 | "core/java/android/annotation/IntRange.java", |
| 310 | "core/java/android/annotation/NonNull.java", |
| 311 | "core/java/android/annotation/SystemApi.java", |
| 312 | "core/java/android/os/HidlMemory.java", |
| 313 | "core/java/android/os/HwBinder.java", |
| 314 | "core/java/android/os/HwBlob.java", |
| 315 | "core/java/android/os/HwParcel.java", |
| 316 | "core/java/android/os/IHwBinder.java", |
| 317 | "core/java/android/os/IHwInterface.java", |
| 318 | "core/java/android/os/DeadObjectException.java", |
| 319 | "core/java/android/os/DeadSystemException.java", |
| 320 | "core/java/android/os/NativeHandle.java", |
| 321 | "core/java/android/os/RemoteException.java", |
| 322 | "core/java/android/util/AndroidException.java", |
| 323 | ], |
| 324 | installable: false, |
| 325 | sdk_version: "core_platform", |
| 326 | annotations_enabled: true, |
| 327 | previous_api: ":last-released-public-api", |
| 328 | merge_annotations_dirs: [ |
| 329 | "metalava-manual", |
| 330 | ], |
Anton Hansson | 81969c2 | 2020-02-03 20:45:56 +0000 | [diff] [blame] | 331 | args: priv_apps, |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 332 | } |
| 333 | |
| 334 | java_library_static { |
| 335 | name: "hwbinder.stubs", |
| 336 | sdk_version: "core_current", |
| 337 | srcs: [ |
| 338 | ":hwbinder-stubs-docs", |
| 339 | ], |
| 340 | } |
| 341 | |
| 342 | ///////////////////////////////////////////////////////////////////// |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 343 | // api/*-current.txt files for use by modules in other directories |
| 344 | // like the CTS test |
| 345 | ///////////////////////////////////////////////////////////////////// |
| 346 | |
| 347 | filegroup { |
| 348 | name: "frameworks-base-api-current.txt", |
| 349 | srcs: [ |
| 350 | "api/current.txt", |
| 351 | ], |
| 352 | } |
| 353 | |
| 354 | filegroup { |
| 355 | name: "frameworks-base-api-system-current.txt", |
| 356 | srcs: [ |
| 357 | "api/system-current.txt", |
| 358 | ], |
| 359 | } |
| 360 | |
| 361 | filegroup { |
| 362 | name: "frameworks-base-api-system-removed.txt", |
| 363 | srcs: [ |
| 364 | "api/system-removed.txt", |
| 365 | ], |
| 366 | } |