blob: d4db7373504b7fa1cb06fa4902d9ba0c7e1b4e25 [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 {
Jiyong Parke3095162019-12-20 15:30:28 +090044 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",
50 ":core-current-stubs-source",
51 ":core_public_api_files",
52 ":ike-api-srcs",
53 ],
Chen Xu546ce5e2020-01-10 08:38:31 -080054 // TODO(b/147699819): remove below aidl includes.
55 aidl: {
56 local_include_dirs: ["telephony/java"],
57 },
Jiyong Park7fb4b182019-12-20 14:35:43 +090058 libs: ["framework-internal-utils"],
59 installable: false,
60 annotations_enabled: true,
61 previous_api: ":last-released-public-api",
62 merge_annotations_dirs: [
63 "metalava-manual",
64 ],
65 api_levels_annotations_enabled: true,
66 api_levels_annotations_dirs: [
67 "sdk-dir",
68 "api-versions-jars-dir",
69 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +090070 filter_packages: packages_to_document,
71}
72
Jiyong Parke3095162019-12-20 15:30:28 +090073stubs_defaults {
74 name: "metalava-api-stubs-default",
75 defaults: ["metalava-non-updatable-api-stubs-default"],
76 srcs: [":framework-updatable-sources"],
77 sdk_version: "core_platform",
78}
79
Jiyong Park7fb4b182019-12-20 14:35:43 +090080/////////////////////////////////////////////////////////////////////
81// *-api-stubs-docs modules providing source files for the stub libraries
82/////////////////////////////////////////////////////////////////////
83
Jiyong Parke3095162019-12-20 15:30:28 +090084// api-stubs-docs, system-api-stubs-docs, and test-api-stubs-docs have APIs
85// from the non-updatable part of the platform as well as from the updatable
86// modules
Jiyong Park7fb4b182019-12-20 14:35:43 +090087droidstubs {
88 name: "api-stubs-docs",
89 defaults: ["metalava-api-stubs-default"],
90 api_filename: "public_api.txt",
91 private_api_filename: "private.txt",
92 removed_api_filename: "removed.txt",
93 arg_files: [
94 "core/res/AndroidManifest.xml",
95 ],
96 args: metalava_framework_docs_args,
97 check_api: {
98 current: {
99 api_file: "api/current.txt",
100 removed_api_file: "api/removed.txt",
101 },
102 last_released: {
103 api_file: ":last-released-public-api",
104 removed_api_file: "api/removed.txt",
105 baseline_file: ":public-api-incompatibilities-with-last-released",
106 },
107 api_lint: {
108 enabled: true,
109 new_since: ":last-released-public-api",
110 baseline_file: "api/lint-baseline.txt",
111 },
112 },
113 jdiff_enabled: true,
114}
115
Anton Hansson81969c22020-02-03 20:45:56 +0000116priv_apps = " " +
117 "--show-annotation android.annotation.SystemApi\\(" +
118 "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
119 "\\) "
120
121module_libs = " " +
122 " --show-annotation android.annotation.SystemApi\\(" +
123 "client=android.annotation.SystemApi.Client.MODULE_LIBRARIES" +
124 "\\) "
125
Jiyong Park7fb4b182019-12-20 14:35:43 +0900126droidstubs {
127 name: "system-api-stubs-docs",
128 defaults: ["metalava-api-stubs-default"],
129 api_tag_name: "SYSTEM",
130 api_filename: "system-api.txt",
131 private_api_filename: "system-private.txt",
132 private_dex_api_filename: "system-private-dex.txt",
133 removed_api_filename: "system-removed.txt",
134 arg_files: [
135 "core/res/AndroidManifest.xml",
136 ],
Anton Hansson81969c22020-02-03 20:45:56 +0000137 args: metalava_framework_docs_args + priv_apps,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900138 check_api: {
139 current: {
140 api_file: "api/system-current.txt",
141 removed_api_file: "api/system-removed.txt",
142 },
143 last_released: {
144 api_file: ":last-released-system-api",
145 removed_api_file: "api/system-removed.txt",
146 baseline_file: ":system-api-incompatibilities-with-last-released"
147 },
148 api_lint: {
149 enabled: true,
150 new_since: ":last-released-system-api",
151 baseline_file: "api/system-lint-baseline.txt",
152 },
153 },
154 jdiff_enabled: true,
155}
156
157droidstubs {
158 name: "test-api-stubs-docs",
159 defaults: ["metalava-api-stubs-default"],
160 api_tag_name: "TEST",
161 api_filename: "test-api.txt",
162 removed_api_filename: "test-removed.txt",
163 arg_files: [
164 "core/res/AndroidManifest.xml",
165 ],
166 args: metalava_framework_docs_args + " --show-annotation android.annotation.TestApi",
167 check_api: {
168 current: {
169 api_file: "api/test-current.txt",
170 removed_api_file: "api/test-removed.txt",
171 },
172 api_lint: {
173 enabled: true,
174 baseline_file: "api/test-lint-baseline.txt",
175 },
176 },
177}
178
179/////////////////////////////////////////////////////////////////////
Jiyong Parke3095162019-12-20 15:30:28 +0900180// Following droidstubs modules are for extra APIs for modules.
181// The framework currently have two more API surfaces for modules:
182// @SystemApi(client=MODULE_APPS) and @SystemApi(client=MODULE_LIBRARIES)
183/////////////////////////////////////////////////////////////////////
184
Anton Hansson81969c22020-02-03 20:45:56 +0000185// TODO(b/146727827) remove the *-api module when we can teach metalava
Jiyong Parke3095162019-12-20 15:30:28 +0900186// about the relationship among the API surfaces. Currently, these modules are only to generate
187// the API signature files and ensure that the APIs evolve in a backwards compatible manner.
188// They however are NOT used for building the API stub.
Jiyong Parke3095162019-12-20 15:30:28 +0900189
190droidstubs {
191 name: "module-lib-api",
Anton Hansson970c0532020-01-17 13:42:43 +0000192 defaults: ["metalava-api-stubs-default"],
Jiyong Parke3095162019-12-20 15:30:28 +0900193 libs: ["framework-all"],
194 arg_files: ["core/res/AndroidManifest.xml"],
Anton Hansson81969c22020-02-03 20:45:56 +0000195 args: metalava_framework_docs_args + module_libs,
Jiyong Parke3095162019-12-20 15:30:28 +0900196 check_api: {
197 current: {
198 api_file: "api/module-lib-current.txt",
199 removed_api_file: "api/module-lib-removed.txt",
200 },
201 // TODO(b/147559833) enable the compatibility check against the last release API
202 // and the API lint
203 //last_released: {
204 // api_file: ":last-released-module-lib-api",
205 // removed_api_file: "api/module-lib-removed.txt",
206 // baseline_file: ":module-lib-api-incompatibilities-with-last-released"
207 //},
208 //api_lint: {
209 // enabled: true,
210 // new_since: ":last-released-module-lib-api",
211 // baseline_file: "api/module-lib-lint-baseline.txt",
212 //},
213 },
214 //jdiff_enabled: true,
215}
216
Anton Hansson81969c22020-02-03 20:45:56 +0000217
218// The following droidstub module generates source files for the API stub library for
219// modules. Note that it not only includes its own APIs but also other APIs that have
220// narrower scope (all @SystemApis, not just the ones with 'client=MODULE_LIBRARIES').
Jiyong Parke3095162019-12-20 15:30:28 +0900221
222droidstubs {
223 name: "module-lib-api-stubs-docs",
Anton Hansson970c0532020-01-17 13:42:43 +0000224 defaults: ["metalava-api-stubs-default"],
Jiyong Parke3095162019-12-20 15:30:28 +0900225 libs: ["framework-all"],
226 arg_files: ["core/res/AndroidManifest.xml"],
Anton Hansson81969c22020-02-03 20:45:56 +0000227 args: metalava_framework_docs_args + priv_apps + module_libs,
Jiyong Parke3095162019-12-20 15:30:28 +0900228}
229
230/////////////////////////////////////////////////////////////////////
Jiyong Park7fb4b182019-12-20 14:35:43 +0900231// android_*_stubs_current modules are the stubs libraries compiled
232// from *-api-stubs-docs
233/////////////////////////////////////////////////////////////////////
234
235java_defaults {
236 name: "framework-stubs-default",
237 errorprone: {
238 javacflags: [
239 "-XepDisableAllChecks",
240 ],
241 },
242 java_resources: [
243 ":notices-for-framework-stubs",
244 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900245 system_modules: "none",
246 java_version: "1.8",
247 compile_dex: true,
248}
249
250java_library_static {
251 name: "android_stubs_current",
252 srcs: [
253 ":api-stubs-docs",
254 ],
255 libs: [
256 "stub-annotations",
257 ],
258 static_libs: [
259 "private-stub-annotations-jar",
260 ],
261 defaults: ["framework-stubs-default"],
Jiyong Parke3095162019-12-20 15:30:28 +0900262 sdk_version: "core_current",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900263}
264
265java_library_static {
266 name: "android_system_stubs_current",
267 srcs: [
268 ":system-api-stubs-docs",
269 ],
270 libs: [
271 "stub-annotations",
272 ],
273 static_libs: [
274 "private-stub-annotations-jar",
275 ],
276 defaults: ["framework-stubs-default"],
Jiyong Parke3095162019-12-20 15:30:28 +0900277 sdk_version: "core_current",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900278}
279
280java_library_static {
281 name: "android_test_stubs_current",
282 srcs: [
283 ":test-api-stubs-docs",
284 ],
285 libs: [
286 "stub-annotations",
287 ],
288 static_libs: [
289 "private-stub-annotations-jar",
290 ],
291 defaults: ["framework-stubs-default"],
Jiyong Parke3095162019-12-20 15:30:28 +0900292 sdk_version: "core_current",
293}
294
295java_library_static {
Anton Hansson1b9cf092020-01-30 12:09:02 +0000296 name: "android_module_lib_stubs_current",
Jiyong Parke3095162019-12-20 15:30:28 +0900297 srcs: [
298 ":module-lib-api-stubs-docs",
299 ],
300 libs: [
301 "stub-annotations",
302 "framework-all",
303 ],
304 static_libs: [
305 "private-stub-annotations-jar",
306 ],
307 defaults: ["framework-stubs-default"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900308}
309
Jiyong Park7fb4b182019-12-20 14:35:43 +0900310/////////////////////////////////////////////////////////////////////
311// hwbinder.stubs provides APIs required for building HIDL Java
312// libraries.
313/////////////////////////////////////////////////////////////////////
314
315droidstubs {
316 name: "hwbinder-stubs-docs",
317 srcs: [
318 "core/java/android/os/HidlSupport.java",
319 "core/java/android/annotation/IntDef.java",
320 "core/java/android/annotation/IntRange.java",
321 "core/java/android/annotation/NonNull.java",
322 "core/java/android/annotation/SystemApi.java",
323 "core/java/android/os/HidlMemory.java",
324 "core/java/android/os/HwBinder.java",
325 "core/java/android/os/HwBlob.java",
326 "core/java/android/os/HwParcel.java",
327 "core/java/android/os/IHwBinder.java",
328 "core/java/android/os/IHwInterface.java",
329 "core/java/android/os/DeadObjectException.java",
330 "core/java/android/os/DeadSystemException.java",
331 "core/java/android/os/NativeHandle.java",
332 "core/java/android/os/RemoteException.java",
333 "core/java/android/util/AndroidException.java",
334 ],
335 installable: false,
336 sdk_version: "core_platform",
337 annotations_enabled: true,
338 previous_api: ":last-released-public-api",
339 merge_annotations_dirs: [
340 "metalava-manual",
341 ],
Anton Hansson81969c22020-02-03 20:45:56 +0000342 args: priv_apps,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900343}
344
345java_library_static {
346 name: "hwbinder.stubs",
347 sdk_version: "core_current",
348 srcs: [
349 ":hwbinder-stubs-docs",
350 ],
351}
352
353/////////////////////////////////////////////////////////////////////
354// Stubs for hiddenapi processing.
355/////////////////////////////////////////////////////////////////////
356
357droidstubs {
358 name: "hiddenapi-lists-docs",
359 defaults: ["metalava-api-stubs-default"],
360 arg_files: [
361 "core/res/AndroidManifest.xml",
362 ],
363 dex_api_filename: "public-dex.txt",
364 private_dex_api_filename: "private-dex.txt",
365 removed_dex_api_filename: "removed-dex.txt",
366 args: metalava_framework_docs_args +
367 " --show-unannotated " +
Anton Hansson81969c22020-02-03 20:45:56 +0000368 priv_apps +
Jiyong Park7fb4b182019-12-20 14:35:43 +0900369 " --show-annotation android.annotation.TestApi ",
370}
371
372droidstubs {
373 name: "hiddenapi-mappings",
374 defaults: ["metalava-api-stubs-default"],
375 srcs: [
376 ":opt-telephony-common-srcs",
377 ],
378
379 arg_files: [
380 "core/res/AndroidManifest.xml",
381 ],
382 dex_mapping_filename: "dex-mapping.txt",
383 args: metalava_framework_docs_args +
384 " --hide ReferencesHidden " +
385 " --hide UnhiddenSystemApi " +
386 " --show-unannotated " +
Anton Hansson81969c22020-02-03 20:45:56 +0000387 priv_apps +
Jiyong Park7fb4b182019-12-20 14:35:43 +0900388 " --show-annotation android.annotation.TestApi ",
389}
390
391/////////////////////////////////////////////////////////////////////
392// api/*-current.txt files for use by modules in other directories
393// like the CTS test
394/////////////////////////////////////////////////////////////////////
395
396filegroup {
397 name: "frameworks-base-api-current.txt",
398 srcs: [
399 "api/current.txt",
400 ],
401}
402
403filegroup {
404 name: "frameworks-base-api-system-current.txt",
405 srcs: [
406 "api/system-current.txt",
407 ],
408}
409
410filegroup {
411 name: "frameworks-base-api-system-removed.txt",
412 srcs: [
413 "api/system-removed.txt",
414 ],
415}