blob: bb13eaacfa90aa2eb0df97c8428ce47b8e43cfe4 [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//
19// The metalava conversion is done by droidstub modules *-api-stubs-docs.
20// The javac compilation is done by java_library modules android_*_stubs_current.
21// The metalava conversion is also responsible for creating API signature files
22// and comparing them against the last API signature in api/*-current.txt files
23// and also against the latest frozen API signature in prebuilts/sdk/*/*/api/android.txt
24// files.
25
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 Hansson537564e2020-03-06 17:16:06 +000044 name: "metalava-base-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 Duffin5c89e702020-03-26 15:33:48 +000050 ":art-module-public-api-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 ],
54 libs: ["framework-internal-utils"],
55 installable: false,
56 annotations_enabled: true,
Anton Hanssonf68ddea2020-05-02 17:49:26 +010057 previous_api: ":android.api.public.latest",
Jiyong Park7fb4b182019-12-20 14:35:43 +090058 merge_annotations_dirs: [
59 "metalava-manual",
60 ],
Aurimas Liutikas94bac9c2020-03-12 17:06:12 -070061 api_levels_annotations_enabled: false,
Jiyong Park7fb4b182019-12-20 14:35:43 +090062 filter_packages: packages_to_document,
63}
64
Jiyong Park2e6cdcc2019-12-20 15:30:28 +090065stubs_defaults {
Anton Hansson537564e2020-03-06 17:16:06 +000066 name: "metalava-full-api-stubs-default",
67 defaults: ["metalava-base-api-stubs-default"],
Anton Hanssone01390c2020-05-07 12:06:00 +010068 srcs: [
Paul Duffine55d4e32020-05-14 17:55:46 +010069 ":conscrypt.module.public.api{.public.stubs.source}",
Anton Hanssone01390c2020-05-07 12:06:00 +010070 ":framework-updatable-sources",
71 ],
Jiyong Park2e6cdcc2019-12-20 15:30:28 +090072 sdk_version: "core_platform",
73}
74
Anton Hansson537564e2020-03-06 17:16:06 +000075stubs_defaults {
76 name: "metalava-non-updatable-api-stubs-default",
77 defaults: ["metalava-base-api-stubs-default"],
Anton Hanssone53bec02020-03-20 09:12:52 +000078 sdk_version: "core_platform",
Anton Hanssonebb26a32020-04-14 16:35:36 +010079 // There are a few classes from modules used as type arguments that
80 // need to be resolved by metalava. For now, we can use a previously
81 // finalized stub library to resolve them. If a new class gets added,
82 // this may be need to be revisited to use a manually maintained stub
83 // library with empty classes in order to resolve those references.
84 libs: ["sdk_system_29_android"],
85 aidl: {
86 local_include_dirs: [
87 "media/apex/java",
88 "wifi/aidl-export",
89 ],
90 },
Anton Hansson537564e2020-03-06 17:16:06 +000091}
92
Jiyong Park7fb4b182019-12-20 14:35:43 +090093/////////////////////////////////////////////////////////////////////
94// *-api-stubs-docs modules providing source files for the stub libraries
95/////////////////////////////////////////////////////////////////////
96
Jiyong Park2e6cdcc2019-12-20 15:30:28 +090097// api-stubs-docs, system-api-stubs-docs, and test-api-stubs-docs have APIs
98// from the non-updatable part of the platform as well as from the updatable
99// modules
Jiyong Park7fb4b182019-12-20 14:35:43 +0900100droidstubs {
101 name: "api-stubs-docs",
Anton Hansson537564e2020-03-06 17:16:06 +0000102 defaults: ["metalava-full-api-stubs-default"],
Artur Satayev0a97d5e2020-03-25 16:45:56 +0000103 removed_dex_api_filename: "removed-dex.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900104 arg_files: [
105 "core/res/AndroidManifest.xml",
106 ],
107 args: metalava_framework_docs_args,
108 check_api: {
109 current: {
110 api_file: "api/current.txt",
111 removed_api_file: "api/removed.txt",
112 },
113 last_released: {
Anton Hanssonf68ddea2020-05-02 17:49:26 +0100114 api_file: ":android.api.public.latest",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900115 removed_api_file: "api/removed.txt",
116 baseline_file: ":public-api-incompatibilities-with-last-released",
117 },
118 api_lint: {
119 enabled: true,
Anton Hanssonf68ddea2020-05-02 17:49:26 +0100120 new_since: ":android.api.public.latest",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900121 baseline_file: "api/lint-baseline.txt",
122 },
123 },
Anton Hanssonba367d32020-03-23 18:08:55 +0000124 dist: {
125 targets: ["sdk", "win_sdk"],
126 dir: "apistubs/android/public/api",
127 dest: "android.txt",
128 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900129 jdiff_enabled: true,
130}
131
Anton Hansson7f6823e2020-06-04 15:09:36 +0100132droidstubs {
133 name: "api-stubs-docs-non-updatable",
134 defaults: ["metalava-non-updatable-api-stubs-default"],
135 arg_files: ["core/res/AndroidManifest.xml"],
136 args: metalava_framework_docs_args,
137 check_api: {
138 current: {
139 api_file: "non-updatable-api/current.txt",
140 removed_api_file: "non-updatable-api/removed.txt",
141 },
142 },
143}
144
Anton Hansson81969c22020-02-03 20:45:56 +0000145priv_apps = " " +
146 "--show-annotation android.annotation.SystemApi\\(" +
147 "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
148 "\\) "
149
150module_libs = " " +
151 " --show-annotation android.annotation.SystemApi\\(" +
152 "client=android.annotation.SystemApi.Client.MODULE_LIBRARIES" +
153 "\\) "
154
Jiyong Park7fb4b182019-12-20 14:35:43 +0900155droidstubs {
156 name: "system-api-stubs-docs",
Anton Hansson537564e2020-03-06 17:16:06 +0000157 defaults: ["metalava-full-api-stubs-default"],
Artur Satayev0a97d5e2020-03-25 16:45:56 +0000158 removed_dex_api_filename: "system-removed-dex.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900159 arg_files: [
160 "core/res/AndroidManifest.xml",
161 ],
Anton Hansson81969c22020-02-03 20:45:56 +0000162 args: metalava_framework_docs_args + priv_apps,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900163 check_api: {
164 current: {
165 api_file: "api/system-current.txt",
166 removed_api_file: "api/system-removed.txt",
167 },
168 last_released: {
Anton Hanssonf68ddea2020-05-02 17:49:26 +0100169 api_file: ":android.api.system.latest",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900170 removed_api_file: "api/system-removed.txt",
171 baseline_file: ":system-api-incompatibilities-with-last-released"
172 },
173 api_lint: {
174 enabled: true,
Anton Hanssonf68ddea2020-05-02 17:49:26 +0100175 new_since: ":android.api.system.latest",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900176 baseline_file: "api/system-lint-baseline.txt",
177 },
178 },
Anton Hanssonba367d32020-03-23 18:08:55 +0000179 dist: {
180 targets: ["sdk", "win_sdk"],
181 dir: "apistubs/android/system/api",
182 dest: "android.txt",
183 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900184 jdiff_enabled: true,
185}
186
187droidstubs {
Anton Hansson7f6823e2020-06-04 15:09:36 +0100188 name: "system-api-stubs-docs-non-updatable",
189 defaults: ["metalava-non-updatable-api-stubs-default"],
190 arg_files: ["core/res/AndroidManifest.xml"],
191 args: metalava_framework_docs_args + priv_apps,
192 check_api: {
193 current: {
194 api_file: "non-updatable-api/system-current.txt",
195 removed_api_file: "non-updatable-api/system-removed.txt",
196 },
197 },
198}
199
200droidstubs {
Jiyong Park7fb4b182019-12-20 14:35:43 +0900201 name: "test-api-stubs-docs",
Anton Hansson537564e2020-03-06 17:16:06 +0000202 defaults: ["metalava-full-api-stubs-default"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900203 arg_files: [
204 "core/res/AndroidManifest.xml",
205 ],
206 args: metalava_framework_docs_args + " --show-annotation android.annotation.TestApi",
207 check_api: {
208 current: {
209 api_file: "api/test-current.txt",
210 removed_api_file: "api/test-removed.txt",
211 },
212 api_lint: {
213 enabled: true,
214 baseline_file: "api/test-lint-baseline.txt",
215 },
216 },
Anton Hanssonba367d32020-03-23 18:08:55 +0000217 dist: {
218 targets: ["sdk", "win_sdk"],
219 dir: "apistubs/android/test/api",
220 dest: "android.txt",
221 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900222}
223
224/////////////////////////////////////////////////////////////////////
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900225// Following droidstubs modules are for extra APIs for modules.
226// The framework currently have two more API surfaces for modules:
227// @SystemApi(client=MODULE_APPS) and @SystemApi(client=MODULE_LIBRARIES)
228/////////////////////////////////////////////////////////////////////
229
Anton Hansson81969c22020-02-03 20:45:56 +0000230// TODO(b/146727827) remove the *-api module when we can teach metalava
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900231// about the relationship among the API surfaces. Currently, these modules are only to generate
232// the API signature files and ensure that the APIs evolve in a backwards compatible manner.
233// They however are NOT used for building the API stub.
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900234
235droidstubs {
236 name: "module-lib-api",
Anton Hansson537564e2020-03-06 17:16:06 +0000237 defaults: ["metalava-full-api-stubs-default"],
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900238 arg_files: ["core/res/AndroidManifest.xml"],
Anton Hansson81969c22020-02-03 20:45:56 +0000239 args: metalava_framework_docs_args + module_libs,
Paul Duffin4c5dc182020-04-08 18:28:15 +0100240
241 // Do not generate stubs as they are not needed
242 generate_stubs: false,
243
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900244 check_api: {
245 current: {
246 api_file: "api/module-lib-current.txt",
247 removed_api_file: "api/module-lib-removed.txt",
248 },
Anton Hansson626afea2020-02-11 14:36:40 +0000249 last_released: {
Anton Hanssonf68ddea2020-05-02 17:49:26 +0100250 api_file: ":android.api.module-lib.latest",
Anton Hansson626afea2020-02-11 14:36:40 +0000251 removed_api_file: "api/module-lib-removed.txt",
252 baseline_file: ":module-lib-api-incompatibilities-with-last-released"
253 },
254 api_lint: {
255 enabled: true,
Anton Hanssonf68ddea2020-05-02 17:49:26 +0100256 new_since: ":android.api.module-lib.latest",
Anton Hansson626afea2020-02-11 14:36:40 +0000257 baseline_file: "api/module-lib-lint-baseline.txt",
258 },
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900259 },
Anton Hanssonba367d32020-03-23 18:08:55 +0000260 dist: {
261 targets: ["sdk", "win_sdk"],
262 dir: "apistubs/android/module-lib/api",
263 dest: "android.txt",
264 },
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900265}
266
Anton Hansson7f6823e2020-06-04 15:09:36 +0100267droidstubs {
268 name: "module-lib-api-stubs-docs-non-updatable",
269 defaults: ["metalava-non-updatable-api-stubs-default"],
270 arg_files: ["core/res/AndroidManifest.xml"],
271 args: metalava_framework_docs_args + module_libs,
272 check_api: {
273 current: {
274 api_file: "non-updatable-api/module-lib-current.txt",
275 removed_api_file: "non-updatable-api/module-lib-removed.txt",
276 },
277 },
278}
Anton Hansson81969c22020-02-03 20:45:56 +0000279
280// The following droidstub module generates source files for the API stub library for
281// modules. Note that it not only includes its own APIs but also other APIs that have
282// narrower scope (all @SystemApis, not just the ones with 'client=MODULE_LIBRARIES').
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900283
284droidstubs {
285 name: "module-lib-api-stubs-docs",
Anton Hansson537564e2020-03-06 17:16:06 +0000286 defaults: ["metalava-non-updatable-api-stubs-default"],
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900287 arg_files: ["core/res/AndroidManifest.xml"],
Anton Hansson81969c22020-02-03 20:45:56 +0000288 args: metalava_framework_docs_args + priv_apps + module_libs,
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900289}
290
291/////////////////////////////////////////////////////////////////////
Jiyong Park7fb4b182019-12-20 14:35:43 +0900292// android_*_stubs_current modules are the stubs libraries compiled
293// from *-api-stubs-docs
294/////////////////////////////////////////////////////////////////////
295
296java_defaults {
Anton Hanssonfbd32f32020-04-09 14:16:37 +0100297 name: "android_defaults_stubs_current",
Anton Hansson42afd612020-02-08 20:43:19 +0000298 libs: [ "stub-annotations" ],
Paul Duffina281e922020-03-25 10:13:33 +0000299 static_libs: [
300 "private-stub-annotations-jar",
301
302 // License notices from art module
303 "art-notices-for-framework-stubs-jar",
304 ],
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
316java_library_static {
317 name: "android_stubs_current",
Anton Hansson42afd612020-02-08 20:43:19 +0000318 srcs: [ ":api-stubs-docs" ],
Anton Hanssonfbd32f32020-04-09 14:16:37 +0100319 defaults: ["android_defaults_stubs_current"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900320}
321
322java_library_static {
323 name: "android_system_stubs_current",
Anton Hansson42afd612020-02-08 20:43:19 +0000324 srcs: [ ":system-api-stubs-docs" ],
Anton Hanssonfbd32f32020-04-09 14:16:37 +0100325 defaults: ["android_defaults_stubs_current"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900326}
327
328java_library_static {
329 name: "android_test_stubs_current",
Anton Hansson42afd612020-02-08 20:43:19 +0000330 srcs: [ ":test-api-stubs-docs" ],
Anton Hanssonfbd32f32020-04-09 14:16:37 +0100331 defaults: ["android_defaults_stubs_current"],
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900332}
333
334java_library_static {
Anton Hansson9c4bbe92020-01-30 12:09:02 +0000335 name: "android_module_lib_stubs_current",
Anton Hansson42afd612020-02-08 20:43:19 +0000336 srcs: [ ":module-lib-api-stubs-docs" ],
Anton Hanssonfbd32f32020-04-09 14:16:37 +0100337 defaults: ["android_defaults_stubs_current"],
Anton Hanssonebb26a32020-04-14 16:35:36 +0100338 libs: ["sdk_system_29_android"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900339}
340
Anton Hansson7f6823e2020-06-04 15:09:36 +0100341java_library_static {
342 name: "android_non_updatable_stubs_current",
343 srcs: [":api-stubs-docs-non-updatable"],
344 defaults: ["android_defaults_stubs_current"],
345 libs: ["sdk_system_29_android"],
346}
347
348java_library_static {
349 name: "android_system_non_updatable_stubs_current",
350 srcs: [":system-api-stubs-docs-non-updatable"],
351 defaults: ["android_defaults_stubs_current"],
352 libs: ["sdk_system_29_android"],
353}
354
Jiyong Park7fb4b182019-12-20 14:35:43 +0900355/////////////////////////////////////////////////////////////////////
356// hwbinder.stubs provides APIs required for building HIDL Java
357// libraries.
358/////////////////////////////////////////////////////////////////////
359
360droidstubs {
361 name: "hwbinder-stubs-docs",
362 srcs: [
363 "core/java/android/os/HidlSupport.java",
364 "core/java/android/annotation/IntDef.java",
365 "core/java/android/annotation/IntRange.java",
366 "core/java/android/annotation/NonNull.java",
367 "core/java/android/annotation/SystemApi.java",
368 "core/java/android/os/HidlMemory.java",
369 "core/java/android/os/HwBinder.java",
370 "core/java/android/os/HwBlob.java",
371 "core/java/android/os/HwParcel.java",
372 "core/java/android/os/IHwBinder.java",
373 "core/java/android/os/IHwInterface.java",
374 "core/java/android/os/DeadObjectException.java",
375 "core/java/android/os/DeadSystemException.java",
376 "core/java/android/os/NativeHandle.java",
377 "core/java/android/os/RemoteException.java",
378 "core/java/android/util/AndroidException.java",
379 ],
380 installable: false,
381 sdk_version: "core_platform",
382 annotations_enabled: true,
Anton Hanssonf68ddea2020-05-02 17:49:26 +0100383 previous_api: ":android.api.public.latest",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900384 merge_annotations_dirs: [
385 "metalava-manual",
386 ],
Anton Hansson81969c22020-02-03 20:45:56 +0000387 args: priv_apps,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900388}
389
390java_library_static {
391 name: "hwbinder.stubs",
392 sdk_version: "core_current",
393 srcs: [
394 ":hwbinder-stubs-docs",
395 ],
396}
397
398/////////////////////////////////////////////////////////////////////
Jiyong Park7fb4b182019-12-20 14:35:43 +0900399// api/*-current.txt files for use by modules in other directories
400// like the CTS test
401/////////////////////////////////////////////////////////////////////
402
403filegroup {
404 name: "frameworks-base-api-current.txt",
405 srcs: [
406 "api/current.txt",
407 ],
408}
409
410filegroup {
411 name: "frameworks-base-api-system-current.txt",
412 srcs: [
413 "api/system-current.txt",
414 ],
415}
416
417filegroup {
418 name: "frameworks-base-api-system-removed.txt",
419 srcs: [
420 "api/system-removed.txt",
421 ],
422}