blob: 6afed7a78a08c2fafa5897d7dca77f30b36ed773 [file] [log] [blame]
Jiyong Park7fb4b182019-12-20 14:35:43 +09001// 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//
Anton Hansson1c58ffc2020-11-13 11:44:32 +000019// - The metalava conversion is done by droidstub modules
20// - The javac compilation is done by java_library modules
21//
Jiyong Park7fb4b182019-12-20 14:35:43 +090022// The metalava conversion is also responsible for creating API signature files
Anton Hansson1c58ffc2020-11-13 11:44:32 +000023// and comparing them against the checked in API signature, and also checking compatibility
24// with the latest frozen API signature.
Jiyong Park7fb4b182019-12-20 14:35:43 +090025
26/////////////////////////////////////////////////////////////////////
27// Common metalava configs
28/////////////////////////////////////////////////////////////////////
29
30packages_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
43stubs_defaults {
Anton Hansson1c58ffc2020-11-13 11:44:32 +000044 name: "metalava-non-updatable-api-stubs-default",
Jiyong Park7fb4b182019-12-20 14:35:43 +090045 srcs: [
46 ":framework-non-updatable-sources",
Jiyong Park7fb4b182019-12-20 14:35:43 +090047 "core/java/**/*.logtags",
48 ":opt-telephony-srcs",
49 ":opt-net-voip-srcs",
Ramy Medhataaa83862020-05-04 05:54:30 -040050 "**/package.html",
Jiyong Park7fb4b182019-12-20 14:35:43 +090051 ],
Anton Hansson121ccbc2020-12-17 14:56:06 +000052 sdk_version: "none",
53 system_modules: "none",
54 java_version: "1.8",
Anton Hansson1c58ffc2020-11-13 11:44:32 +000055 arg_files: ["core/res/AndroidManifest.xml"],
Chen Xu546ce5e2020-01-10 08:38:31 -080056 // TODO(b/147699819): remove below aidl includes.
57 aidl: {
Anton Hansson1c58ffc2020-11-13 11:44:32 +000058 local_include_dirs: [
59 "apex/media/aidl/stable",
60 "telephony/java",
61 ],
Chen Xu546ce5e2020-01-10 08:38:31 -080062 },
Jiyong Parkc0f8a282020-09-29 13:43:00 +090063 // These are libs from framework-internal-utils that are required (i.e. being referenced)
64 // from framework-non-updatable-sources. Add more here when there's a need.
65 // DO NOT add the entire framework-internal-utils. It might cause unnecessary circular
66 // dependencies gets bigger.
67 libs: [
68 "android.hardware.cas-V1.2-java",
69 "android.hardware.health-V1.0-java-constants",
70 "android.hardware.radio-V1.5-java",
Jayachandran C0f14f812020-08-10 10:58:23 -070071 "android.hardware.radio-V1.6-java",
Jiyong Parkc0f8a282020-09-29 13:43:00 +090072 "android.hardware.thermal-V1.0-java-constants",
73 "android.hardware.thermal-V2.0-java",
74 "android.hardware.tv.input-V1.0-java-constants",
75 "android.hardware.tv.tuner-V1.0-java-constants",
76 "android.hardware.usb-V1.0-java-constants",
77 "android.hardware.usb-V1.1-java-constants",
78 "android.hardware.usb.gadget-V1.0-java",
79 "android.hardware.vibrator-V1.3-java",
80 "framework-protos",
Anton Hansson121ccbc2020-12-17 14:56:06 +000081 "stable.core.platform.api.stubs",
Anton Hansson1c58ffc2020-11-13 11:44:32 +000082 // There are a few classes from modules used as type arguments that
83 // need to be resolved by metalava. For now, we can use a previously
84 // finalized stub library to resolve them. If a new class gets added,
85 // this may be need to be revisited to use a manually maintained stub
86 // library with empty classes in order to resolve those references.
87 "sdk_system_30_android",
Jiyong Parkc0f8a282020-09-29 13:43:00 +090088 ],
Anton Hansson35146892020-10-26 10:27:57 +000089 high_mem: true, // Lots of sources => high memory use, see b/170701554
Jiyong Park7fb4b182019-12-20 14:35:43 +090090 installable: false,
91 annotations_enabled: true,
Anton Hanssonf68ddea2020-05-02 17:49:26 +010092 previous_api: ":android.api.public.latest",
Jiyong Park7fb4b182019-12-20 14:35:43 +090093 merge_annotations_dirs: [
94 "metalava-manual",
95 ],
Aurimas Liutikas94bac9c2020-03-12 17:06:12 -070096 api_levels_annotations_enabled: false,
Jiyong Park7fb4b182019-12-20 14:35:43 +090097 filter_packages: packages_to_document,
98}
99
100/////////////////////////////////////////////////////////////////////
Anton Hansson51861e72020-11-13 09:55:29 +0000101// These modules provide source files for the stub libraries
Jiyong Park7fb4b182019-12-20 14:35:43 +0900102/////////////////////////////////////////////////////////////////////
103
Anton Hansson7f6823e2020-06-04 15:09:36 +0100104droidstubs {
105 name: "api-stubs-docs-non-updatable",
106 defaults: ["metalava-non-updatable-api-stubs-default"],
Anton Hansson7f6823e2020-06-04 15:09:36 +0100107 args: metalava_framework_docs_args,
108 check_api: {
109 current: {
Anton Hansson7bfceb82020-10-29 18:59:10 +0000110 api_file: "core/api/current.txt",
111 removed_api_file: "core/api/removed.txt",
Anton Hansson7f6823e2020-06-04 15:09:36 +0100112 },
Anton Hansson3258a472020-10-05 16:23:27 +0100113 last_released: {
114 api_file: ":android-non-updatable.api.public.latest",
115 removed_api_file: ":android-non-updatable-removed.api.public.latest",
Anton Hanssonce556232021-01-22 16:40:06 +0000116 baseline_file: ":android-incompatibilities.api.public.latest",
Anton Hansson3258a472020-10-05 16:23:27 +0100117 },
Anton Hansson33ea9992020-04-09 14:16:37 +0100118 api_lint: {
119 enabled: true,
120 new_since: ":android-non-updatable.api.public.latest",
121 },
Anton Hansson7f6823e2020-06-04 15:09:36 +0100122 },
Anton Hansson85785fe2021-01-20 20:23:34 +0000123 dists: [
124 {
125 targets: ["sdk", "win_sdk"],
126 dir: "apistubs/android/public/api",
127 dest: "android-non-updatable.txt",
128 tag: ".api.txt",
129 },
130 {
131 targets: ["sdk", "win_sdk"],
132 dir: "apistubs/android/public/api",
133 dest: "android-non-updatable-removed.txt",
134 tag: ".removed-api.txt",
135 },
136 ],
Anton Hansson7f6823e2020-06-04 15:09:36 +0100137}
138
Anton Hansson1c58ffc2020-11-13 11:44:32 +0000139priv_apps =
Anton Hansson81969c22020-02-03 20:45:56 +0000140 " --show-annotation android.annotation.SystemApi\\(" +
Anton Hansson1c58ffc2020-11-13 11:44:32 +0000141 "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
142 "\\)"
143
144priv_apps_in_stubs =
Makoto Onukia13287f2020-07-10 12:05:21 -0700145 " --show-for-stub-purposes-annotation android.annotation.SystemApi\\(" +
146 "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
Anton Hansson1c58ffc2020-11-13 11:44:32 +0000147 "\\)"
148
149test = " --show-annotation android.annotation.TestApi"
150
151module_libs =
152 " --show-annotation android.annotation.SystemApi\\(" +
153 "client=android.annotation.SystemApi.Client.MODULE_LIBRARIES" +
154 "\\)"
Anton Hansson81969c22020-02-03 20:45:56 +0000155
Jiyong Park7fb4b182019-12-20 14:35:43 +0900156droidstubs {
Anton Hansson7f6823e2020-06-04 15:09:36 +0100157 name: "system-api-stubs-docs-non-updatable",
158 defaults: ["metalava-non-updatable-api-stubs-default"],
Anton Hansson7f6823e2020-06-04 15:09:36 +0100159 args: metalava_framework_docs_args + priv_apps,
160 check_api: {
161 current: {
Anton Hansson7bfceb82020-10-29 18:59:10 +0000162 api_file: "core/api/system-current.txt",
163 removed_api_file: "core/api/system-removed.txt",
Anton Hansson7f6823e2020-06-04 15:09:36 +0100164 },
Anton Hansson3258a472020-10-05 16:23:27 +0100165 last_released: {
166 api_file: ":android-non-updatable.api.system.latest",
167 removed_api_file: ":android-non-updatable-removed.api.system.latest",
Anton Hanssonce556232021-01-22 16:40:06 +0000168 baseline_file: ":android-incompatibilities.api.system.latest"
Anton Hansson3258a472020-10-05 16:23:27 +0100169 },
Anton Hansson33ea9992020-04-09 14:16:37 +0100170 api_lint: {
171 enabled: true,
172 new_since: ":android-non-updatable.api.system.latest",
Anton Hansson7bfceb82020-10-29 18:59:10 +0000173 baseline_file: "core/api/system-lint-baseline.txt",
Anton Hansson33ea9992020-04-09 14:16:37 +0100174 },
Anton Hansson7f6823e2020-06-04 15:09:36 +0100175 },
Anton Hansson85785fe2021-01-20 20:23:34 +0000176 dists: [
177 {
178 targets: ["sdk", "win_sdk"],
179 dir: "apistubs/android/system/api",
180 dest: "android-non-updatable.txt",
181 tag: ".api.txt",
182 },
183 {
184 targets: ["sdk", "win_sdk"],
185 dir: "apistubs/android/system/api",
186 dest: "android-non-updatable-removed.txt",
187 tag: ".removed-api.txt",
188 },
189 ],
Anton Hansson7f6823e2020-06-04 15:09:36 +0100190}
191
192droidstubs {
Anton Hansson552ba2c2020-11-05 10:45:13 +0000193 name: "test-api-stubs-docs-non-updatable",
Anton Hansson7110ae72020-10-15 17:23:35 +0100194 defaults: ["metalava-non-updatable-api-stubs-default"],
Anton Hansson1c58ffc2020-11-13 11:44:32 +0000195 args: metalava_framework_docs_args + test + priv_apps_in_stubs,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900196 check_api: {
197 current: {
Anton Hansson552ba2c2020-11-05 10:45:13 +0000198 api_file: "core/api/test-current.txt",
199 removed_api_file: "core/api/test-removed.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900200 },
201 api_lint: {
202 enabled: true,
Anton Hansson552ba2c2020-11-05 10:45:13 +0000203 baseline_file: "core/api/test-lint-baseline.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900204 },
205 },
Anton Hansson85785fe2021-01-20 20:23:34 +0000206 dists: [
207 {
208 targets: ["sdk", "win_sdk"],
209 dir: "apistubs/android/test/api",
210 dest: "android.txt",
211 tag: ".api.txt",
212 },
213 {
214 targets: ["sdk", "win_sdk"],
215 dir: "apistubs/android/test/api",
216 dest: "removed.txt",
217 tag: ".removed-api.txt",
218 },
219 {
220 targets: ["sdk", "win_sdk"],
221 dir: "apistubs/android/test/api",
222 dest: "android-non-updatable.txt",
223 tag: ".api.txt",
224 },
225 {
226 targets: ["sdk", "win_sdk"],
227 dir: "apistubs/android/test/api",
228 dest: "android-non-updatable-removed.txt",
229 tag: ".removed-api.txt",
230 },
231 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900232}
233
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900234droidstubs {
Anton Hansson7f6823e2020-06-04 15:09:36 +0100235 name: "module-lib-api-stubs-docs-non-updatable",
236 defaults: ["metalava-non-updatable-api-stubs-default"],
Anton Hansson1c58ffc2020-11-13 11:44:32 +0000237 args: metalava_framework_docs_args + priv_apps_in_stubs + module_libs,
Anton Hansson7f6823e2020-06-04 15:09:36 +0100238 check_api: {
239 current: {
Anton Hansson7bfceb82020-10-29 18:59:10 +0000240 api_file: "core/api/module-lib-current.txt",
241 removed_api_file: "core/api/module-lib-removed.txt",
Anton Hansson7f6823e2020-06-04 15:09:36 +0100242 },
Anton Hanssonc3ef1f562020-10-07 14:55:36 +0100243 last_released: {
244 api_file: ":android-non-updatable.api.module-lib.latest",
245 removed_api_file: ":android-non-updatable-removed.api.module-lib.latest",
246 },
Anton Hansson33ea9992020-04-09 14:16:37 +0100247 api_lint: {
248 enabled: true,
249 new_since: ":android-non-updatable.api.module-lib.latest",
250 },
Anton Hansson7f6823e2020-06-04 15:09:36 +0100251 },
Anton Hansson85785fe2021-01-20 20:23:34 +0000252 dists: [
253 {
254 targets: ["sdk", "win_sdk"],
255 dir: "apistubs/android/module-lib/api",
256 dest: "android-non-updatable.txt",
257 tag: ".api.txt",
258 },
259 {
260 targets: ["sdk", "win_sdk"],
261 dir: "apistubs/android/module-lib/api",
262 dest: "android-non-updatable-removed.txt",
263 tag: ".removed-api.txt",
264 },
265 ],
Anton Hansson7f6823e2020-06-04 15:09:36 +0100266}
Anton Hansson81969c22020-02-03 20:45:56 +0000267
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900268/////////////////////////////////////////////////////////////////////
Jiyong Park7fb4b182019-12-20 14:35:43 +0900269// android_*_stubs_current modules are the stubs libraries compiled
Anton Hansson1c58ffc2020-11-13 11:44:32 +0000270// from stub sources
Jiyong Park7fb4b182019-12-20 14:35:43 +0900271/////////////////////////////////////////////////////////////////////
272
273java_defaults {
Anton Hanssonfbd32f32020-04-09 14:16:37 +0100274 name: "android_defaults_stubs_current",
Anton Hansson42afd612020-02-08 20:43:19 +0000275 libs: [ "stub-annotations" ],
Paul Duffina281e922020-03-25 10:13:33 +0000276 static_libs: [
Paul Duffina281e922020-03-25 10:13:33 +0000277 // License notices from art module
278 "art-notices-for-framework-stubs-jar",
Anton Hanssoncf42e982020-08-13 19:40:13 +0100279 "framework-res-package-jar", // Export package of framework-res
Paul Duffina281e922020-03-25 10:13:33 +0000280 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900281 errorprone: {
282 javacflags: [
283 "-XepDisableAllChecks",
284 ],
285 },
Anton Hanssonfbd32f32020-04-09 14:16:37 +0100286 sdk_version: "none",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900287 system_modules: "none",
288 java_version: "1.8",
289 compile_dex: true,
290}
291
Anton Hanssona9205502020-07-15 13:36:34 +0100292java_defaults {
293 name: "android_stubs_dists_default",
294 dist: {
295 targets: ["sdk", "win_sdk"],
296 tag: ".jar",
297 dest: "android.jar",
298 },
299}
300
Jiyong Park7fb4b182019-12-20 14:35:43 +0900301java_library_static {
Anton Hansson3a8e0362020-11-03 19:35:56 +0000302 name: "android_stubs_current",
Anton Hansson912622f2020-04-09 14:16:37 +0100303 srcs: [ ":api-stubs-docs-non-updatable" ],
304 static_libs: [
Anton Hanssonfc948d862020-12-17 16:57:35 +0000305 "art.module.public.api.stubs",
Anton Hansson912622f2020-04-09 14:16:37 +0100306 "conscrypt.module.public.api.stubs",
Paul Duffinabebc6a2020-05-31 11:35:50 +0100307 "framework-media.stubs",
308 "framework-mediaprovider.stubs",
309 "framework-permission.stubs",
Anton Hansson912622f2020-04-09 14:16:37 +0100310 "framework-sdkextensions.stubs",
Paul Duffinabebc6a2020-05-31 11:35:50 +0100311 "framework-statsd.stubs",
Anton Hansson912622f2020-04-09 14:16:37 +0100312 "framework-tethering.stubs",
Paul Duffinabebc6a2020-05-31 11:35:50 +0100313 "framework-wifi.stubs",
Paul Duffin5a4e8f22020-11-25 15:45:43 +0000314 "i18n.module.public.api.stubs",
Anton Hansson33ea9992020-04-09 14:16:37 +0100315 "private-stub-annotations-jar",
Anton Hansson912622f2020-04-09 14:16:37 +0100316 ],
Anton Hanssonc3002e52020-11-18 18:23:55 +0000317 defaults: ["android_defaults_stubs_current"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900318}
319
320java_library_static {
Anton Hansson3a8e0362020-11-03 19:35:56 +0000321 name: "android_system_stubs_current",
Anton Hansson912622f2020-04-09 14:16:37 +0100322 srcs: [ ":system-api-stubs-docs-non-updatable" ],
323 static_libs: [
Anton Hanssonfc948d862020-12-17 16:57:35 +0000324 "art.module.public.api.stubs",
Anton Hansson912622f2020-04-09 14:16:37 +0100325 "conscrypt.module.public.api.stubs",
Paul Duffinabebc6a2020-05-31 11:35:50 +0100326 "framework-media.stubs.system",
327 "framework-mediaprovider.stubs.system",
328 "framework-permission.stubs.system",
Anton Hansson912622f2020-04-09 14:16:37 +0100329 "framework-sdkextensions.stubs.system",
Paul Duffinabebc6a2020-05-31 11:35:50 +0100330 "framework-statsd.stubs.system",
Anton Hansson912622f2020-04-09 14:16:37 +0100331 "framework-tethering.stubs.system",
Paul Duffinabebc6a2020-05-31 11:35:50 +0100332 "framework-wifi.stubs.system",
Paul Duffin5a4e8f22020-11-25 15:45:43 +0000333 "i18n.module.public.api.stubs",
Anton Hansson33ea9992020-04-09 14:16:37 +0100334 "private-stub-annotations-jar",
Anton Hansson912622f2020-04-09 14:16:37 +0100335 ],
Anton Hanssonc3002e52020-11-18 18:23:55 +0000336 defaults: [
337 "android_defaults_stubs_current",
338 "android_stubs_dists_default",
339 ],
340 dist: {
341 dir: "apistubs/android/system",
342 },
343 dists: [
344 {
345 // Legacy dist path
346 targets: ["sdk", "win_sdk"],
347 tag: ".jar",
348 dest: "android_system.jar",
349 },
350 ],
Anton Hansson912622f2020-04-09 14:16:37 +0100351}
352
353java_library_static {
Jiyong Park7fb4b182019-12-20 14:35:43 +0900354 name: "android_test_stubs_current",
Anton Hansson552ba2c2020-11-05 10:45:13 +0000355 srcs: [ ":test-api-stubs-docs-non-updatable" ],
Anton Hansson7110ae72020-10-15 17:23:35 +0100356 static_libs: [
357 // Modules do not have test APIs, but we want to include their SystemApis, like we include
358 // the SystemApi of framework-non-updatable-sources.
Anton Hanssonfc948d862020-12-17 16:57:35 +0000359 "art.module.public.api.stubs",
Anton Hansson7110ae72020-10-15 17:23:35 +0100360 "conscrypt.module.public.api.stubs",
361 "framework-media.stubs.system",
362 "framework-mediaprovider.stubs.system",
363 "framework-permission.stubs.system",
364 "framework-sdkextensions.stubs.system",
365 "framework-statsd.stubs.system",
366 "framework-tethering.stubs.system",
367 "framework-wifi.stubs.system",
Paul Duffin5a4e8f22020-11-25 15:45:43 +0000368 "i18n.module.public.api.stubs",
Anton Hansson7110ae72020-10-15 17:23:35 +0100369 "private-stub-annotations-jar",
370 ],
Anton Hanssona9205502020-07-15 13:36:34 +0100371 defaults: [
372 "android_defaults_stubs_current",
373 "android_stubs_dists_default",
374 ],
375 dist: {
376 dir: "apistubs/android/test",
377 },
378 dists: [
379 {
380 // Legacy dist path
381 targets: ["sdk", "win_sdk"],
382 tag: ".jar",
383 dest: "android_test.jar",
384 },
385 ],
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900386}
387
388java_library_static {
Anton Hansson9c4bbe92020-01-30 12:09:02 +0000389 name: "android_module_lib_stubs_current",
Makoto Onuki8c61de62020-07-15 10:38:04 -0700390 srcs: [ ":module-lib-api-stubs-docs-non-updatable" ],
Anton Hanssona9205502020-07-15 13:36:34 +0100391 defaults: [
392 "android_defaults_stubs_current",
393 "android_stubs_dists_default",
394 ],
Anton Hanssonebb26a32020-04-14 16:35:36 +0100395 libs: ["sdk_system_29_android"],
Anton Hanssonfc948d862020-12-17 16:57:35 +0000396 static_libs: ["art.module.public.api.stubs"],
Anton Hanssona9205502020-07-15 13:36:34 +0100397 dist: {
398 dir: "apistubs/android/module-lib",
399 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900400}
401
Jiyong Park7fb4b182019-12-20 14:35:43 +0900402/////////////////////////////////////////////////////////////////////
403// hwbinder.stubs provides APIs required for building HIDL Java
404// libraries.
405/////////////////////////////////////////////////////////////////////
406
407droidstubs {
408 name: "hwbinder-stubs-docs",
409 srcs: [
410 "core/java/android/os/HidlSupport.java",
411 "core/java/android/annotation/IntDef.java",
412 "core/java/android/annotation/IntRange.java",
413 "core/java/android/annotation/NonNull.java",
414 "core/java/android/annotation/SystemApi.java",
415 "core/java/android/os/HidlMemory.java",
416 "core/java/android/os/HwBinder.java",
417 "core/java/android/os/HwBlob.java",
418 "core/java/android/os/HwParcel.java",
419 "core/java/android/os/IHwBinder.java",
420 "core/java/android/os/IHwInterface.java",
421 "core/java/android/os/DeadObjectException.java",
422 "core/java/android/os/DeadSystemException.java",
423 "core/java/android/os/NativeHandle.java",
424 "core/java/android/os/RemoteException.java",
425 "core/java/android/util/AndroidException.java",
426 ],
427 installable: false,
428 sdk_version: "core_platform",
429 annotations_enabled: true,
Anton Hanssonf68ddea2020-05-02 17:49:26 +0100430 previous_api: ":android.api.public.latest",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900431 merge_annotations_dirs: [
432 "metalava-manual",
433 ],
Anton Hansson81969c22020-02-03 20:45:56 +0000434 args: priv_apps,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900435}
436
437java_library_static {
438 name: "hwbinder.stubs",
439 sdk_version: "core_current",
440 srcs: [
441 ":hwbinder-stubs-docs",
442 ],
443}