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