blob: baa3c615039df804356a6beb978a9a4480550994 [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 ],
54 libs: ["framework-internal-utils"],
55 installable: false,
56 annotations_enabled: true,
57 previous_api: ":last-released-public-api",
58 merge_annotations_dirs: [
59 "metalava-manual",
60 ],
61 api_levels_annotations_enabled: true,
62 api_levels_annotations_dirs: [
63 "sdk-dir",
64 "api-versions-jars-dir",
65 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +090066 filter_packages: packages_to_document,
67}
68
Jiyong Parke3095162019-12-20 15:30:28 +090069stubs_defaults {
70 name: "metalava-api-stubs-default",
71 defaults: ["metalava-non-updatable-api-stubs-default"],
72 srcs: [":framework-updatable-sources"],
73 sdk_version: "core_platform",
74}
75
Jiyong Park7fb4b182019-12-20 14:35:43 +090076/////////////////////////////////////////////////////////////////////
77// *-api-stubs-docs modules providing source files for the stub libraries
78/////////////////////////////////////////////////////////////////////
79
Jiyong Parke3095162019-12-20 15:30:28 +090080// api-stubs-docs, system-api-stubs-docs, and test-api-stubs-docs have APIs
81// from the non-updatable part of the platform as well as from the updatable
82// modules
Jiyong Park7fb4b182019-12-20 14:35:43 +090083droidstubs {
84 name: "api-stubs-docs",
85 defaults: ["metalava-api-stubs-default"],
86 api_filename: "public_api.txt",
87 private_api_filename: "private.txt",
88 removed_api_filename: "removed.txt",
89 arg_files: [
90 "core/res/AndroidManifest.xml",
91 ],
92 args: metalava_framework_docs_args,
93 check_api: {
94 current: {
95 api_file: "api/current.txt",
96 removed_api_file: "api/removed.txt",
97 },
98 last_released: {
99 api_file: ":last-released-public-api",
100 removed_api_file: "api/removed.txt",
101 baseline_file: ":public-api-incompatibilities-with-last-released",
102 },
103 api_lint: {
104 enabled: true,
105 new_since: ":last-released-public-api",
106 baseline_file: "api/lint-baseline.txt",
107 },
108 },
109 jdiff_enabled: true,
110}
111
112droidstubs {
113 name: "system-api-stubs-docs",
114 defaults: ["metalava-api-stubs-default"],
115 api_tag_name: "SYSTEM",
116 api_filename: "system-api.txt",
117 private_api_filename: "system-private.txt",
118 private_dex_api_filename: "system-private-dex.txt",
119 removed_api_filename: "system-removed.txt",
120 arg_files: [
121 "core/res/AndroidManifest.xml",
122 ],
Jiyong Parke3095162019-12-20 15:30:28 +0900123 args: metalava_framework_docs_args +
124 " --show-annotation android.annotation.SystemApi\\(" +
125 "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS," +
126 "process=android.annotation.SystemApi.Process.ALL\\)",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900127 check_api: {
128 current: {
129 api_file: "api/system-current.txt",
130 removed_api_file: "api/system-removed.txt",
131 },
132 last_released: {
133 api_file: ":last-released-system-api",
134 removed_api_file: "api/system-removed.txt",
135 baseline_file: ":system-api-incompatibilities-with-last-released"
136 },
137 api_lint: {
138 enabled: true,
139 new_since: ":last-released-system-api",
140 baseline_file: "api/system-lint-baseline.txt",
141 },
142 },
143 jdiff_enabled: true,
144}
145
146droidstubs {
147 name: "test-api-stubs-docs",
148 defaults: ["metalava-api-stubs-default"],
149 api_tag_name: "TEST",
150 api_filename: "test-api.txt",
151 removed_api_filename: "test-removed.txt",
152 arg_files: [
153 "core/res/AndroidManifest.xml",
154 ],
155 args: metalava_framework_docs_args + " --show-annotation android.annotation.TestApi",
156 check_api: {
157 current: {
158 api_file: "api/test-current.txt",
159 removed_api_file: "api/test-removed.txt",
160 },
161 api_lint: {
162 enabled: true,
163 baseline_file: "api/test-lint-baseline.txt",
164 },
165 },
166}
167
168/////////////////////////////////////////////////////////////////////
Jiyong Parke3095162019-12-20 15:30:28 +0900169// Following droidstubs modules are for extra APIs for modules.
170// The framework currently have two more API surfaces for modules:
171// @SystemApi(client=MODULE_APPS) and @SystemApi(client=MODULE_LIBRARIES)
172/////////////////////////////////////////////////////////////////////
173
174// TODO(b/146727827) remove the *-api modules when we can teach metalava
175// about the relationship among the API surfaces. Currently, these modules are only to generate
176// the API signature files and ensure that the APIs evolve in a backwards compatible manner.
177// They however are NOT used for building the API stub.
178droidstubs {
179 name: "module-app-api",
180 defaults: ["metalava-non-updatable-api-stubs-default"],
181 libs: ["framework-all"],
182 arg_files: ["core/res/AndroidManifest.xml"],
183 args: metalava_framework_docs_args +
184 " --show-annotation android.annotation.SystemApi\\(" +
185 "client=android.annotation.SystemApi.Client.MODULE_APPS," +
186 "process=android.annotation.SystemApi.Process.ALL\\)",
187 check_api: {
188 current: {
189 api_file: "api/module-app-current.txt",
190 removed_api_file: "api/module-app-removed.txt",
191 },
192 // TODO(b/147559833) enable the compatibility check against the last release API
193 // and the API lint
194 //last_released: {
195 // api_file: ":last-released-module-app-api",
196 // removed_api_file: "api/module-app-removed.txt",
197 // baseline_file: ":module-app-api-incompatibilities-with-last-released"
198 //},
199 //api_lint: {
200 // enabled: true,
201 // new_since: ":last-released-module-app-api",
202 // baseline_file: "api/module-app-lint-baseline.txt",
203 //},
204 },
205 //jdiff_enabled: true,
206}
207
208droidstubs {
209 name: "module-lib-api",
210 defaults: ["metalava-non-updatable-api-stubs-default"],
211 libs: ["framework-all"],
212 arg_files: ["core/res/AndroidManifest.xml"],
213 args: metalava_framework_docs_args +
214 " --show-annotation android.annotation.SystemApi\\(" +
215 "client=android.annotation.SystemApi.Client.MODULE_LIBRARIES," +
216 "process=android.annotation.SystemApi.Process.ALL\\)",
217 check_api: {
218 current: {
219 api_file: "api/module-lib-current.txt",
220 removed_api_file: "api/module-lib-removed.txt",
221 },
222 // TODO(b/147559833) enable the compatibility check against the last release API
223 // and the API lint
224 //last_released: {
225 // api_file: ":last-released-module-lib-api",
226 // removed_api_file: "api/module-lib-removed.txt",
227 // baseline_file: ":module-lib-api-incompatibilities-with-last-released"
228 //},
229 //api_lint: {
230 // enabled: true,
231 // new_since: ":last-released-module-lib-api",
232 // baseline_file: "api/module-lib-lint-baseline.txt",
233 //},
234 },
235 //jdiff_enabled: true,
236}
237
238// The following two droidstubs modules generate source files for the API stub libraries for
239// modules. Note that they not only include their own APIs but also other APIs that have
240// narrower scope. For example, module-lib-api-stubs-docs includes all @SystemApis not just
241// the ones with 'client=MODULE_LIBRARIES'.
242droidstubs {
243 name: "module-app-api-stubs-docs",
244 defaults: ["metalava-non-updatable-api-stubs-default"],
245 libs: ["framework-all"],
246 arg_files: ["core/res/AndroidManifest.xml"],
247 args: metalava_framework_docs_args +
248 " --show-annotation android.annotation.SystemApi\\(" +
249 "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS," +
250 "process=android.annotation.SystemApi.Process.ALL\\)" +
251 " --show-annotation android.annotation.SystemApi\\(" +
252 "client=android.annotation.SystemApi.Client.MODULE_APPS," +
253 "process=android.annotation.SystemApi.Process.ALL\\)",
254}
255
256droidstubs {
257 name: "module-lib-api-stubs-docs",
258 defaults: ["metalava-non-updatable-api-stubs-default"],
259 libs: ["framework-all"],
260 arg_files: ["core/res/AndroidManifest.xml"],
261 args: metalava_framework_docs_args +
262 " --show-annotation android.annotation.SystemApi\\(" +
263 "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS," +
264 "process=android.annotation.SystemApi.Process.ALL\\)" +
265 " --show-annotation android.annotation.SystemApi\\(" +
266 "client=android.annotation.SystemApi.Client.MODULE_APPS," +
267 "process=android.annotation.SystemApi.Process.ALL\\)" +
268 " --show-annotation android.annotation.SystemApi\\(" +
269 "client=android.annotation.SystemApi.Client.MODULE_LIBRARIES," +
270 "process=android.annotation.SystemApi.Process.ALL\\)",
271}
272
273/////////////////////////////////////////////////////////////////////
Jiyong Park7fb4b182019-12-20 14:35:43 +0900274// android_*_stubs_current modules are the stubs libraries compiled
275// from *-api-stubs-docs
276/////////////////////////////////////////////////////////////////////
277
278java_defaults {
279 name: "framework-stubs-default",
280 errorprone: {
281 javacflags: [
282 "-XepDisableAllChecks",
283 ],
284 },
285 java_resources: [
286 ":notices-for-framework-stubs",
287 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900288 system_modules: "none",
289 java_version: "1.8",
290 compile_dex: true,
291}
292
293java_library_static {
294 name: "android_stubs_current",
295 srcs: [
296 ":api-stubs-docs",
297 ],
298 libs: [
299 "stub-annotations",
300 ],
301 static_libs: [
302 "private-stub-annotations-jar",
303 ],
304 defaults: ["framework-stubs-default"],
Jiyong Parke3095162019-12-20 15:30:28 +0900305 sdk_version: "core_current",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900306}
307
308java_library_static {
309 name: "android_system_stubs_current",
310 srcs: [
311 ":system-api-stubs-docs",
312 ],
313 libs: [
314 "stub-annotations",
315 ],
316 static_libs: [
317 "private-stub-annotations-jar",
318 ],
319 defaults: ["framework-stubs-default"],
Jiyong Parke3095162019-12-20 15:30:28 +0900320 sdk_version: "core_current",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900321}
322
323java_library_static {
324 name: "android_test_stubs_current",
325 srcs: [
326 ":test-api-stubs-docs",
327 ],
328 libs: [
329 "stub-annotations",
330 ],
331 static_libs: [
332 "private-stub-annotations-jar",
333 ],
334 defaults: ["framework-stubs-default"],
Jiyong Parke3095162019-12-20 15:30:28 +0900335 sdk_version: "core_current",
336}
337
338java_library_static {
339 name: "framework_module_app_stubs_current",
340 srcs: [
341 ":module-app-api-stubs-docs",
342 ],
343 libs: [
344 "stub-annotations",
345 "framework-all",
346 ],
347 static_libs: [
348 "private-stub-annotations-jar",
349 ],
350 defaults: ["framework-stubs-default"],
351}
352
353java_library_static {
354 name: "framework_module_lib_stubs_current",
355 srcs: [
356 ":module-lib-api-stubs-docs",
357 ],
358 libs: [
359 "stub-annotations",
360 "framework-all",
361 ],
362 static_libs: [
363 "private-stub-annotations-jar",
364 ],
365 defaults: ["framework-stubs-default"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900366}
367
Jiyong Park7fb4b182019-12-20 14:35:43 +0900368/////////////////////////////////////////////////////////////////////
369// hwbinder.stubs provides APIs required for building HIDL Java
370// libraries.
371/////////////////////////////////////////////////////////////////////
372
373droidstubs {
374 name: "hwbinder-stubs-docs",
375 srcs: [
376 "core/java/android/os/HidlSupport.java",
377 "core/java/android/annotation/IntDef.java",
378 "core/java/android/annotation/IntRange.java",
379 "core/java/android/annotation/NonNull.java",
380 "core/java/android/annotation/SystemApi.java",
381 "core/java/android/os/HidlMemory.java",
382 "core/java/android/os/HwBinder.java",
383 "core/java/android/os/HwBlob.java",
384 "core/java/android/os/HwParcel.java",
385 "core/java/android/os/IHwBinder.java",
386 "core/java/android/os/IHwInterface.java",
387 "core/java/android/os/DeadObjectException.java",
388 "core/java/android/os/DeadSystemException.java",
389 "core/java/android/os/NativeHandle.java",
390 "core/java/android/os/RemoteException.java",
391 "core/java/android/util/AndroidException.java",
392 ],
393 installable: false,
394 sdk_version: "core_platform",
395 annotations_enabled: true,
396 previous_api: ":last-released-public-api",
397 merge_annotations_dirs: [
398 "metalava-manual",
399 ],
400 args: " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS,process=android.annotation.SystemApi.Process.ALL\\)",
401}
402
403java_library_static {
404 name: "hwbinder.stubs",
405 sdk_version: "core_current",
406 srcs: [
407 ":hwbinder-stubs-docs",
408 ],
409}
410
411/////////////////////////////////////////////////////////////////////
412// Stubs for hiddenapi processing.
413/////////////////////////////////////////////////////////////////////
414
415droidstubs {
416 name: "hiddenapi-lists-docs",
417 defaults: ["metalava-api-stubs-default"],
418 arg_files: [
419 "core/res/AndroidManifest.xml",
420 ],
421 dex_api_filename: "public-dex.txt",
422 private_dex_api_filename: "private-dex.txt",
423 removed_dex_api_filename: "removed-dex.txt",
424 args: metalava_framework_docs_args +
425 " --show-unannotated " +
426 " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS,process=android.annotation.SystemApi.Process.ALL\\) " +
427 " --show-annotation android.annotation.TestApi ",
428}
429
430droidstubs {
431 name: "hiddenapi-mappings",
432 defaults: ["metalava-api-stubs-default"],
433 srcs: [
434 ":opt-telephony-common-srcs",
435 ],
436
437 arg_files: [
438 "core/res/AndroidManifest.xml",
439 ],
440 dex_mapping_filename: "dex-mapping.txt",
441 args: metalava_framework_docs_args +
442 " --hide ReferencesHidden " +
443 " --hide UnhiddenSystemApi " +
444 " --show-unannotated " +
445 " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS,process=android.annotation.SystemApi.Process.ALL\\) " +
446 " --show-annotation android.annotation.TestApi ",
447}
448
449/////////////////////////////////////////////////////////////////////
450// api/*-current.txt files for use by modules in other directories
451// like the CTS test
452/////////////////////////////////////////////////////////////////////
453
454filegroup {
455 name: "frameworks-base-api-current.txt",
456 srcs: [
457 "api/current.txt",
458 ],
459}
460
461filegroup {
462 name: "frameworks-base-api-system-current.txt",
463 srcs: [
464 "api/system-current.txt",
465 ],
466}
467
468filegroup {
469 name: "frameworks-base-api-system-removed.txt",
470 srcs: [
471 "api/system-removed.txt",
472 ],
473}