blob: 9b9311f6c3c2438341caf4603d345386100323a4 [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 arg_files: ["core/res/AndroidManifest.xml"],
Anton Hansson81969c22020-02-03 20:45:56 +0000194 args: metalava_framework_docs_args + module_libs,
Jiyong Parke3095162019-12-20 15:30:28 +0900195 check_api: {
196 current: {
197 api_file: "api/module-lib-current.txt",
198 removed_api_file: "api/module-lib-removed.txt",
199 },
200 // TODO(b/147559833) enable the compatibility check against the last release API
201 // and the API lint
202 //last_released: {
203 // api_file: ":last-released-module-lib-api",
204 // removed_api_file: "api/module-lib-removed.txt",
205 // baseline_file: ":module-lib-api-incompatibilities-with-last-released"
206 //},
207 //api_lint: {
208 // enabled: true,
209 // new_since: ":last-released-module-lib-api",
210 // baseline_file: "api/module-lib-lint-baseline.txt",
211 //},
212 },
213 //jdiff_enabled: true,
214}
215
Anton Hansson81969c22020-02-03 20:45:56 +0000216
217// The following droidstub module generates source files for the API stub library for
218// modules. Note that it not only includes its own APIs but also other APIs that have
219// narrower scope (all @SystemApis, not just the ones with 'client=MODULE_LIBRARIES').
Jiyong Parke3095162019-12-20 15:30:28 +0900220
221droidstubs {
222 name: "module-lib-api-stubs-docs",
Anton Hansson970c0532020-01-17 13:42:43 +0000223 defaults: ["metalava-api-stubs-default"],
Jiyong Parke3095162019-12-20 15:30:28 +0900224 arg_files: ["core/res/AndroidManifest.xml"],
Anton Hansson81969c22020-02-03 20:45:56 +0000225 args: metalava_framework_docs_args + priv_apps + module_libs,
Jiyong Parke3095162019-12-20 15:30:28 +0900226}
227
228/////////////////////////////////////////////////////////////////////
Jiyong Park7fb4b182019-12-20 14:35:43 +0900229// android_*_stubs_current modules are the stubs libraries compiled
230// from *-api-stubs-docs
231/////////////////////////////////////////////////////////////////////
232
233java_defaults {
234 name: "framework-stubs-default",
235 errorprone: {
236 javacflags: [
237 "-XepDisableAllChecks",
238 ],
239 },
240 java_resources: [
241 ":notices-for-framework-stubs",
242 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900243 system_modules: "none",
244 java_version: "1.8",
245 compile_dex: true,
246}
247
248java_library_static {
249 name: "android_stubs_current",
250 srcs: [
251 ":api-stubs-docs",
252 ],
253 libs: [
254 "stub-annotations",
255 ],
256 static_libs: [
257 "private-stub-annotations-jar",
258 ],
259 defaults: ["framework-stubs-default"],
Jiyong Parke3095162019-12-20 15:30:28 +0900260 sdk_version: "core_current",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900261}
262
263java_library_static {
264 name: "android_system_stubs_current",
265 srcs: [
266 ":system-api-stubs-docs",
267 ],
268 libs: [
269 "stub-annotations",
270 ],
271 static_libs: [
272 "private-stub-annotations-jar",
273 ],
274 defaults: ["framework-stubs-default"],
Jiyong Parke3095162019-12-20 15:30:28 +0900275 sdk_version: "core_current",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900276}
277
278java_library_static {
279 name: "android_test_stubs_current",
280 srcs: [
281 ":test-api-stubs-docs",
282 ],
283 libs: [
284 "stub-annotations",
285 ],
286 static_libs: [
287 "private-stub-annotations-jar",
288 ],
289 defaults: ["framework-stubs-default"],
Jiyong Parke3095162019-12-20 15:30:28 +0900290 sdk_version: "core_current",
291}
292
293java_library_static {
Anton Hansson1b9cf092020-01-30 12:09:02 +0000294 name: "android_module_lib_stubs_current",
Jiyong Parke3095162019-12-20 15:30:28 +0900295 srcs: [
296 ":module-lib-api-stubs-docs",
297 ],
298 libs: [
299 "stub-annotations",
Jiyong Parke3095162019-12-20 15:30:28 +0900300 ],
301 static_libs: [
302 "private-stub-annotations-jar",
303 ],
304 defaults: ["framework-stubs-default"],
Anton Hansson2e2008b2020-02-08 20:39:59 +0000305 sdk_version: "core_current",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900306}
307
Jiyong Park7fb4b182019-12-20 14:35:43 +0900308/////////////////////////////////////////////////////////////////////
309// hwbinder.stubs provides APIs required for building HIDL Java
310// libraries.
311/////////////////////////////////////////////////////////////////////
312
313droidstubs {
314 name: "hwbinder-stubs-docs",
315 srcs: [
316 "core/java/android/os/HidlSupport.java",
317 "core/java/android/annotation/IntDef.java",
318 "core/java/android/annotation/IntRange.java",
319 "core/java/android/annotation/NonNull.java",
320 "core/java/android/annotation/SystemApi.java",
321 "core/java/android/os/HidlMemory.java",
322 "core/java/android/os/HwBinder.java",
323 "core/java/android/os/HwBlob.java",
324 "core/java/android/os/HwParcel.java",
325 "core/java/android/os/IHwBinder.java",
326 "core/java/android/os/IHwInterface.java",
327 "core/java/android/os/DeadObjectException.java",
328 "core/java/android/os/DeadSystemException.java",
329 "core/java/android/os/NativeHandle.java",
330 "core/java/android/os/RemoteException.java",
331 "core/java/android/util/AndroidException.java",
332 ],
333 installable: false,
334 sdk_version: "core_platform",
335 annotations_enabled: true,
336 previous_api: ":last-released-public-api",
337 merge_annotations_dirs: [
338 "metalava-manual",
339 ],
Anton Hansson81969c22020-02-03 20:45:56 +0000340 args: priv_apps,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900341}
342
343java_library_static {
344 name: "hwbinder.stubs",
345 sdk_version: "core_current",
346 srcs: [
347 ":hwbinder-stubs-docs",
348 ],
349}
350
351/////////////////////////////////////////////////////////////////////
352// Stubs for hiddenapi processing.
353/////////////////////////////////////////////////////////////////////
354
355droidstubs {
356 name: "hiddenapi-lists-docs",
357 defaults: ["metalava-api-stubs-default"],
358 arg_files: [
359 "core/res/AndroidManifest.xml",
360 ],
361 dex_api_filename: "public-dex.txt",
362 private_dex_api_filename: "private-dex.txt",
363 removed_dex_api_filename: "removed-dex.txt",
364 args: metalava_framework_docs_args +
365 " --show-unannotated " +
Anton Hansson81969c22020-02-03 20:45:56 +0000366 priv_apps +
Jiyong Park7fb4b182019-12-20 14:35:43 +0900367 " --show-annotation android.annotation.TestApi ",
368}
369
370droidstubs {
371 name: "hiddenapi-mappings",
372 defaults: ["metalava-api-stubs-default"],
373 srcs: [
374 ":opt-telephony-common-srcs",
375 ],
376
377 arg_files: [
378 "core/res/AndroidManifest.xml",
379 ],
380 dex_mapping_filename: "dex-mapping.txt",
381 args: metalava_framework_docs_args +
382 " --hide ReferencesHidden " +
383 " --hide UnhiddenSystemApi " +
384 " --show-unannotated " +
Anton Hansson81969c22020-02-03 20:45:56 +0000385 priv_apps +
Jiyong Park7fb4b182019-12-20 14:35:43 +0900386 " --show-annotation android.annotation.TestApi ",
387}
388
389/////////////////////////////////////////////////////////////////////
390// api/*-current.txt files for use by modules in other directories
391// like the CTS test
392/////////////////////////////////////////////////////////////////////
393
394filegroup {
395 name: "frameworks-base-api-current.txt",
396 srcs: [
397 "api/current.txt",
398 ],
399}
400
401filegroup {
402 name: "frameworks-base-api-system-current.txt",
403 srcs: [
404 "api/system-current.txt",
405 ],
406}
407
408filegroup {
409 name: "frameworks-base-api-system-removed.txt",
410 srcs: [
411 "api/system-removed.txt",
412 ],
413}