blob: a83cb4d8db3db67de397b9b19fc45aa5687d889f [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 Hansson2feb3f12020-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 Hansson2feb3f12020-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 Hansson2feb3f12020-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 Hansson2feb3f12020-11-13 11:44:32 +000049 arg_files: ["core/res/AndroidManifest.xml"],
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -070050 // TODO(b/147699819, b/169090544): remove below aidl includes.
Chen Xu546ce5e2020-01-10 08:38:31 -080051 aidl: {
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -070052 local_include_dirs: [
Anton Hansson2feb3f12020-11-13 11:44:32 +000053 "apex/media/aidl/stable",
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -070054 "media/aidl",
Remi NGUYEN VAN9f223cb2021-01-28 13:37:03 +090055 // TODO: move to include-dirs for packages/modules/Connectivity when this moves out of
56 // frameworks/base
57 "packages/Connectivity/framework/aidl-export",
Anton Hansson2feb3f12020-11-13 11:44:32 +000058 "telephony/java",
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -070059 ],
Ytai Ben-Tsvic3cd3cd2020-10-30 12:34:51 -070060 include_dirs: ["frameworks/av/aidl"],
Chen Xu546ce5e2020-01-10 08:38:31 -080061 },
Jiyong Parkc0f8a282020-09-29 13:43:00 +090062 // These are libs from framework-internal-utils that are required (i.e. being referenced)
63 // from framework-non-updatable-sources. Add more here when there's a need.
64 // DO NOT add the entire framework-internal-utils. It might cause unnecessary circular
65 // dependencies gets bigger.
66 libs: [
67 "android.hardware.cas-V1.2-java",
68 "android.hardware.health-V1.0-java-constants",
69 "android.hardware.radio-V1.5-java",
Jayachandran Cc4faf842020-08-10 10:58:23 -070070 "android.hardware.radio-V1.6-java",
Jiyong Parkc0f8a282020-09-29 13:43:00 +090071 "android.hardware.thermal-V1.0-java-constants",
72 "android.hardware.thermal-V2.0-java",
73 "android.hardware.tv.input-V1.0-java-constants",
74 "android.hardware.tv.tuner-V1.0-java-constants",
Amy Zhang782aa902020-10-12 13:55:52 -070075 "android.hardware.tv.tuner-V1.1-java-constants",
Jiyong Parkc0f8a282020-09-29 13:43:00 +090076 "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 Hanssonce21e282021-02-05 11:38:30 +000082 // There are a few classes from modules used by the core that
83 // need to be resolved by metalava. We use a prebuilt stub of the
84 // full sdk to ensure we can resolve them. If a new class gets added,
85 // the prebuilts/sdk/current needs to be updated.
86 "sdk_system_current_android",
Anton Hanssonb7d532e2021-02-05 11:40:25 +000087 // NOTE: The below can be removed once the prebuilt stub contains IKE.
88 "sdk_system_current_android.net.ipsec.ike",
Jiyong Parkc0f8a282020-09-29 13:43:00 +090089 ],
Anton Hansson35146892020-10-26 10:27:57 +000090 high_mem: true, // Lots of sources => high memory use, see b/170701554
Jiyong Park7fb4b182019-12-20 14:35:43 +090091 installable: false,
92 annotations_enabled: true,
Anton Hansson48ee95e2020-05-02 17:49:26 +010093 previous_api: ":android.api.public.latest",
Jiyong Park7fb4b182019-12-20 14:35:43 +090094 merge_annotations_dirs: [
95 "metalava-manual",
96 ],
Aurimas Liutikas94bac9c2020-03-12 17:06:12 -070097 api_levels_annotations_enabled: false,
Jiyong Park7fb4b182019-12-20 14:35:43 +090098 filter_packages: packages_to_document,
99}
100
101/////////////////////////////////////////////////////////////////////
Anton Hansson51861e72020-11-13 09:55:29 +0000102// These modules provide source files for the stub libraries
Jiyong Park7fb4b182019-12-20 14:35:43 +0900103/////////////////////////////////////////////////////////////////////
104
Anton Hansson76d3db42020-04-09 14:16:37 +0100105droidstubs {
106 name: "api-stubs-docs-non-updatable",
107 defaults: ["metalava-non-updatable-api-stubs-default"],
Anton Hansson76d3db42020-04-09 14:16:37 +0100108 args: metalava_framework_docs_args,
109 check_api: {
110 current: {
Anton Hansson6cbaff22020-10-29 15:28:19 +0000111 api_file: "core/api/current.txt",
112 removed_api_file: "core/api/removed.txt",
Anton Hansson76d3db42020-04-09 14:16:37 +0100113 },
Anton Hansson37e102e2020-10-05 16:42:40 +0100114 last_released: {
115 api_file: ":android-non-updatable.api.public.latest",
116 removed_api_file: ":android-non-updatable-removed.api.public.latest",
Anton Hanssonce556232021-01-22 16:40:06 +0000117 baseline_file: ":android-incompatibilities.api.public.latest",
Anton Hansson37e102e2020-10-05 16:42:40 +0100118 },
Anton Hansson76d3db42020-04-09 14:16:37 +0100119 api_lint: {
120 enabled: true,
121 new_since: ":android-non-updatable.api.public.latest",
122 },
123 },
Anton Hansson85785fe2021-01-20 20:23:34 +0000124 dists: [
125 {
126 targets: ["sdk", "win_sdk"],
127 dir: "apistubs/android/public/api",
128 dest: "android-non-updatable.txt",
129 tag: ".api.txt",
130 },
131 {
132 targets: ["sdk", "win_sdk"],
133 dir: "apistubs/android/public/api",
134 dest: "android-non-updatable-removed.txt",
135 tag: ".removed-api.txt",
136 },
137 ],
Anton Hansson76d3db42020-04-09 14:16:37 +0100138}
139
Anton Hansson2feb3f12020-11-13 11:44:32 +0000140priv_apps =
Anton Hansson81969c22020-02-03 20:45:56 +0000141 " --show-annotation android.annotation.SystemApi\\(" +
Anton Hansson2feb3f12020-11-13 11:44:32 +0000142 "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
143 "\\)"
144
145priv_apps_in_stubs =
Makoto Onuki41ccbfb2020-07-10 12:05:21 -0700146 " --show-for-stub-purposes-annotation android.annotation.SystemApi\\(" +
147 "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
Anton Hansson2feb3f12020-11-13 11:44:32 +0000148 "\\)"
149
150test = " --show-annotation android.annotation.TestApi"
151
152module_libs =
153 " --show-annotation android.annotation.SystemApi\\(" +
154 "client=android.annotation.SystemApi.Client.MODULE_LIBRARIES" +
155 "\\)"
Anton Hansson81969c22020-02-03 20:45:56 +0000156
Jiyong Park7fb4b182019-12-20 14:35:43 +0900157droidstubs {
Anton Hansson76d3db42020-04-09 14:16:37 +0100158 name: "system-api-stubs-docs-non-updatable",
159 defaults: ["metalava-non-updatable-api-stubs-default"],
Anton Hansson76d3db42020-04-09 14:16:37 +0100160 args: metalava_framework_docs_args + priv_apps,
161 check_api: {
162 current: {
Anton Hansson6cbaff22020-10-29 15:28:19 +0000163 api_file: "core/api/system-current.txt",
164 removed_api_file: "core/api/system-removed.txt",
Anton Hansson76d3db42020-04-09 14:16:37 +0100165 },
Anton Hansson37e102e2020-10-05 16:42:40 +0100166 last_released: {
167 api_file: ":android-non-updatable.api.system.latest",
168 removed_api_file: ":android-non-updatable-removed.api.system.latest",
Anton Hanssonce556232021-01-22 16:40:06 +0000169 baseline_file: ":android-incompatibilities.api.system.latest"
Anton Hansson37e102e2020-10-05 16:42:40 +0100170 },
Anton Hansson76d3db42020-04-09 14:16:37 +0100171 api_lint: {
172 enabled: true,
173 new_since: ":android-non-updatable.api.system.latest",
Anton Hansson6cbaff22020-10-29 15:28:19 +0000174 baseline_file: "core/api/system-lint-baseline.txt",
Anton Hansson76d3db42020-04-09 14:16:37 +0100175 },
176 },
Anton Hansson85785fe2021-01-20 20:23:34 +0000177 dists: [
178 {
179 targets: ["sdk", "win_sdk"],
180 dir: "apistubs/android/system/api",
181 dest: "android-non-updatable.txt",
182 tag: ".api.txt",
183 },
184 {
185 targets: ["sdk", "win_sdk"],
186 dir: "apistubs/android/system/api",
187 dest: "android-non-updatable-removed.txt",
188 tag: ".removed-api.txt",
189 },
190 ],
Anton Hansson76d3db42020-04-09 14:16:37 +0100191}
192
193droidstubs {
Anton Hansson022aac52020-11-05 10:45:13 +0000194 name: "test-api-stubs-docs-non-updatable",
Anton Hansson7ce31c12020-10-15 18:38:49 +0100195 defaults: ["metalava-non-updatable-api-stubs-default"],
Anton Hansson2feb3f12020-11-13 11:44:32 +0000196 args: metalava_framework_docs_args + test + priv_apps_in_stubs,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900197 check_api: {
198 current: {
Anton Hansson022aac52020-11-05 10:45:13 +0000199 api_file: "core/api/test-current.txt",
200 removed_api_file: "core/api/test-removed.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900201 },
202 api_lint: {
203 enabled: true,
Anton Hansson022aac52020-11-05 10:45:13 +0000204 baseline_file: "core/api/test-lint-baseline.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900205 },
206 },
Anton Hansson85785fe2021-01-20 20:23:34 +0000207 dists: [
208 {
209 targets: ["sdk", "win_sdk"],
210 dir: "apistubs/android/test/api",
211 dest: "android.txt",
212 tag: ".api.txt",
213 },
214 {
215 targets: ["sdk", "win_sdk"],
216 dir: "apistubs/android/test/api",
217 dest: "removed.txt",
218 tag: ".removed-api.txt",
219 },
220 {
221 targets: ["sdk", "win_sdk"],
222 dir: "apistubs/android/test/api",
223 dest: "android-non-updatable.txt",
224 tag: ".api.txt",
225 },
226 {
227 targets: ["sdk", "win_sdk"],
228 dir: "apistubs/android/test/api",
229 dest: "android-non-updatable-removed.txt",
230 tag: ".removed-api.txt",
231 },
232 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900233}
234
Jiyong Parke3095162019-12-20 15:30:28 +0900235droidstubs {
Anton Hansson76d3db42020-04-09 14:16:37 +0100236 name: "module-lib-api-stubs-docs-non-updatable",
237 defaults: ["metalava-non-updatable-api-stubs-default"],
Anton Hansson2feb3f12020-11-13 11:44:32 +0000238 args: metalava_framework_docs_args + priv_apps_in_stubs + module_libs,
Anton Hansson76d3db42020-04-09 14:16:37 +0100239 check_api: {
240 current: {
Anton Hansson6cbaff22020-10-29 15:28:19 +0000241 api_file: "core/api/module-lib-current.txt",
242 removed_api_file: "core/api/module-lib-removed.txt",
Anton Hansson76d3db42020-04-09 14:16:37 +0100243 },
Anton Hanssonc3ef1f562020-10-07 14:55:36 +0100244 last_released: {
245 api_file: ":android-non-updatable.api.module-lib.latest",
246 removed_api_file: ":android-non-updatable-removed.api.module-lib.latest",
247 },
Anton Hansson76d3db42020-04-09 14:16:37 +0100248 api_lint: {
249 enabled: true,
250 new_since: ":android-non-updatable.api.module-lib.latest",
251 },
252 },
Anton Hansson85785fe2021-01-20 20:23:34 +0000253 dists: [
254 {
255 targets: ["sdk", "win_sdk"],
256 dir: "apistubs/android/module-lib/api",
257 dest: "android-non-updatable.txt",
258 tag: ".api.txt",
259 },
260 {
261 targets: ["sdk", "win_sdk"],
262 dir: "apistubs/android/module-lib/api",
263 dest: "android-non-updatable-removed.txt",
264 tag: ".removed-api.txt",
265 },
266 ],
Anton Hansson76d3db42020-04-09 14:16:37 +0100267}
Anton Hansson81969c22020-02-03 20:45:56 +0000268
Jiyong Parke3095162019-12-20 15:30:28 +0900269/////////////////////////////////////////////////////////////////////
Jiyong Park7fb4b182019-12-20 14:35:43 +0900270// android_*_stubs_current modules are the stubs libraries compiled
Anton Hansson2feb3f12020-11-13 11:44:32 +0000271// from stub sources
Jiyong Park7fb4b182019-12-20 14:35:43 +0900272/////////////////////////////////////////////////////////////////////
273
Anton Hansson33b9b852021-04-09 10:12:45 +0100274modules_public_stubs = [
275 "android.net.ipsec.ike.stubs",
276 "art.module.public.api.stubs",
277 "conscrypt.module.public.api.stubs",
278 "framework-appsearch.stubs",
279 "framework-connectivity.stubs",
280 "framework-graphics.stubs",
281 "framework-media.stubs",
282 "framework-mediaprovider.stubs",
283 "framework-permission.stubs",
284 "framework-permission-s.stubs",
285 "framework-scheduling.stubs",
286 "framework-sdkextensions.stubs",
287 "framework-statsd.stubs",
288 "framework-tethering.stubs",
289 "framework-wifi.stubs",
290 "i18n.module.public.api.stubs",
291]
292
293modules_system_stubs = [
294 "android.net.ipsec.ike.stubs.system",
295 "art.module.public.api.stubs", // Only has public stubs
296 "conscrypt.module.public.api.stubs", // Only has public stubs
297 "framework-appsearch.stubs.system",
298 "framework-connectivity.stubs.system",
299 "framework-graphics.stubs.system",
300 "framework-media.stubs.system",
301 "framework-mediaprovider.stubs.system",
302 "framework-permission.stubs.system",
303 "framework-permission-s.stubs.system",
304 "framework-scheduling.stubs.system",
305 "framework-sdkextensions.stubs.system",
306 "framework-statsd.stubs.system",
307 "framework-tethering.stubs.system",
308 "framework-wifi.stubs.system",
309 "i18n.module.public.api.stubs", // Only has public stubs
310]
311
Jiyong Park7fb4b182019-12-20 14:35:43 +0900312java_defaults {
Anton Hanssonfbd32f32020-04-09 14:16:37 +0100313 name: "android_defaults_stubs_current",
Anton Hansson08b48bb2020-02-08 20:43:19 +0000314 libs: [ "stub-annotations" ],
Paul Duffina281e922020-03-25 10:13:33 +0000315 static_libs: [
Paul Duffina281e922020-03-25 10:13:33 +0000316 // License notices from art module
317 "art-notices-for-framework-stubs-jar",
Anton Hanssoncf42e982020-08-13 19:40:13 +0100318 "framework-res-package-jar", // Export package of framework-res
Paul Duffina281e922020-03-25 10:13:33 +0000319 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900320 errorprone: {
321 javacflags: [
322 "-XepDisableAllChecks",
323 ],
324 },
Anton Hanssonfbd32f32020-04-09 14:16:37 +0100325 sdk_version: "none",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900326 system_modules: "none",
327 java_version: "1.8",
328 compile_dex: true,
329}
330
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000331java_defaults {
332 name: "android_stubs_dists_default",
333 dist: {
334 targets: ["sdk", "win_sdk"],
335 tag: ".jar",
336 dest: "android.jar",
337 },
338}
339
Jiyong Park7fb4b182019-12-20 14:35:43 +0900340java_library_static {
Anton Hansson65aa6ea2020-11-03 19:35:56 +0000341 name: "android_stubs_current",
Anton Hansson76d3db42020-04-09 14:16:37 +0100342 srcs: [ ":api-stubs-docs-non-updatable" ],
Anton Hansson33b9b852021-04-09 10:12:45 +0100343 static_libs: modules_public_stubs + [
Anton Hanssonbf63f942020-05-20 12:06:23 +0100344 "private-stub-annotations-jar",
Anton Hansson76d3db42020-04-09 14:16:37 +0100345 ],
Anton Hanssonc3002e52020-11-18 18:23:55 +0000346 defaults: ["android_defaults_stubs_current"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900347}
348
349java_library_static {
Anton Hansson65aa6ea2020-11-03 19:35:56 +0000350 name: "android_system_stubs_current",
Anton Hansson76d3db42020-04-09 14:16:37 +0100351 srcs: [ ":system-api-stubs-docs-non-updatable" ],
Anton Hansson33b9b852021-04-09 10:12:45 +0100352 static_libs: modules_system_stubs + [
Anton Hanssonbf63f942020-05-20 12:06:23 +0100353 "private-stub-annotations-jar",
Anton Hansson76d3db42020-04-09 14:16:37 +0100354 ],
Anton Hanssonc3002e52020-11-18 18:23:55 +0000355 defaults: [
356 "android_defaults_stubs_current",
357 "android_stubs_dists_default",
358 ],
359 dist: {
360 dir: "apistubs/android/system",
361 },
362 dists: [
363 {
364 // Legacy dist path
365 targets: ["sdk", "win_sdk"],
366 tag: ".jar",
367 dest: "android_system.jar",
368 },
369 ],
Anton Hansson76d3db42020-04-09 14:16:37 +0100370}
371
372java_library_static {
Jiyong Park7fb4b182019-12-20 14:35:43 +0900373 name: "android_test_stubs_current",
Anton Hansson022aac52020-11-05 10:45:13 +0000374 srcs: [ ":test-api-stubs-docs-non-updatable" ],
Anton Hansson33b9b852021-04-09 10:12:45 +0100375 // Modules do not have test APIs, but we want to include their SystemApis, like we include
376 // the SystemApi of framework-non-updatable-sources.
377 static_libs: modules_system_stubs + [
Anton Hansson7ce31c12020-10-15 18:38:49 +0100378 "private-stub-annotations-jar",
379 ],
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000380 defaults: [
381 "android_defaults_stubs_current",
382 "android_stubs_dists_default",
383 ],
384 dist: {
385 dir: "apistubs/android/test",
386 },
387 dists: [
388 {
389 // Legacy dist path
390 targets: ["sdk", "win_sdk"],
391 tag: ".jar",
392 dest: "android_test.jar",
393 },
394 ],
Jiyong Parke3095162019-12-20 15:30:28 +0900395}
396
397java_library_static {
Anton Hansson1b9cf092020-01-30 12:09:02 +0000398 name: "android_module_lib_stubs_current",
Makoto Onukif4a486e2020-07-15 10:38:04 -0700399 srcs: [ ":module-lib-api-stubs-docs-non-updatable" ],
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000400 defaults: [
401 "android_defaults_stubs_current",
402 "android_stubs_dists_default",
403 ],
Anton Hanssonb7d532e2021-02-05 11:40:25 +0000404 libs: [
405 "sdk_system_current_android",
406 // NOTE: The below can be removed once the prebuilt stub contains IKE.
407 "sdk_system_current_android.net.ipsec.ike",
408 ],
Anton Hanssonfc948d862020-12-17 16:57:35 +0000409 static_libs: ["art.module.public.api.stubs"],
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000410 dist: {
411 dir: "apistubs/android/module-lib",
412 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900413}
414
Jiyong Park7fb4b182019-12-20 14:35:43 +0900415/////////////////////////////////////////////////////////////////////
416// hwbinder.stubs provides APIs required for building HIDL Java
417// libraries.
418/////////////////////////////////////////////////////////////////////
419
420droidstubs {
421 name: "hwbinder-stubs-docs",
422 srcs: [
423 "core/java/android/os/HidlSupport.java",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900424 "core/java/android/os/HidlMemory.java",
425 "core/java/android/os/HwBinder.java",
426 "core/java/android/os/HwBlob.java",
427 "core/java/android/os/HwParcel.java",
428 "core/java/android/os/IHwBinder.java",
429 "core/java/android/os/IHwInterface.java",
430 "core/java/android/os/DeadObjectException.java",
431 "core/java/android/os/DeadSystemException.java",
432 "core/java/android/os/NativeHandle.java",
433 "core/java/android/os/RemoteException.java",
434 "core/java/android/util/AndroidException.java",
435 ],
Colin Cross037d7fb2021-03-25 17:01:55 -0700436 libs: ["framework-annotations-lib"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900437 installable: false,
438 sdk_version: "core_platform",
439 annotations_enabled: true,
Anton Hansson48ee95e2020-05-02 17:49:26 +0100440 previous_api: ":android.api.public.latest",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900441 merge_annotations_dirs: [
442 "metalava-manual",
443 ],
Anton Hansson81969c22020-02-03 20:45:56 +0000444 args: priv_apps,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900445}
446
447java_library_static {
448 name: "hwbinder.stubs",
449 sdk_version: "core_current",
Colin Cross037d7fb2021-03-25 17:01:55 -0700450 libs: ["framework-annotations-lib"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900451 srcs: [
452 ":hwbinder-stubs-docs",
453 ],
454}