blob: 232a7cfd4702313730ab9bb8617bd3cf151c9578 [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 Park2e6cdcc2019-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 Park2e6cdcc2019-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 Park2e6cdcc2019-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
Anton Hansson81969c22020-02-03 20:45:56 +0000112priv_apps = " " +
113 "--show-annotation android.annotation.SystemApi\\(" +
114 "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
115 "\\) "
116
117module_libs = " " +
118 " --show-annotation android.annotation.SystemApi\\(" +
119 "client=android.annotation.SystemApi.Client.MODULE_LIBRARIES" +
120 "\\) "
121
Jiyong Park7fb4b182019-12-20 14:35:43 +0900122droidstubs {
123 name: "system-api-stubs-docs",
124 defaults: ["metalava-api-stubs-default"],
125 api_tag_name: "SYSTEM",
126 api_filename: "system-api.txt",
127 private_api_filename: "system-private.txt",
128 private_dex_api_filename: "system-private-dex.txt",
129 removed_api_filename: "system-removed.txt",
130 arg_files: [
131 "core/res/AndroidManifest.xml",
132 ],
Anton Hansson81969c22020-02-03 20:45:56 +0000133 args: metalava_framework_docs_args + priv_apps,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900134 check_api: {
135 current: {
136 api_file: "api/system-current.txt",
137 removed_api_file: "api/system-removed.txt",
138 },
139 last_released: {
140 api_file: ":last-released-system-api",
141 removed_api_file: "api/system-removed.txt",
142 baseline_file: ":system-api-incompatibilities-with-last-released"
143 },
144 api_lint: {
145 enabled: true,
146 new_since: ":last-released-system-api",
147 baseline_file: "api/system-lint-baseline.txt",
148 },
149 },
150 jdiff_enabled: true,
151}
152
153droidstubs {
154 name: "test-api-stubs-docs",
155 defaults: ["metalava-api-stubs-default"],
156 api_tag_name: "TEST",
157 api_filename: "test-api.txt",
158 removed_api_filename: "test-removed.txt",
159 arg_files: [
160 "core/res/AndroidManifest.xml",
161 ],
162 args: metalava_framework_docs_args + " --show-annotation android.annotation.TestApi",
163 check_api: {
164 current: {
165 api_file: "api/test-current.txt",
166 removed_api_file: "api/test-removed.txt",
167 },
168 api_lint: {
169 enabled: true,
170 baseline_file: "api/test-lint-baseline.txt",
171 },
172 },
173}
174
175/////////////////////////////////////////////////////////////////////
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900176// Following droidstubs modules are for extra APIs for modules.
177// The framework currently have two more API surfaces for modules:
178// @SystemApi(client=MODULE_APPS) and @SystemApi(client=MODULE_LIBRARIES)
179/////////////////////////////////////////////////////////////////////
180
Anton Hansson81969c22020-02-03 20:45:56 +0000181// TODO(b/146727827) remove the *-api module when we can teach metalava
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900182// about the relationship among the API surfaces. Currently, these modules are only to generate
183// the API signature files and ensure that the APIs evolve in a backwards compatible manner.
184// They however are NOT used for building the API stub.
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900185
186droidstubs {
187 name: "module-lib-api",
Anton Hanssonc3668112020-01-17 13:42:43 +0000188 defaults: ["metalava-api-stubs-default"],
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900189 libs: ["framework-all"],
190 arg_files: ["core/res/AndroidManifest.xml"],
Anton Hansson81969c22020-02-03 20:45:56 +0000191 args: metalava_framework_docs_args + module_libs,
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900192 check_api: {
193 current: {
194 api_file: "api/module-lib-current.txt",
195 removed_api_file: "api/module-lib-removed.txt",
196 },
197 // TODO(b/147559833) enable the compatibility check against the last release API
198 // and the API lint
199 //last_released: {
200 // api_file: ":last-released-module-lib-api",
201 // removed_api_file: "api/module-lib-removed.txt",
202 // baseline_file: ":module-lib-api-incompatibilities-with-last-released"
203 //},
204 //api_lint: {
205 // enabled: true,
206 // new_since: ":last-released-module-lib-api",
207 // baseline_file: "api/module-lib-lint-baseline.txt",
208 //},
209 },
210 //jdiff_enabled: true,
211}
212
Anton Hansson81969c22020-02-03 20:45:56 +0000213
214// The following droidstub module generates source files for the API stub library for
215// modules. Note that it not only includes its own APIs but also other APIs that have
216// narrower scope (all @SystemApis, not just the ones with 'client=MODULE_LIBRARIES').
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900217
218droidstubs {
219 name: "module-lib-api-stubs-docs",
Anton Hanssonc3668112020-01-17 13:42:43 +0000220 defaults: ["metalava-api-stubs-default"],
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900221 libs: ["framework-all"],
222 arg_files: ["core/res/AndroidManifest.xml"],
Anton Hansson81969c22020-02-03 20:45:56 +0000223 args: metalava_framework_docs_args + priv_apps + module_libs,
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900224}
225
226/////////////////////////////////////////////////////////////////////
Jiyong Park7fb4b182019-12-20 14:35:43 +0900227// android_*_stubs_current modules are the stubs libraries compiled
228// from *-api-stubs-docs
229/////////////////////////////////////////////////////////////////////
230
231java_defaults {
232 name: "framework-stubs-default",
233 errorprone: {
234 javacflags: [
235 "-XepDisableAllChecks",
236 ],
237 },
238 java_resources: [
239 ":notices-for-framework-stubs",
240 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900241 system_modules: "none",
242 java_version: "1.8",
243 compile_dex: true,
244}
245
246java_library_static {
247 name: "android_stubs_current",
248 srcs: [
249 ":api-stubs-docs",
250 ],
251 libs: [
252 "stub-annotations",
253 ],
254 static_libs: [
255 "private-stub-annotations-jar",
256 ],
257 defaults: ["framework-stubs-default"],
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900258 sdk_version: "core_current",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900259}
260
261java_library_static {
262 name: "android_system_stubs_current",
263 srcs: [
264 ":system-api-stubs-docs",
265 ],
266 libs: [
267 "stub-annotations",
268 ],
269 static_libs: [
270 "private-stub-annotations-jar",
271 ],
272 defaults: ["framework-stubs-default"],
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900273 sdk_version: "core_current",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900274}
275
276java_library_static {
277 name: "android_test_stubs_current",
278 srcs: [
279 ":test-api-stubs-docs",
280 ],
281 libs: [
282 "stub-annotations",
283 ],
284 static_libs: [
285 "private-stub-annotations-jar",
286 ],
287 defaults: ["framework-stubs-default"],
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900288 sdk_version: "core_current",
289}
290
291java_library_static {
Anton Hansson9c4bbe92020-01-30 12:09:02 +0000292 name: "android_module_lib_stubs_current",
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900293 srcs: [
294 ":module-lib-api-stubs-docs",
295 ],
296 libs: [
297 "stub-annotations",
298 "framework-all",
299 ],
300 static_libs: [
301 "private-stub-annotations-jar",
302 ],
303 defaults: ["framework-stubs-default"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900304}
305
Jiyong Park7fb4b182019-12-20 14:35:43 +0900306/////////////////////////////////////////////////////////////////////
307// hwbinder.stubs provides APIs required for building HIDL Java
308// libraries.
309/////////////////////////////////////////////////////////////////////
310
311droidstubs {
312 name: "hwbinder-stubs-docs",
313 srcs: [
314 "core/java/android/os/HidlSupport.java",
315 "core/java/android/annotation/IntDef.java",
316 "core/java/android/annotation/IntRange.java",
317 "core/java/android/annotation/NonNull.java",
318 "core/java/android/annotation/SystemApi.java",
319 "core/java/android/os/HidlMemory.java",
320 "core/java/android/os/HwBinder.java",
321 "core/java/android/os/HwBlob.java",
322 "core/java/android/os/HwParcel.java",
323 "core/java/android/os/IHwBinder.java",
324 "core/java/android/os/IHwInterface.java",
325 "core/java/android/os/DeadObjectException.java",
326 "core/java/android/os/DeadSystemException.java",
327 "core/java/android/os/NativeHandle.java",
328 "core/java/android/os/RemoteException.java",
329 "core/java/android/util/AndroidException.java",
330 ],
331 installable: false,
332 sdk_version: "core_platform",
333 annotations_enabled: true,
334 previous_api: ":last-released-public-api",
335 merge_annotations_dirs: [
336 "metalava-manual",
337 ],
Anton Hansson81969c22020-02-03 20:45:56 +0000338 args: priv_apps,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900339}
340
341java_library_static {
342 name: "hwbinder.stubs",
343 sdk_version: "core_current",
344 srcs: [
345 ":hwbinder-stubs-docs",
346 ],
347}
348
349/////////////////////////////////////////////////////////////////////
350// Stubs for hiddenapi processing.
351/////////////////////////////////////////////////////////////////////
352
353droidstubs {
354 name: "hiddenapi-lists-docs",
355 defaults: ["metalava-api-stubs-default"],
356 arg_files: [
357 "core/res/AndroidManifest.xml",
358 ],
359 dex_api_filename: "public-dex.txt",
360 private_dex_api_filename: "private-dex.txt",
361 removed_dex_api_filename: "removed-dex.txt",
362 args: metalava_framework_docs_args +
363 " --show-unannotated " +
Anton Hansson81969c22020-02-03 20:45:56 +0000364 priv_apps +
Jiyong Park7fb4b182019-12-20 14:35:43 +0900365 " --show-annotation android.annotation.TestApi ",
366}
367
368droidstubs {
369 name: "hiddenapi-mappings",
370 defaults: ["metalava-api-stubs-default"],
371 srcs: [
372 ":opt-telephony-common-srcs",
373 ],
374
375 arg_files: [
376 "core/res/AndroidManifest.xml",
377 ],
378 dex_mapping_filename: "dex-mapping.txt",
379 args: metalava_framework_docs_args +
380 " --hide ReferencesHidden " +
381 " --hide UnhiddenSystemApi " +
382 " --show-unannotated " +
Anton Hansson81969c22020-02-03 20:45:56 +0000383 priv_apps +
Jiyong Park7fb4b182019-12-20 14:35:43 +0900384 " --show-annotation android.annotation.TestApi ",
385}
386
387/////////////////////////////////////////////////////////////////////
388// api/*-current.txt files for use by modules in other directories
389// like the CTS test
390/////////////////////////////////////////////////////////////////////
391
392filegroup {
393 name: "frameworks-base-api-current.txt",
394 srcs: [
395 "api/current.txt",
396 ],
397}
398
399filegroup {
400 name: "frameworks-base-api-system-current.txt",
401 srcs: [
402 "api/system-current.txt",
403 ],
404}
405
406filegroup {
407 name: "frameworks-base-api-system-removed.txt",
408 srcs: [
409 "api/system-removed.txt",
410 ],
411}