blob: 12ee889387ec38587ff68170a2bf5814b6d60b7f [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",
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}",
Ramy Medhataaa83862020-05-04 05:54:30 -040051 "**/package.html",
Jiyong Park7fb4b182019-12-20 14:35:43 +090052 ],
Anton Hansson2feb3f12020-11-13 11:44:32 +000053 sdk_version: "core_platform",
54 arg_files: ["core/res/AndroidManifest.xml"],
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -070055 // TODO(b/147699819, b/169090544): remove below aidl includes.
Chen Xu546ce5e2020-01-10 08:38:31 -080056 aidl: {
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -070057 local_include_dirs: [
Anton Hansson2feb3f12020-11-13 11:44:32 +000058 "apex/media/aidl/stable",
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -070059 "media/aidl",
Anton Hansson2feb3f12020-11-13 11:44:32 +000060 "telephony/java",
Ytai Ben-Tsvida7c21e2020-09-16 13:04:31 -070061 ],
Ytai Ben-Tsvic3cd3cd2020-10-30 12:34:51 -070062 include_dirs: ["frameworks/av/aidl"],
Chen Xu546ce5e2020-01-10 08:38:31 -080063 },
Jiyong Parkc0f8a282020-09-29 13:43:00 +090064 // These are libs from framework-internal-utils that are required (i.e. being referenced)
65 // from framework-non-updatable-sources. Add more here when there's a need.
66 // DO NOT add the entire framework-internal-utils. It might cause unnecessary circular
67 // dependencies gets bigger.
68 libs: [
69 "android.hardware.cas-V1.2-java",
70 "android.hardware.health-V1.0-java-constants",
71 "android.hardware.radio-V1.5-java",
Jayachandran Cc4faf842020-08-10 10:58:23 -070072 "android.hardware.radio-V1.6-java",
Jiyong Parkc0f8a282020-09-29 13:43:00 +090073 "android.hardware.thermal-V1.0-java-constants",
74 "android.hardware.thermal-V2.0-java",
75 "android.hardware.tv.input-V1.0-java-constants",
76 "android.hardware.tv.tuner-V1.0-java-constants",
Amy Zhang782aa902020-10-12 13:55:52 -070077 "android.hardware.tv.tuner-V1.1-java-constants",
Jiyong Parkc0f8a282020-09-29 13:43:00 +090078 "android.hardware.usb-V1.0-java-constants",
79 "android.hardware.usb-V1.1-java-constants",
80 "android.hardware.usb.gadget-V1.0-java",
81 "android.hardware.vibrator-V1.3-java",
82 "framework-protos",
Anton Hansson2feb3f12020-11-13 11:44:32 +000083 // There are a few classes from modules used as type arguments that
84 // need to be resolved by metalava. For now, we can use a previously
85 // finalized stub library to resolve them. If a new class gets added,
86 // this may be need to be revisited to use a manually maintained stub
87 // library with empty classes in order to resolve those references.
88 "sdk_system_30_android",
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",
117 baseline_file: ":public-api-incompatibilities-with-last-released",
118 },
Anton Hansson76d3db42020-04-09 14:16:37 +0100119 api_lint: {
120 enabled: true,
121 new_since: ":android-non-updatable.api.public.latest",
122 },
123 },
124}
125
Anton Hansson2feb3f12020-11-13 11:44:32 +0000126priv_apps =
Anton Hansson81969c22020-02-03 20:45:56 +0000127 " --show-annotation android.annotation.SystemApi\\(" +
Anton Hansson2feb3f12020-11-13 11:44:32 +0000128 "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
129 "\\)"
130
131priv_apps_in_stubs =
Makoto Onuki41ccbfb2020-07-10 12:05:21 -0700132 " --show-for-stub-purposes-annotation android.annotation.SystemApi\\(" +
133 "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
Anton Hansson2feb3f12020-11-13 11:44:32 +0000134 "\\)"
135
136test = " --show-annotation android.annotation.TestApi"
137
138module_libs =
139 " --show-annotation android.annotation.SystemApi\\(" +
140 "client=android.annotation.SystemApi.Client.MODULE_LIBRARIES" +
141 "\\)"
Anton Hansson81969c22020-02-03 20:45:56 +0000142
Jiyong Park7fb4b182019-12-20 14:35:43 +0900143droidstubs {
Anton Hansson76d3db42020-04-09 14:16:37 +0100144 name: "system-api-stubs-docs-non-updatable",
145 defaults: ["metalava-non-updatable-api-stubs-default"],
Anton Hansson76d3db42020-04-09 14:16:37 +0100146 args: metalava_framework_docs_args + priv_apps,
147 check_api: {
148 current: {
Anton Hansson6cbaff22020-10-29 15:28:19 +0000149 api_file: "core/api/system-current.txt",
150 removed_api_file: "core/api/system-removed.txt",
Anton Hansson76d3db42020-04-09 14:16:37 +0100151 },
Anton Hansson37e102e2020-10-05 16:42:40 +0100152 last_released: {
153 api_file: ":android-non-updatable.api.system.latest",
154 removed_api_file: ":android-non-updatable-removed.api.system.latest",
155 baseline_file: ":system-api-incompatibilities-with-last-released"
156 },
Anton Hansson76d3db42020-04-09 14:16:37 +0100157 api_lint: {
158 enabled: true,
159 new_since: ":android-non-updatable.api.system.latest",
Anton Hansson6cbaff22020-10-29 15:28:19 +0000160 baseline_file: "core/api/system-lint-baseline.txt",
Anton Hansson76d3db42020-04-09 14:16:37 +0100161 },
162 },
163}
164
165droidstubs {
Anton Hansson022aac52020-11-05 10:45:13 +0000166 name: "test-api-stubs-docs-non-updatable",
Anton Hansson7ce31c12020-10-15 18:38:49 +0100167 defaults: ["metalava-non-updatable-api-stubs-default"],
Anton Hansson2feb3f12020-11-13 11:44:32 +0000168 args: metalava_framework_docs_args + test + priv_apps_in_stubs,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900169 check_api: {
170 current: {
Anton Hansson022aac52020-11-05 10:45:13 +0000171 api_file: "core/api/test-current.txt",
172 removed_api_file: "core/api/test-removed.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900173 },
174 api_lint: {
175 enabled: true,
Anton Hansson022aac52020-11-05 10:45:13 +0000176 baseline_file: "core/api/test-lint-baseline.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900177 },
178 },
Anton Hanssond9a3fee2020-03-23 18:08:55 +0000179 dist: {
180 targets: ["sdk", "win_sdk"],
181 dir: "apistubs/android/test/api",
182 dest: "android.txt",
183 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900184}
185
Jiyong Parke3095162019-12-20 15:30:28 +0900186droidstubs {
Anton Hansson76d3db42020-04-09 14:16:37 +0100187 name: "module-lib-api-stubs-docs-non-updatable",
188 defaults: ["metalava-non-updatable-api-stubs-default"],
Anton Hansson2feb3f12020-11-13 11:44:32 +0000189 args: metalava_framework_docs_args + priv_apps_in_stubs + module_libs,
Anton Hansson76d3db42020-04-09 14:16:37 +0100190 check_api: {
191 current: {
Anton Hansson6cbaff22020-10-29 15:28:19 +0000192 api_file: "core/api/module-lib-current.txt",
193 removed_api_file: "core/api/module-lib-removed.txt",
Anton Hansson76d3db42020-04-09 14:16:37 +0100194 },
Anton Hanssonc3ef1f562020-10-07 14:55:36 +0100195 last_released: {
196 api_file: ":android-non-updatable.api.module-lib.latest",
197 removed_api_file: ":android-non-updatable-removed.api.module-lib.latest",
198 },
Anton Hansson76d3db42020-04-09 14:16:37 +0100199 api_lint: {
200 enabled: true,
201 new_since: ":android-non-updatable.api.module-lib.latest",
202 },
203 },
204}
Anton Hansson81969c22020-02-03 20:45:56 +0000205
Jiyong Parke3095162019-12-20 15:30:28 +0900206/////////////////////////////////////////////////////////////////////
Jiyong Park7fb4b182019-12-20 14:35:43 +0900207// android_*_stubs_current modules are the stubs libraries compiled
Anton Hansson2feb3f12020-11-13 11:44:32 +0000208// from stub sources
Jiyong Park7fb4b182019-12-20 14:35:43 +0900209/////////////////////////////////////////////////////////////////////
210
211java_defaults {
Anton Hanssonfbd32f32020-04-09 14:16:37 +0100212 name: "android_defaults_stubs_current",
Anton Hansson08b48bb2020-02-08 20:43:19 +0000213 libs: [ "stub-annotations" ],
Paul Duffina281e922020-03-25 10:13:33 +0000214 static_libs: [
Paul Duffina281e922020-03-25 10:13:33 +0000215 // License notices from art module
216 "art-notices-for-framework-stubs-jar",
Anton Hanssoncf42e982020-08-13 19:40:13 +0100217 "framework-res-package-jar", // Export package of framework-res
Paul Duffina281e922020-03-25 10:13:33 +0000218 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900219 errorprone: {
220 javacflags: [
221 "-XepDisableAllChecks",
222 ],
223 },
Anton Hanssonfbd32f32020-04-09 14:16:37 +0100224 sdk_version: "none",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900225 system_modules: "none",
226 java_version: "1.8",
227 compile_dex: true,
228}
229
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000230java_defaults {
231 name: "android_stubs_dists_default",
232 dist: {
233 targets: ["sdk", "win_sdk"],
234 tag: ".jar",
235 dest: "android.jar",
236 },
237}
238
Jiyong Park7fb4b182019-12-20 14:35:43 +0900239java_library_static {
Anton Hansson65aa6ea2020-11-03 19:35:56 +0000240 name: "android_stubs_current",
Anton Hansson76d3db42020-04-09 14:16:37 +0100241 srcs: [ ":api-stubs-docs-non-updatable" ],
242 static_libs: [
243 "conscrypt.module.public.api.stubs",
Anton Hanssond74139e2020-10-08 14:59:17 +0100244 "framework-appsearch.stubs",
Paul Duffin4e006622020-05-31 16:55:13 +0100245 "framework-graphics.stubs",
Paul Duffin8b864fb2020-05-31 11:35:50 +0100246 "framework-media.stubs",
247 "framework-mediaprovider.stubs",
248 "framework-permission.stubs",
249 "framework-sdkextensions.stubs",
250 "framework-statsd.stubs",
251 "framework-tethering.stubs",
252 "framework-wifi.stubs",
Paul Duffin5a4e8f22020-11-25 15:45:43 +0000253 "i18n.module.public.api.stubs",
Anton Hanssonbf63f942020-05-20 12:06:23 +0100254 "private-stub-annotations-jar",
Anton Hansson76d3db42020-04-09 14:16:37 +0100255 ],
Anton Hanssonc3002e52020-11-18 18:23:55 +0000256 defaults: ["android_defaults_stubs_current"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900257}
258
259java_library_static {
Anton Hansson65aa6ea2020-11-03 19:35:56 +0000260 name: "android_system_stubs_current",
Anton Hansson76d3db42020-04-09 14:16:37 +0100261 srcs: [ ":system-api-stubs-docs-non-updatable" ],
262 static_libs: [
263 "conscrypt.module.public.api.stubs",
Anton Hansson25a0a2b2020-10-08 13:43:48 +0100264 "framework-appsearch.stubs.system",
Paul Duffin4e006622020-05-31 16:55:13 +0100265 "framework-graphics.stubs.system",
Paul Duffin8b864fb2020-05-31 11:35:50 +0100266 "framework-media.stubs.system",
267 "framework-mediaprovider.stubs.system",
268 "framework-permission.stubs.system",
269 "framework-sdkextensions.stubs.system",
270 "framework-statsd.stubs.system",
271 "framework-tethering.stubs.system",
272 "framework-wifi.stubs.system",
Paul Duffin5a4e8f22020-11-25 15:45:43 +0000273 "i18n.module.public.api.stubs",
Anton Hanssonbf63f942020-05-20 12:06:23 +0100274 "private-stub-annotations-jar",
Anton Hansson76d3db42020-04-09 14:16:37 +0100275 ],
Anton Hanssonc3002e52020-11-18 18:23:55 +0000276 defaults: [
277 "android_defaults_stubs_current",
278 "android_stubs_dists_default",
279 ],
280 dist: {
281 dir: "apistubs/android/system",
282 },
283 dists: [
284 {
285 // Legacy dist path
286 targets: ["sdk", "win_sdk"],
287 tag: ".jar",
288 dest: "android_system.jar",
289 },
290 ],
Anton Hansson76d3db42020-04-09 14:16:37 +0100291}
292
293java_library_static {
Jiyong Park7fb4b182019-12-20 14:35:43 +0900294 name: "android_test_stubs_current",
Anton Hansson022aac52020-11-05 10:45:13 +0000295 srcs: [ ":test-api-stubs-docs-non-updatable" ],
Anton Hansson7ce31c12020-10-15 18:38:49 +0100296 static_libs: [
297 // Modules do not have test APIs, but we want to include their SystemApis, like we include
298 // the SystemApi of framework-non-updatable-sources.
299 "conscrypt.module.public.api.stubs",
300 "framework-appsearch.stubs.system",
301 "framework-graphics.stubs.system",
302 "framework-media.stubs.system",
303 "framework-mediaprovider.stubs.system",
304 "framework-permission.stubs.system",
305 "framework-sdkextensions.stubs.system",
306 "framework-statsd.stubs.system",
307 "framework-tethering.stubs.system",
308 "framework-wifi.stubs.system",
Paul Duffin5a4e8f22020-11-25 15:45:43 +0000309 "i18n.module.public.api.stubs",
Anton Hansson7ce31c12020-10-15 18:38:49 +0100310 "private-stub-annotations-jar",
311 ],
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000312 defaults: [
313 "android_defaults_stubs_current",
314 "android_stubs_dists_default",
315 ],
316 dist: {
317 dir: "apistubs/android/test",
318 },
319 dists: [
320 {
321 // Legacy dist path
322 targets: ["sdk", "win_sdk"],
323 tag: ".jar",
324 dest: "android_test.jar",
325 },
326 ],
Jiyong Parke3095162019-12-20 15:30:28 +0900327}
328
329java_library_static {
Anton Hansson1b9cf092020-01-30 12:09:02 +0000330 name: "android_module_lib_stubs_current",
Makoto Onukif4a486e2020-07-15 10:38:04 -0700331 srcs: [ ":module-lib-api-stubs-docs-non-updatable" ],
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000332 defaults: [
333 "android_defaults_stubs_current",
334 "android_stubs_dists_default",
335 ],
Anton Hansson394febc2020-04-14 16:35:36 +0100336 libs: ["sdk_system_29_android"],
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000337 dist: {
338 dir: "apistubs/android/module-lib",
339 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900340}
341
Anton Hansson76d3db42020-04-09 14:16:37 +0100342java_library_static {
343 name: "android_non_updatable_stubs_current",
344 srcs: [":api-stubs-docs-non-updatable"],
345 defaults: ["android_defaults_stubs_current"],
346 libs: ["sdk_system_29_android"],
347}
348
349java_library_static {
350 name: "android_system_non_updatable_stubs_current",
351 srcs: [":system-api-stubs-docs-non-updatable"],
352 defaults: ["android_defaults_stubs_current"],
353 libs: ["sdk_system_29_android"],
354}
355
Jiyong Park7fb4b182019-12-20 14:35:43 +0900356/////////////////////////////////////////////////////////////////////
357// hwbinder.stubs provides APIs required for building HIDL Java
358// libraries.
359/////////////////////////////////////////////////////////////////////
360
361droidstubs {
362 name: "hwbinder-stubs-docs",
363 srcs: [
364 "core/java/android/os/HidlSupport.java",
365 "core/java/android/annotation/IntDef.java",
366 "core/java/android/annotation/IntRange.java",
367 "core/java/android/annotation/NonNull.java",
368 "core/java/android/annotation/SystemApi.java",
369 "core/java/android/os/HidlMemory.java",
370 "core/java/android/os/HwBinder.java",
371 "core/java/android/os/HwBlob.java",
372 "core/java/android/os/HwParcel.java",
373 "core/java/android/os/IHwBinder.java",
374 "core/java/android/os/IHwInterface.java",
375 "core/java/android/os/DeadObjectException.java",
376 "core/java/android/os/DeadSystemException.java",
377 "core/java/android/os/NativeHandle.java",
378 "core/java/android/os/RemoteException.java",
379 "core/java/android/util/AndroidException.java",
380 ],
381 installable: false,
382 sdk_version: "core_platform",
383 annotations_enabled: true,
Anton Hansson48ee95e2020-05-02 17:49:26 +0100384 previous_api: ":android.api.public.latest",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900385 merge_annotations_dirs: [
386 "metalava-manual",
387 ],
Anton Hansson81969c22020-02-03 20:45:56 +0000388 args: priv_apps,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900389}
390
391java_library_static {
392 name: "hwbinder.stubs",
393 sdk_version: "core_current",
394 srcs: [
395 ":hwbinder-stubs-docs",
396 ],
397}