blob: 90bac37b944e2bc2cec6f473e459c6007216d985 [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",
Paul Duffin404b26a2020-09-16 14:26:47 +010050 ":art.module.public.api{.public.stubs.source}",
Paul Duffin5c89e702020-03-26 15:33:48 +000051 ":android_icu4j_public_api_files",
Ramy Medhataaa83862020-05-04 05:54:30 -040052 "**/package.html",
Jiyong Park7fb4b182019-12-20 14:35:43 +090053 ],
Anton Hansson1c58ffc2020-11-13 11:44:32 +000054 sdk_version: "core_platform",
55 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",
71 "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",
75 "android.hardware.usb-V1.0-java-constants",
76 "android.hardware.usb-V1.1-java-constants",
77 "android.hardware.usb.gadget-V1.0-java",
78 "android.hardware.vibrator-V1.3-java",
79 "framework-protos",
Anton Hansson1c58ffc2020-11-13 11:44:32 +000080 // There are a few classes from modules used as type arguments that
81 // need to be resolved by metalava. For now, we can use a previously
82 // finalized stub library to resolve them. If a new class gets added,
83 // this may be need to be revisited to use a manually maintained stub
84 // library with empty classes in order to resolve those references.
85 "sdk_system_30_android",
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",
114 baseline_file: ":public-api-incompatibilities-with-last-released",
115 },
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 },
121}
122
Anton Hansson1c58ffc2020-11-13 11:44:32 +0000123priv_apps =
Anton Hansson81969c22020-02-03 20:45:56 +0000124 " --show-annotation android.annotation.SystemApi\\(" +
Anton Hansson1c58ffc2020-11-13 11:44:32 +0000125 "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
126 "\\)"
127
128priv_apps_in_stubs =
Makoto Onukia13287f2020-07-10 12:05:21 -0700129 " --show-for-stub-purposes-annotation android.annotation.SystemApi\\(" +
130 "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
Anton Hansson1c58ffc2020-11-13 11:44:32 +0000131 "\\)"
132
133test = " --show-annotation android.annotation.TestApi"
134
135module_libs =
136 " --show-annotation android.annotation.SystemApi\\(" +
137 "client=android.annotation.SystemApi.Client.MODULE_LIBRARIES" +
138 "\\)"
Anton Hansson81969c22020-02-03 20:45:56 +0000139
Jiyong Park7fb4b182019-12-20 14:35:43 +0900140droidstubs {
Anton Hansson7f6823e2020-06-04 15:09:36 +0100141 name: "system-api-stubs-docs-non-updatable",
142 defaults: ["metalava-non-updatable-api-stubs-default"],
Anton Hansson7f6823e2020-06-04 15:09:36 +0100143 args: metalava_framework_docs_args + priv_apps,
144 check_api: {
145 current: {
Anton Hansson7bfceb82020-10-29 18:59:10 +0000146 api_file: "core/api/system-current.txt",
147 removed_api_file: "core/api/system-removed.txt",
Anton Hansson7f6823e2020-06-04 15:09:36 +0100148 },
Anton Hansson3258a472020-10-05 16:23:27 +0100149 last_released: {
150 api_file: ":android-non-updatable.api.system.latest",
151 removed_api_file: ":android-non-updatable-removed.api.system.latest",
152 baseline_file: ":system-api-incompatibilities-with-last-released"
153 },
Anton Hansson33ea9992020-04-09 14:16:37 +0100154 api_lint: {
155 enabled: true,
156 new_since: ":android-non-updatable.api.system.latest",
Anton Hansson7bfceb82020-10-29 18:59:10 +0000157 baseline_file: "core/api/system-lint-baseline.txt",
Anton Hansson33ea9992020-04-09 14:16:37 +0100158 },
Anton Hansson7f6823e2020-06-04 15:09:36 +0100159 },
160}
161
162droidstubs {
Anton Hansson552ba2c2020-11-05 10:45:13 +0000163 name: "test-api-stubs-docs-non-updatable",
Anton Hansson7110ae72020-10-15 17:23:35 +0100164 defaults: ["metalava-non-updatable-api-stubs-default"],
Anton Hansson1c58ffc2020-11-13 11:44:32 +0000165 args: metalava_framework_docs_args + test + priv_apps_in_stubs,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900166 check_api: {
167 current: {
Anton Hansson552ba2c2020-11-05 10:45:13 +0000168 api_file: "core/api/test-current.txt",
169 removed_api_file: "core/api/test-removed.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900170 },
171 api_lint: {
172 enabled: true,
Anton Hansson552ba2c2020-11-05 10:45:13 +0000173 baseline_file: "core/api/test-lint-baseline.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900174 },
175 },
Anton Hanssonba367d32020-03-23 18:08:55 +0000176 dist: {
177 targets: ["sdk", "win_sdk"],
178 dir: "apistubs/android/test/api",
179 dest: "android.txt",
180 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900181}
182
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900183droidstubs {
Anton Hansson7f6823e2020-06-04 15:09:36 +0100184 name: "module-lib-api-stubs-docs-non-updatable",
185 defaults: ["metalava-non-updatable-api-stubs-default"],
Anton Hansson1c58ffc2020-11-13 11:44:32 +0000186 args: metalava_framework_docs_args + priv_apps_in_stubs + module_libs,
Anton Hansson7f6823e2020-06-04 15:09:36 +0100187 check_api: {
188 current: {
Anton Hansson7bfceb82020-10-29 18:59:10 +0000189 api_file: "core/api/module-lib-current.txt",
190 removed_api_file: "core/api/module-lib-removed.txt",
Anton Hansson7f6823e2020-06-04 15:09:36 +0100191 },
Anton Hanssonc3ef1f562020-10-07 14:55:36 +0100192 last_released: {
193 api_file: ":android-non-updatable.api.module-lib.latest",
194 removed_api_file: ":android-non-updatable-removed.api.module-lib.latest",
195 },
Anton Hansson33ea9992020-04-09 14:16:37 +0100196 api_lint: {
197 enabled: true,
198 new_since: ":android-non-updatable.api.module-lib.latest",
199 },
Anton Hansson7f6823e2020-06-04 15:09:36 +0100200 },
201}
Anton Hansson81969c22020-02-03 20:45:56 +0000202
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900203/////////////////////////////////////////////////////////////////////
Jiyong Park7fb4b182019-12-20 14:35:43 +0900204// android_*_stubs_current modules are the stubs libraries compiled
Anton Hansson1c58ffc2020-11-13 11:44:32 +0000205// from stub sources
Jiyong Park7fb4b182019-12-20 14:35:43 +0900206/////////////////////////////////////////////////////////////////////
207
208java_defaults {
Anton Hanssonfbd32f32020-04-09 14:16:37 +0100209 name: "android_defaults_stubs_current",
Anton Hansson42afd612020-02-08 20:43:19 +0000210 libs: [ "stub-annotations" ],
Paul Duffina281e922020-03-25 10:13:33 +0000211 static_libs: [
Paul Duffina281e922020-03-25 10:13:33 +0000212 // License notices from art module
213 "art-notices-for-framework-stubs-jar",
Anton Hanssoncf42e982020-08-13 19:40:13 +0100214 "framework-res-package-jar", // Export package of framework-res
Paul Duffina281e922020-03-25 10:13:33 +0000215 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900216 errorprone: {
217 javacflags: [
218 "-XepDisableAllChecks",
219 ],
220 },
Anton Hanssonfbd32f32020-04-09 14:16:37 +0100221 sdk_version: "none",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900222 system_modules: "none",
223 java_version: "1.8",
224 compile_dex: true,
225}
226
Anton Hanssona9205502020-07-15 13:36:34 +0100227java_defaults {
228 name: "android_stubs_dists_default",
229 dist: {
230 targets: ["sdk", "win_sdk"],
231 tag: ".jar",
232 dest: "android.jar",
233 },
234}
235
Jiyong Park7fb4b182019-12-20 14:35:43 +0900236java_library_static {
Anton Hansson3a8e0362020-11-03 19:35:56 +0000237 name: "android_stubs_current",
Anton Hansson912622f2020-04-09 14:16:37 +0100238 srcs: [ ":api-stubs-docs-non-updatable" ],
239 static_libs: [
240 "conscrypt.module.public.api.stubs",
Paul Duffinabebc6a2020-05-31 11:35:50 +0100241 "framework-media.stubs",
242 "framework-mediaprovider.stubs",
243 "framework-permission.stubs",
Anton Hansson912622f2020-04-09 14:16:37 +0100244 "framework-sdkextensions.stubs",
Paul Duffinabebc6a2020-05-31 11:35:50 +0100245 "framework-statsd.stubs",
Anton Hansson912622f2020-04-09 14:16:37 +0100246 "framework-tethering.stubs",
Paul Duffinabebc6a2020-05-31 11:35:50 +0100247 "framework-wifi.stubs",
Anton Hansson33ea9992020-04-09 14:16:37 +0100248 "private-stub-annotations-jar",
Anton Hansson912622f2020-04-09 14:16:37 +0100249 ],
Anton Hanssonc3002e52020-11-18 18:23:55 +0000250 defaults: ["android_defaults_stubs_current"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900251}
252
253java_library_static {
Anton Hansson3a8e0362020-11-03 19:35:56 +0000254 name: "android_system_stubs_current",
Anton Hansson912622f2020-04-09 14:16:37 +0100255 srcs: [ ":system-api-stubs-docs-non-updatable" ],
256 static_libs: [
257 "conscrypt.module.public.api.stubs",
Paul Duffinabebc6a2020-05-31 11:35:50 +0100258 "framework-media.stubs.system",
259 "framework-mediaprovider.stubs.system",
260 "framework-permission.stubs.system",
Anton Hansson912622f2020-04-09 14:16:37 +0100261 "framework-sdkextensions.stubs.system",
Paul Duffinabebc6a2020-05-31 11:35:50 +0100262 "framework-statsd.stubs.system",
Anton Hansson912622f2020-04-09 14:16:37 +0100263 "framework-tethering.stubs.system",
Paul Duffinabebc6a2020-05-31 11:35:50 +0100264 "framework-wifi.stubs.system",
Anton Hansson33ea9992020-04-09 14:16:37 +0100265 "private-stub-annotations-jar",
Anton Hansson912622f2020-04-09 14:16:37 +0100266 ],
Anton Hanssonc3002e52020-11-18 18:23:55 +0000267 defaults: [
268 "android_defaults_stubs_current",
269 "android_stubs_dists_default",
270 ],
271 dist: {
272 dir: "apistubs/android/system",
273 },
274 dists: [
275 {
276 // Legacy dist path
277 targets: ["sdk", "win_sdk"],
278 tag: ".jar",
279 dest: "android_system.jar",
280 },
281 ],
Anton Hansson912622f2020-04-09 14:16:37 +0100282}
283
284java_library_static {
Jiyong Park7fb4b182019-12-20 14:35:43 +0900285 name: "android_test_stubs_current",
Anton Hansson552ba2c2020-11-05 10:45:13 +0000286 srcs: [ ":test-api-stubs-docs-non-updatable" ],
Anton Hansson7110ae72020-10-15 17:23:35 +0100287 static_libs: [
288 // Modules do not have test APIs, but we want to include their SystemApis, like we include
289 // the SystemApi of framework-non-updatable-sources.
290 "conscrypt.module.public.api.stubs",
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 "private-stub-annotations-jar",
299 ],
Anton Hanssona9205502020-07-15 13:36:34 +0100300 defaults: [
301 "android_defaults_stubs_current",
302 "android_stubs_dists_default",
303 ],
304 dist: {
305 dir: "apistubs/android/test",
306 },
307 dists: [
308 {
309 // Legacy dist path
310 targets: ["sdk", "win_sdk"],
311 tag: ".jar",
312 dest: "android_test.jar",
313 },
314 ],
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900315}
316
317java_library_static {
Anton Hansson9c4bbe92020-01-30 12:09:02 +0000318 name: "android_module_lib_stubs_current",
Makoto Onuki8c61de62020-07-15 10:38:04 -0700319 srcs: [ ":module-lib-api-stubs-docs-non-updatable" ],
Anton Hanssona9205502020-07-15 13:36:34 +0100320 defaults: [
321 "android_defaults_stubs_current",
322 "android_stubs_dists_default",
323 ],
Anton Hanssonebb26a32020-04-14 16:35:36 +0100324 libs: ["sdk_system_29_android"],
Anton Hanssona9205502020-07-15 13:36:34 +0100325 dist: {
326 dir: "apistubs/android/module-lib",
327 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900328}
329
Anton Hansson7f6823e2020-06-04 15:09:36 +0100330java_library_static {
331 name: "android_non_updatable_stubs_current",
332 srcs: [":api-stubs-docs-non-updatable"],
333 defaults: ["android_defaults_stubs_current"],
334 libs: ["sdk_system_29_android"],
335}
336
337java_library_static {
338 name: "android_system_non_updatable_stubs_current",
339 srcs: [":system-api-stubs-docs-non-updatable"],
340 defaults: ["android_defaults_stubs_current"],
341 libs: ["sdk_system_29_android"],
342}
343
Jiyong Park7fb4b182019-12-20 14:35:43 +0900344/////////////////////////////////////////////////////////////////////
345// hwbinder.stubs provides APIs required for building HIDL Java
346// libraries.
347/////////////////////////////////////////////////////////////////////
348
349droidstubs {
350 name: "hwbinder-stubs-docs",
351 srcs: [
352 "core/java/android/os/HidlSupport.java",
353 "core/java/android/annotation/IntDef.java",
354 "core/java/android/annotation/IntRange.java",
355 "core/java/android/annotation/NonNull.java",
356 "core/java/android/annotation/SystemApi.java",
357 "core/java/android/os/HidlMemory.java",
358 "core/java/android/os/HwBinder.java",
359 "core/java/android/os/HwBlob.java",
360 "core/java/android/os/HwParcel.java",
361 "core/java/android/os/IHwBinder.java",
362 "core/java/android/os/IHwInterface.java",
363 "core/java/android/os/DeadObjectException.java",
364 "core/java/android/os/DeadSystemException.java",
365 "core/java/android/os/NativeHandle.java",
366 "core/java/android/os/RemoteException.java",
367 "core/java/android/util/AndroidException.java",
368 ],
369 installable: false,
370 sdk_version: "core_platform",
371 annotations_enabled: true,
Anton Hanssonf68ddea2020-05-02 17:49:26 +0100372 previous_api: ":android.api.public.latest",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900373 merge_annotations_dirs: [
374 "metalava-manual",
375 ],
Anton Hansson81969c22020-02-03 20:45:56 +0000376 args: priv_apps,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900377}
378
379java_library_static {
380 name: "hwbinder.stubs",
381 sdk_version: "core_current",
382 srcs: [
383 ":hwbinder-stubs-docs",
384 ],
385}