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