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 { |
Jiyong Park | e309516 | 2019-12-20 15:30:28 +0900 | [diff] [blame] | 44 | name: "metalava-non-updatable-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", |
| 52 | ":ike-api-srcs", |
| 53 | ], |
Chen Xu | 546ce5e | 2020-01-10 08:38:31 -0800 | [diff] [blame] | 54 | // TODO(b/147699819): remove below aidl includes. |
| 55 | aidl: { |
| 56 | local_include_dirs: ["telephony/java"], |
| 57 | }, |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 58 | libs: ["framework-internal-utils"], |
| 59 | installable: false, |
| 60 | annotations_enabled: true, |
| 61 | previous_api: ":last-released-public-api", |
| 62 | merge_annotations_dirs: [ |
| 63 | "metalava-manual", |
| 64 | ], |
| 65 | api_levels_annotations_enabled: true, |
| 66 | api_levels_annotations_dirs: [ |
| 67 | "sdk-dir", |
| 68 | "api-versions-jars-dir", |
| 69 | ], |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 70 | filter_packages: packages_to_document, |
| 71 | } |
| 72 | |
Jiyong Park | e309516 | 2019-12-20 15:30:28 +0900 | [diff] [blame] | 73 | stubs_defaults { |
| 74 | name: "metalava-api-stubs-default", |
| 75 | defaults: ["metalava-non-updatable-api-stubs-default"], |
| 76 | srcs: [":framework-updatable-sources"], |
| 77 | sdk_version: "core_platform", |
| 78 | } |
| 79 | |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 80 | ///////////////////////////////////////////////////////////////////// |
| 81 | // *-api-stubs-docs modules providing source files for the stub libraries |
| 82 | ///////////////////////////////////////////////////////////////////// |
| 83 | |
Jiyong Park | e309516 | 2019-12-20 15:30:28 +0900 | [diff] [blame] | 84 | // api-stubs-docs, system-api-stubs-docs, and test-api-stubs-docs have APIs |
| 85 | // from the non-updatable part of the platform as well as from the updatable |
| 86 | // modules |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 87 | droidstubs { |
| 88 | name: "api-stubs-docs", |
| 89 | defaults: ["metalava-api-stubs-default"], |
| 90 | api_filename: "public_api.txt", |
| 91 | private_api_filename: "private.txt", |
| 92 | removed_api_filename: "removed.txt", |
| 93 | arg_files: [ |
| 94 | "core/res/AndroidManifest.xml", |
| 95 | ], |
| 96 | args: metalava_framework_docs_args, |
| 97 | check_api: { |
| 98 | current: { |
| 99 | api_file: "api/current.txt", |
| 100 | removed_api_file: "api/removed.txt", |
| 101 | }, |
| 102 | last_released: { |
| 103 | api_file: ":last-released-public-api", |
| 104 | removed_api_file: "api/removed.txt", |
| 105 | baseline_file: ":public-api-incompatibilities-with-last-released", |
| 106 | }, |
| 107 | api_lint: { |
| 108 | enabled: true, |
| 109 | new_since: ":last-released-public-api", |
| 110 | baseline_file: "api/lint-baseline.txt", |
| 111 | }, |
| 112 | }, |
| 113 | jdiff_enabled: true, |
| 114 | } |
| 115 | |
Anton Hansson | 81969c2 | 2020-02-03 20:45:56 +0000 | [diff] [blame] | 116 | priv_apps = " " + |
| 117 | "--show-annotation android.annotation.SystemApi\\(" + |
| 118 | "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" + |
| 119 | "\\) " |
| 120 | |
| 121 | module_libs = " " + |
| 122 | " --show-annotation android.annotation.SystemApi\\(" + |
| 123 | "client=android.annotation.SystemApi.Client.MODULE_LIBRARIES" + |
| 124 | "\\) " |
| 125 | |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 126 | droidstubs { |
| 127 | name: "system-api-stubs-docs", |
| 128 | defaults: ["metalava-api-stubs-default"], |
| 129 | api_tag_name: "SYSTEM", |
| 130 | api_filename: "system-api.txt", |
| 131 | private_api_filename: "system-private.txt", |
| 132 | private_dex_api_filename: "system-private-dex.txt", |
| 133 | removed_api_filename: "system-removed.txt", |
| 134 | arg_files: [ |
| 135 | "core/res/AndroidManifest.xml", |
| 136 | ], |
Anton Hansson | 81969c2 | 2020-02-03 20:45:56 +0000 | [diff] [blame] | 137 | args: metalava_framework_docs_args + priv_apps, |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 138 | check_api: { |
| 139 | current: { |
| 140 | api_file: "api/system-current.txt", |
| 141 | removed_api_file: "api/system-removed.txt", |
| 142 | }, |
| 143 | last_released: { |
| 144 | api_file: ":last-released-system-api", |
| 145 | removed_api_file: "api/system-removed.txt", |
| 146 | baseline_file: ":system-api-incompatibilities-with-last-released" |
| 147 | }, |
| 148 | api_lint: { |
| 149 | enabled: true, |
| 150 | new_since: ":last-released-system-api", |
| 151 | baseline_file: "api/system-lint-baseline.txt", |
| 152 | }, |
| 153 | }, |
| 154 | jdiff_enabled: true, |
| 155 | } |
| 156 | |
| 157 | droidstubs { |
| 158 | name: "test-api-stubs-docs", |
| 159 | defaults: ["metalava-api-stubs-default"], |
| 160 | api_tag_name: "TEST", |
| 161 | api_filename: "test-api.txt", |
| 162 | removed_api_filename: "test-removed.txt", |
| 163 | arg_files: [ |
| 164 | "core/res/AndroidManifest.xml", |
| 165 | ], |
| 166 | args: metalava_framework_docs_args + " --show-annotation android.annotation.TestApi", |
| 167 | check_api: { |
| 168 | current: { |
| 169 | api_file: "api/test-current.txt", |
| 170 | removed_api_file: "api/test-removed.txt", |
| 171 | }, |
| 172 | api_lint: { |
| 173 | enabled: true, |
| 174 | baseline_file: "api/test-lint-baseline.txt", |
| 175 | }, |
| 176 | }, |
| 177 | } |
| 178 | |
| 179 | ///////////////////////////////////////////////////////////////////// |
Jiyong Park | e309516 | 2019-12-20 15:30:28 +0900 | [diff] [blame] | 180 | // Following droidstubs modules are for extra APIs for modules. |
| 181 | // The framework currently have two more API surfaces for modules: |
| 182 | // @SystemApi(client=MODULE_APPS) and @SystemApi(client=MODULE_LIBRARIES) |
| 183 | ///////////////////////////////////////////////////////////////////// |
| 184 | |
Anton Hansson | 81969c2 | 2020-02-03 20:45:56 +0000 | [diff] [blame] | 185 | // TODO(b/146727827) remove the *-api module when we can teach metalava |
Jiyong Park | e309516 | 2019-12-20 15:30:28 +0900 | [diff] [blame] | 186 | // about the relationship among the API surfaces. Currently, these modules are only to generate |
| 187 | // the API signature files and ensure that the APIs evolve in a backwards compatible manner. |
| 188 | // They however are NOT used for building the API stub. |
Jiyong Park | e309516 | 2019-12-20 15:30:28 +0900 | [diff] [blame] | 189 | |
| 190 | droidstubs { |
| 191 | name: "module-lib-api", |
Anton Hansson | 970c053 | 2020-01-17 13:42:43 +0000 | [diff] [blame] | 192 | defaults: ["metalava-api-stubs-default"], |
Jiyong Park | e309516 | 2019-12-20 15:30:28 +0900 | [diff] [blame] | 193 | libs: ["framework-all"], |
| 194 | arg_files: ["core/res/AndroidManifest.xml"], |
Anton Hansson | 81969c2 | 2020-02-03 20:45:56 +0000 | [diff] [blame] | 195 | args: metalava_framework_docs_args + module_libs, |
Jiyong Park | e309516 | 2019-12-20 15:30:28 +0900 | [diff] [blame] | 196 | check_api: { |
| 197 | current: { |
| 198 | api_file: "api/module-lib-current.txt", |
| 199 | removed_api_file: "api/module-lib-removed.txt", |
| 200 | }, |
| 201 | // TODO(b/147559833) enable the compatibility check against the last release API |
| 202 | // and the API lint |
| 203 | //last_released: { |
| 204 | // api_file: ":last-released-module-lib-api", |
| 205 | // removed_api_file: "api/module-lib-removed.txt", |
| 206 | // baseline_file: ":module-lib-api-incompatibilities-with-last-released" |
| 207 | //}, |
| 208 | //api_lint: { |
| 209 | // enabled: true, |
| 210 | // new_since: ":last-released-module-lib-api", |
| 211 | // baseline_file: "api/module-lib-lint-baseline.txt", |
| 212 | //}, |
| 213 | }, |
| 214 | //jdiff_enabled: true, |
| 215 | } |
| 216 | |
Anton Hansson | 81969c2 | 2020-02-03 20:45:56 +0000 | [diff] [blame] | 217 | |
| 218 | // The following droidstub module generates source files for the API stub library for |
| 219 | // modules. Note that it not only includes its own APIs but also other APIs that have |
| 220 | // narrower scope (all @SystemApis, not just the ones with 'client=MODULE_LIBRARIES'). |
Jiyong Park | e309516 | 2019-12-20 15:30:28 +0900 | [diff] [blame] | 221 | |
| 222 | droidstubs { |
| 223 | name: "module-lib-api-stubs-docs", |
Anton Hansson | 970c053 | 2020-01-17 13:42:43 +0000 | [diff] [blame] | 224 | defaults: ["metalava-api-stubs-default"], |
Jiyong Park | e309516 | 2019-12-20 15:30:28 +0900 | [diff] [blame] | 225 | libs: ["framework-all"], |
| 226 | arg_files: ["core/res/AndroidManifest.xml"], |
Anton Hansson | 81969c2 | 2020-02-03 20:45:56 +0000 | [diff] [blame] | 227 | args: metalava_framework_docs_args + priv_apps + module_libs, |
Jiyong Park | e309516 | 2019-12-20 15:30:28 +0900 | [diff] [blame] | 228 | } |
| 229 | |
| 230 | ///////////////////////////////////////////////////////////////////// |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 231 | // android_*_stubs_current modules are the stubs libraries compiled |
| 232 | // from *-api-stubs-docs |
| 233 | ///////////////////////////////////////////////////////////////////// |
| 234 | |
| 235 | java_defaults { |
| 236 | name: "framework-stubs-default", |
| 237 | errorprone: { |
| 238 | javacflags: [ |
| 239 | "-XepDisableAllChecks", |
| 240 | ], |
| 241 | }, |
| 242 | java_resources: [ |
| 243 | ":notices-for-framework-stubs", |
| 244 | ], |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 245 | system_modules: "none", |
| 246 | java_version: "1.8", |
| 247 | compile_dex: true, |
| 248 | } |
| 249 | |
| 250 | java_library_static { |
| 251 | name: "android_stubs_current", |
| 252 | srcs: [ |
| 253 | ":api-stubs-docs", |
| 254 | ], |
| 255 | libs: [ |
| 256 | "stub-annotations", |
| 257 | ], |
| 258 | static_libs: [ |
| 259 | "private-stub-annotations-jar", |
| 260 | ], |
| 261 | defaults: ["framework-stubs-default"], |
Jiyong Park | e309516 | 2019-12-20 15:30:28 +0900 | [diff] [blame] | 262 | sdk_version: "core_current", |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 263 | } |
| 264 | |
| 265 | java_library_static { |
| 266 | name: "android_system_stubs_current", |
| 267 | srcs: [ |
| 268 | ":system-api-stubs-docs", |
| 269 | ], |
| 270 | libs: [ |
| 271 | "stub-annotations", |
| 272 | ], |
| 273 | static_libs: [ |
| 274 | "private-stub-annotations-jar", |
| 275 | ], |
| 276 | defaults: ["framework-stubs-default"], |
Jiyong Park | e309516 | 2019-12-20 15:30:28 +0900 | [diff] [blame] | 277 | sdk_version: "core_current", |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 278 | } |
| 279 | |
| 280 | java_library_static { |
| 281 | name: "android_test_stubs_current", |
| 282 | srcs: [ |
| 283 | ":test-api-stubs-docs", |
| 284 | ], |
| 285 | libs: [ |
| 286 | "stub-annotations", |
| 287 | ], |
| 288 | static_libs: [ |
| 289 | "private-stub-annotations-jar", |
| 290 | ], |
| 291 | defaults: ["framework-stubs-default"], |
Jiyong Park | e309516 | 2019-12-20 15:30:28 +0900 | [diff] [blame] | 292 | sdk_version: "core_current", |
| 293 | } |
| 294 | |
| 295 | java_library_static { |
Anton Hansson | 1b9cf09 | 2020-01-30 12:09:02 +0000 | [diff] [blame] | 296 | name: "android_module_lib_stubs_current", |
Jiyong Park | e309516 | 2019-12-20 15:30:28 +0900 | [diff] [blame] | 297 | srcs: [ |
| 298 | ":module-lib-api-stubs-docs", |
| 299 | ], |
| 300 | libs: [ |
| 301 | "stub-annotations", |
| 302 | "framework-all", |
| 303 | ], |
| 304 | static_libs: [ |
| 305 | "private-stub-annotations-jar", |
| 306 | ], |
| 307 | defaults: ["framework-stubs-default"], |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 308 | } |
| 309 | |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 310 | ///////////////////////////////////////////////////////////////////// |
| 311 | // hwbinder.stubs provides APIs required for building HIDL Java |
| 312 | // libraries. |
| 313 | ///////////////////////////////////////////////////////////////////// |
| 314 | |
| 315 | droidstubs { |
| 316 | name: "hwbinder-stubs-docs", |
| 317 | srcs: [ |
| 318 | "core/java/android/os/HidlSupport.java", |
| 319 | "core/java/android/annotation/IntDef.java", |
| 320 | "core/java/android/annotation/IntRange.java", |
| 321 | "core/java/android/annotation/NonNull.java", |
| 322 | "core/java/android/annotation/SystemApi.java", |
| 323 | "core/java/android/os/HidlMemory.java", |
| 324 | "core/java/android/os/HwBinder.java", |
| 325 | "core/java/android/os/HwBlob.java", |
| 326 | "core/java/android/os/HwParcel.java", |
| 327 | "core/java/android/os/IHwBinder.java", |
| 328 | "core/java/android/os/IHwInterface.java", |
| 329 | "core/java/android/os/DeadObjectException.java", |
| 330 | "core/java/android/os/DeadSystemException.java", |
| 331 | "core/java/android/os/NativeHandle.java", |
| 332 | "core/java/android/os/RemoteException.java", |
| 333 | "core/java/android/util/AndroidException.java", |
| 334 | ], |
| 335 | installable: false, |
| 336 | sdk_version: "core_platform", |
| 337 | annotations_enabled: true, |
| 338 | previous_api: ":last-released-public-api", |
| 339 | merge_annotations_dirs: [ |
| 340 | "metalava-manual", |
| 341 | ], |
Anton Hansson | 81969c2 | 2020-02-03 20:45:56 +0000 | [diff] [blame] | 342 | args: priv_apps, |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 343 | } |
| 344 | |
| 345 | java_library_static { |
| 346 | name: "hwbinder.stubs", |
| 347 | sdk_version: "core_current", |
| 348 | srcs: [ |
| 349 | ":hwbinder-stubs-docs", |
| 350 | ], |
| 351 | } |
| 352 | |
| 353 | ///////////////////////////////////////////////////////////////////// |
| 354 | // Stubs for hiddenapi processing. |
| 355 | ///////////////////////////////////////////////////////////////////// |
| 356 | |
| 357 | droidstubs { |
| 358 | name: "hiddenapi-lists-docs", |
| 359 | defaults: ["metalava-api-stubs-default"], |
| 360 | arg_files: [ |
| 361 | "core/res/AndroidManifest.xml", |
| 362 | ], |
| 363 | dex_api_filename: "public-dex.txt", |
| 364 | private_dex_api_filename: "private-dex.txt", |
| 365 | removed_dex_api_filename: "removed-dex.txt", |
| 366 | args: metalava_framework_docs_args + |
| 367 | " --show-unannotated " + |
Anton Hansson | 81969c2 | 2020-02-03 20:45:56 +0000 | [diff] [blame] | 368 | priv_apps + |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 369 | " --show-annotation android.annotation.TestApi ", |
| 370 | } |
| 371 | |
| 372 | droidstubs { |
| 373 | name: "hiddenapi-mappings", |
| 374 | defaults: ["metalava-api-stubs-default"], |
| 375 | srcs: [ |
| 376 | ":opt-telephony-common-srcs", |
| 377 | ], |
| 378 | |
| 379 | arg_files: [ |
| 380 | "core/res/AndroidManifest.xml", |
| 381 | ], |
| 382 | dex_mapping_filename: "dex-mapping.txt", |
| 383 | args: metalava_framework_docs_args + |
| 384 | " --hide ReferencesHidden " + |
| 385 | " --hide UnhiddenSystemApi " + |
| 386 | " --show-unannotated " + |
Anton Hansson | 81969c2 | 2020-02-03 20:45:56 +0000 | [diff] [blame] | 387 | priv_apps + |
Jiyong Park | 7fb4b18 | 2019-12-20 14:35:43 +0900 | [diff] [blame] | 388 | " --show-annotation android.annotation.TestApi ", |
| 389 | } |
| 390 | |
| 391 | ///////////////////////////////////////////////////////////////////// |
| 392 | // api/*-current.txt files for use by modules in other directories |
| 393 | // like the CTS test |
| 394 | ///////////////////////////////////////////////////////////////////// |
| 395 | |
| 396 | filegroup { |
| 397 | name: "frameworks-base-api-current.txt", |
| 398 | srcs: [ |
| 399 | "api/current.txt", |
| 400 | ], |
| 401 | } |
| 402 | |
| 403 | filegroup { |
| 404 | name: "frameworks-base-api-system-current.txt", |
| 405 | srcs: [ |
| 406 | "api/system-current.txt", |
| 407 | ], |
| 408 | } |
| 409 | |
| 410 | filegroup { |
| 411 | name: "frameworks-base-api-system-removed.txt", |
| 412 | srcs: [ |
| 413 | "api/system-removed.txt", |
| 414 | ], |
| 415 | } |