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