blob: ccb09fba88ca7a44706ef69f61cd8affebf585de [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",
Anton Hansson77ff72f2021-03-30 10:11:22 +010045 srcs: [":framework-non-updatable-stub-sources"],
Anton Hansson121ccbc2020-12-17 14:56:06 +000046 sdk_version: "none",
47 system_modules: "none",
48 java_version: "1.8",
Anton Hansson1c58ffc2020-11-13 11:44:32 +000049 arg_files: ["core/res/AndroidManifest.xml"],
Chen Xu546ce5e2020-01-10 08:38:31 -080050 // TODO(b/147699819): remove below aidl includes.
51 aidl: {
Anton Hansson1c58ffc2020-11-13 11:44:32 +000052 local_include_dirs: [
53 "apex/media/aidl/stable",
Remi NGUYEN VANc15d99e2021-01-28 13:37:03 +090054 // TODO: move to include-dirs for packages/modules/Connectivity when this moves out of
55 // frameworks/base
56 "packages/Connectivity/framework/aidl-export",
Anton Hansson1c58ffc2020-11-13 11:44:32 +000057 "telephony/java",
58 ],
Chen Xu546ce5e2020-01-10 08:38:31 -080059 },
Jiyong Parkc0f8a282020-09-29 13:43:00 +090060 // These are libs from framework-internal-utils that are required (i.e. being referenced)
61 // from framework-non-updatable-sources. Add more here when there's a need.
62 // DO NOT add the entire framework-internal-utils. It might cause unnecessary circular
63 // dependencies gets bigger.
64 libs: [
65 "android.hardware.cas-V1.2-java",
66 "android.hardware.health-V1.0-java-constants",
67 "android.hardware.radio-V1.5-java",
Jayachandran C0f14f812020-08-10 10:58:23 -070068 "android.hardware.radio-V1.6-java",
Jiyong Parkc0f8a282020-09-29 13:43:00 +090069 "android.hardware.thermal-V1.0-java-constants",
70 "android.hardware.thermal-V2.0-java",
71 "android.hardware.tv.input-V1.0-java-constants",
72 "android.hardware.tv.tuner-V1.0-java-constants",
73 "android.hardware.usb-V1.0-java-constants",
74 "android.hardware.usb-V1.1-java-constants",
75 "android.hardware.usb.gadget-V1.0-java",
76 "android.hardware.vibrator-V1.3-java",
77 "framework-protos",
Anton Hansson121ccbc2020-12-17 14:56:06 +000078 "stable.core.platform.api.stubs",
Anton Hanssonce21e282021-02-05 11:38:30 +000079 // There are a few classes from modules used by the core that
80 // need to be resolved by metalava. We use a prebuilt stub of the
81 // full sdk to ensure we can resolve them. If a new class gets added,
82 // the prebuilts/sdk/current needs to be updated.
83 "sdk_system_current_android",
Anton Hanssonb7d532e2021-02-05 11:40:25 +000084 // NOTE: The below can be removed once the prebuilt stub contains IKE.
85 "sdk_system_current_android.net.ipsec.ike",
Jiyong Parkc0f8a282020-09-29 13:43:00 +090086 ],
Anton Hansson35146892020-10-26 10:27:57 +000087 high_mem: true, // Lots of sources => high memory use, see b/170701554
Jiyong Park7fb4b182019-12-20 14:35:43 +090088 installable: false,
89 annotations_enabled: true,
Anton Hanssonf68ddea2020-05-02 17:49:26 +010090 previous_api: ":android.api.public.latest",
Jiyong Park7fb4b182019-12-20 14:35:43 +090091 merge_annotations_dirs: [
92 "metalava-manual",
93 ],
Aurimas Liutikas94bac9c2020-03-12 17:06:12 -070094 api_levels_annotations_enabled: false,
Jiyong Park7fb4b182019-12-20 14:35:43 +090095 filter_packages: packages_to_document,
96}
97
98/////////////////////////////////////////////////////////////////////
Anton Hansson51861e72020-11-13 09:55:29 +000099// These modules provide source files for the stub libraries
Jiyong Park7fb4b182019-12-20 14:35:43 +0900100/////////////////////////////////////////////////////////////////////
101
Anton Hansson7f6823e2020-06-04 15:09:36 +0100102droidstubs {
103 name: "api-stubs-docs-non-updatable",
104 defaults: ["metalava-non-updatable-api-stubs-default"],
Anton Hansson7f6823e2020-06-04 15:09:36 +0100105 args: metalava_framework_docs_args,
106 check_api: {
107 current: {
Anton Hansson7bfceb82020-10-29 18:59:10 +0000108 api_file: "core/api/current.txt",
109 removed_api_file: "core/api/removed.txt",
Anton Hansson7f6823e2020-06-04 15:09:36 +0100110 },
Anton Hansson3258a472020-10-05 16:23:27 +0100111 last_released: {
112 api_file: ":android-non-updatable.api.public.latest",
113 removed_api_file: ":android-non-updatable-removed.api.public.latest",
Anton Hanssonce556232021-01-22 16:40:06 +0000114 baseline_file: ":android-incompatibilities.api.public.latest",
Anton Hansson3258a472020-10-05 16:23:27 +0100115 },
Anton Hansson33ea9992020-04-09 14:16:37 +0100116 api_lint: {
117 enabled: true,
118 new_since: ":android-non-updatable.api.public.latest",
119 },
Anton Hansson7f6823e2020-06-04 15:09:36 +0100120 },
Anton Hansson85785fe2021-01-20 20:23:34 +0000121 dists: [
122 {
123 targets: ["sdk", "win_sdk"],
124 dir: "apistubs/android/public/api",
125 dest: "android-non-updatable.txt",
126 tag: ".api.txt",
127 },
128 {
129 targets: ["sdk", "win_sdk"],
130 dir: "apistubs/android/public/api",
131 dest: "android-non-updatable-removed.txt",
132 tag: ".removed-api.txt",
133 },
134 ],
Anton Hansson7f6823e2020-06-04 15:09:36 +0100135}
136
Anton Hansson1c58ffc2020-11-13 11:44:32 +0000137priv_apps =
Anton Hansson81969c22020-02-03 20:45:56 +0000138 " --show-annotation android.annotation.SystemApi\\(" +
Anton Hansson1c58ffc2020-11-13 11:44:32 +0000139 "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
140 "\\)"
141
142priv_apps_in_stubs =
Makoto Onukia13287f2020-07-10 12:05:21 -0700143 " --show-for-stub-purposes-annotation android.annotation.SystemApi\\(" +
144 "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
Anton Hansson1c58ffc2020-11-13 11:44:32 +0000145 "\\)"
146
147test = " --show-annotation android.annotation.TestApi"
148
149module_libs =
150 " --show-annotation android.annotation.SystemApi\\(" +
151 "client=android.annotation.SystemApi.Client.MODULE_LIBRARIES" +
152 "\\)"
Anton Hansson81969c22020-02-03 20:45:56 +0000153
Jiyong Park7fb4b182019-12-20 14:35:43 +0900154droidstubs {
Anton Hansson7f6823e2020-06-04 15:09:36 +0100155 name: "system-api-stubs-docs-non-updatable",
156 defaults: ["metalava-non-updatable-api-stubs-default"],
Anton Hansson7f6823e2020-06-04 15:09:36 +0100157 args: metalava_framework_docs_args + priv_apps,
158 check_api: {
159 current: {
Anton Hansson7bfceb82020-10-29 18:59:10 +0000160 api_file: "core/api/system-current.txt",
161 removed_api_file: "core/api/system-removed.txt",
Anton Hansson7f6823e2020-06-04 15:09:36 +0100162 },
Anton Hansson3258a472020-10-05 16:23:27 +0100163 last_released: {
164 api_file: ":android-non-updatable.api.system.latest",
165 removed_api_file: ":android-non-updatable-removed.api.system.latest",
Anton Hanssonce556232021-01-22 16:40:06 +0000166 baseline_file: ":android-incompatibilities.api.system.latest"
Anton Hansson3258a472020-10-05 16:23:27 +0100167 },
Anton Hansson33ea9992020-04-09 14:16:37 +0100168 api_lint: {
169 enabled: true,
170 new_since: ":android-non-updatable.api.system.latest",
Anton Hansson7bfceb82020-10-29 18:59:10 +0000171 baseline_file: "core/api/system-lint-baseline.txt",
Anton Hansson33ea9992020-04-09 14:16:37 +0100172 },
Anton Hansson7f6823e2020-06-04 15:09:36 +0100173 },
Anton Hansson85785fe2021-01-20 20:23:34 +0000174 dists: [
175 {
176 targets: ["sdk", "win_sdk"],
177 dir: "apistubs/android/system/api",
178 dest: "android-non-updatable.txt",
179 tag: ".api.txt",
180 },
181 {
182 targets: ["sdk", "win_sdk"],
183 dir: "apistubs/android/system/api",
184 dest: "android-non-updatable-removed.txt",
185 tag: ".removed-api.txt",
186 },
187 ],
Anton Hansson7f6823e2020-06-04 15:09:36 +0100188}
189
190droidstubs {
Anton Hansson552ba2c2020-11-05 10:45:13 +0000191 name: "test-api-stubs-docs-non-updatable",
Anton Hansson7110ae72020-10-15 17:23:35 +0100192 defaults: ["metalava-non-updatable-api-stubs-default"],
Anton Hansson1c58ffc2020-11-13 11:44:32 +0000193 args: metalava_framework_docs_args + test + priv_apps_in_stubs,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900194 check_api: {
195 current: {
Anton Hansson552ba2c2020-11-05 10:45:13 +0000196 api_file: "core/api/test-current.txt",
197 removed_api_file: "core/api/test-removed.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900198 },
199 api_lint: {
200 enabled: true,
Anton Hansson552ba2c2020-11-05 10:45:13 +0000201 baseline_file: "core/api/test-lint-baseline.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900202 },
203 },
Anton Hansson85785fe2021-01-20 20:23:34 +0000204 dists: [
205 {
206 targets: ["sdk", "win_sdk"],
207 dir: "apistubs/android/test/api",
208 dest: "android.txt",
209 tag: ".api.txt",
210 },
211 {
212 targets: ["sdk", "win_sdk"],
213 dir: "apistubs/android/test/api",
214 dest: "removed.txt",
215 tag: ".removed-api.txt",
216 },
217 {
218 targets: ["sdk", "win_sdk"],
219 dir: "apistubs/android/test/api",
220 dest: "android-non-updatable.txt",
221 tag: ".api.txt",
222 },
223 {
224 targets: ["sdk", "win_sdk"],
225 dir: "apistubs/android/test/api",
226 dest: "android-non-updatable-removed.txt",
227 tag: ".removed-api.txt",
228 },
229 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900230}
231
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900232droidstubs {
Anton Hansson7f6823e2020-06-04 15:09:36 +0100233 name: "module-lib-api-stubs-docs-non-updatable",
234 defaults: ["metalava-non-updatable-api-stubs-default"],
Anton Hansson1c58ffc2020-11-13 11:44:32 +0000235 args: metalava_framework_docs_args + priv_apps_in_stubs + module_libs,
Anton Hansson7f6823e2020-06-04 15:09:36 +0100236 check_api: {
237 current: {
Anton Hansson7bfceb82020-10-29 18:59:10 +0000238 api_file: "core/api/module-lib-current.txt",
239 removed_api_file: "core/api/module-lib-removed.txt",
Anton Hansson7f6823e2020-06-04 15:09:36 +0100240 },
Anton Hanssonc3ef1f562020-10-07 14:55:36 +0100241 last_released: {
242 api_file: ":android-non-updatable.api.module-lib.latest",
243 removed_api_file: ":android-non-updatable-removed.api.module-lib.latest",
244 },
Anton Hansson33ea9992020-04-09 14:16:37 +0100245 api_lint: {
246 enabled: true,
247 new_since: ":android-non-updatable.api.module-lib.latest",
248 },
Anton Hansson7f6823e2020-06-04 15:09:36 +0100249 },
Anton Hansson85785fe2021-01-20 20:23:34 +0000250 dists: [
251 {
252 targets: ["sdk", "win_sdk"],
253 dir: "apistubs/android/module-lib/api",
254 dest: "android-non-updatable.txt",
255 tag: ".api.txt",
256 },
257 {
258 targets: ["sdk", "win_sdk"],
259 dir: "apistubs/android/module-lib/api",
260 dest: "android-non-updatable-removed.txt",
261 tag: ".removed-api.txt",
262 },
263 ],
Anton Hansson7f6823e2020-06-04 15:09:36 +0100264}
Anton Hansson81969c22020-02-03 20:45:56 +0000265
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900266/////////////////////////////////////////////////////////////////////
Jiyong Park7fb4b182019-12-20 14:35:43 +0900267// android_*_stubs_current modules are the stubs libraries compiled
Anton Hansson1c58ffc2020-11-13 11:44:32 +0000268// from stub sources
Jiyong Park7fb4b182019-12-20 14:35:43 +0900269/////////////////////////////////////////////////////////////////////
270
Anton Hansson66035932021-04-09 10:12:45 +0100271modules_public_stubs = [
272 "android.net.ipsec.ike.stubs",
273 "art.module.public.api.stubs",
274 "conscrypt.module.public.api.stubs",
275 "framework-connectivity.stubs",
276 "framework-media.stubs",
277 "framework-mediaprovider.stubs",
278 "framework-permission.stubs",
279 "framework-sdkextensions.stubs",
280 "framework-statsd.stubs",
281 "framework-tethering.stubs",
282 "framework-wifi.stubs",
283 "i18n.module.public.api.stubs",
284]
285
286modules_system_stubs = [
287 "android.net.ipsec.ike.stubs.system",
288 "art.module.public.api.stubs", // Only has public stubs
289 "conscrypt.module.public.api.stubs", // Only has public stubs
290 "framework-connectivity.stubs.system",
291 "framework-media.stubs.system",
292 "framework-mediaprovider.stubs.system",
293 "framework-permission.stubs.system",
294 "framework-sdkextensions.stubs.system",
295 "framework-statsd.stubs.system",
296 "framework-tethering.stubs.system",
297 "framework-wifi.stubs.system",
298 "i18n.module.public.api.stubs", // Only has public stubs
299]
300
Jiyong Park7fb4b182019-12-20 14:35:43 +0900301java_defaults {
Anton Hanssona4748cd2021-04-09 10:16:19 +0100302 name: "android-non-updatable_defaults_stubs_current",
303 libs: ["stub-annotations"],
304 static_libs: ["framework-res-package-jar"], // Export package of framework-res
Jiyong Park7fb4b182019-12-20 14:35:43 +0900305 errorprone: {
306 javacflags: [
307 "-XepDisableAllChecks",
308 ],
309 },
Anton Hanssonfbd32f32020-04-09 14:16:37 +0100310 sdk_version: "none",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900311 system_modules: "none",
312 java_version: "1.8",
313 compile_dex: true,
314}
315
Anton Hanssona4748cd2021-04-09 10:16:19 +0100316java_library_static {
317 name: "android-non-updatable.stubs",
318 defaults: ["android-non-updatable_defaults_stubs_current"],
319 srcs: [":api-stubs-docs-non-updatable"],
320 libs: modules_public_stubs,
321}
322
323java_library_static {
324 name: "android-non-updatable.stubs.system",
325 defaults: ["android-non-updatable_defaults_stubs_current"],
326 srcs: [ ":system-api-stubs-docs-non-updatable" ],
327 libs: modules_system_stubs,
328}
329
330java_library_static {
331 name: "android-non-updatable.stubs.module_lib",
332 defaults: ["android-non-updatable_defaults_stubs_current"],
333 srcs: [":module-lib-api-stubs-docs-non-updatable"],
334 libs: [
335 "sdk_system_current_android",
336 // NOTE: The below can be removed once the prebuilt stub contains IKE.
337 "sdk_system_current_android.net.ipsec.ike",
338 ],
339}
340
341java_library_static {
342 name: "android-non-updatable.stubs.test",
343 defaults: ["android-non-updatable_defaults_stubs_current"],
344 srcs: [":test-api-stubs-docs-non-updatable"],
345 libs: modules_system_stubs,
346}
347
348java_defaults {
349 name: "android_defaults_stubs_current",
350 static_libs: ["art-notices-for-framework-stubs-jar"], // License notices from art module
351 sdk_version: "none",
352 system_modules: "none",
353 java_version: "1.8",
354 compile_dex: true,
355}
356
Anton Hanssona9205502020-07-15 13:36:34 +0100357java_defaults {
358 name: "android_stubs_dists_default",
359 dist: {
360 targets: ["sdk", "win_sdk"],
361 tag: ".jar",
362 dest: "android.jar",
363 },
364}
365
Jiyong Park7fb4b182019-12-20 14:35:43 +0900366java_library_static {
Anton Hansson3a8e0362020-11-03 19:35:56 +0000367 name: "android_stubs_current",
Anton Hansson66035932021-04-09 10:12:45 +0100368 static_libs: modules_public_stubs + [
Anton Hanssona4748cd2021-04-09 10:16:19 +0100369 "android-non-updatable.stubs",
Anton Hansson33ea9992020-04-09 14:16:37 +0100370 "private-stub-annotations-jar",
Anton Hansson912622f2020-04-09 14:16:37 +0100371 ],
Anton Hanssonc3002e52020-11-18 18:23:55 +0000372 defaults: ["android_defaults_stubs_current"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900373}
374
375java_library_static {
Anton Hansson3a8e0362020-11-03 19:35:56 +0000376 name: "android_system_stubs_current",
Anton Hansson66035932021-04-09 10:12:45 +0100377 static_libs: modules_system_stubs + [
Anton Hanssona4748cd2021-04-09 10:16:19 +0100378 "android-non-updatable.stubs.system",
Anton Hansson33ea9992020-04-09 14:16:37 +0100379 "private-stub-annotations-jar",
Anton Hansson912622f2020-04-09 14:16:37 +0100380 ],
Anton Hanssonc3002e52020-11-18 18:23:55 +0000381 defaults: [
382 "android_defaults_stubs_current",
383 "android_stubs_dists_default",
384 ],
385 dist: {
386 dir: "apistubs/android/system",
387 },
388 dists: [
389 {
390 // Legacy dist path
391 targets: ["sdk", "win_sdk"],
392 tag: ".jar",
393 dest: "android_system.jar",
394 },
395 ],
Anton Hansson912622f2020-04-09 14:16:37 +0100396}
397
398java_library_static {
Jiyong Park7fb4b182019-12-20 14:35:43 +0900399 name: "android_test_stubs_current",
Anton Hansson66035932021-04-09 10:12:45 +0100400 // Modules do not have test APIs, but we want to include their SystemApis, like we include
401 // the SystemApi of framework-non-updatable-sources.
402 static_libs: modules_system_stubs + [
Anton Hanssona4748cd2021-04-09 10:16:19 +0100403 "android-non-updatable.stubs.test",
Anton Hansson7110ae72020-10-15 17:23:35 +0100404 "private-stub-annotations-jar",
405 ],
Anton Hanssona9205502020-07-15 13:36:34 +0100406 defaults: [
407 "android_defaults_stubs_current",
408 "android_stubs_dists_default",
409 ],
410 dist: {
411 dir: "apistubs/android/test",
412 },
413 dists: [
414 {
415 // Legacy dist path
416 targets: ["sdk", "win_sdk"],
417 tag: ".jar",
418 dest: "android_test.jar",
419 },
420 ],
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900421}
422
423java_library_static {
Anton Hansson9c4bbe92020-01-30 12:09:02 +0000424 name: "android_module_lib_stubs_current",
Anton Hanssona9205502020-07-15 13:36:34 +0100425 defaults: [
426 "android_defaults_stubs_current",
427 "android_stubs_dists_default",
428 ],
Anton Hanssona4748cd2021-04-09 10:16:19 +0100429 static_libs: [
430 "android-non-updatable.stubs.module_lib",
431 "art.module.public.api.stubs",
Anton Hanssonb7d532e2021-02-05 11:40:25 +0000432 ],
Anton Hanssona9205502020-07-15 13:36:34 +0100433 dist: {
434 dir: "apistubs/android/module-lib",
435 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900436}
437
Jiyong Park7fb4b182019-12-20 14:35:43 +0900438/////////////////////////////////////////////////////////////////////
439// hwbinder.stubs provides APIs required for building HIDL Java
440// libraries.
441/////////////////////////////////////////////////////////////////////
442
443droidstubs {
444 name: "hwbinder-stubs-docs",
445 srcs: [
446 "core/java/android/os/HidlSupport.java",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900447 "core/java/android/os/HidlMemory.java",
448 "core/java/android/os/HwBinder.java",
449 "core/java/android/os/HwBlob.java",
450 "core/java/android/os/HwParcel.java",
451 "core/java/android/os/IHwBinder.java",
452 "core/java/android/os/IHwInterface.java",
453 "core/java/android/os/DeadObjectException.java",
454 "core/java/android/os/DeadSystemException.java",
455 "core/java/android/os/NativeHandle.java",
456 "core/java/android/os/RemoteException.java",
457 "core/java/android/util/AndroidException.java",
458 ],
Colin Cross037d7fb2021-03-25 17:01:55 -0700459 libs: ["framework-annotations-lib"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900460 installable: false,
461 sdk_version: "core_platform",
462 annotations_enabled: true,
Anton Hanssonf68ddea2020-05-02 17:49:26 +0100463 previous_api: ":android.api.public.latest",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900464 merge_annotations_dirs: [
465 "metalava-manual",
466 ],
Anton Hansson81969c22020-02-03 20:45:56 +0000467 args: priv_apps,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900468}
469
470java_library_static {
471 name: "hwbinder.stubs",
472 sdk_version: "core_current",
Colin Cross037d7fb2021-03-25 17:01:55 -0700473 libs: ["framework-annotations-lib"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900474 srcs: [
475 ":hwbinder-stubs-docs",
476 ],
477}