blob: fd0fe9c7f5aefbfc88cb2ea6ac23e4e46c9a6561 [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 {
Anton Hansson822cdb32020-03-06 17:16:06 +000044 name: "metalava-base-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",
Jiyong Park7fb4b182019-12-20 14:35:43 +090052 ],
Chen Xu546ce5e2020-01-10 08:38:31 -080053 // TODO(b/147699819): remove below aidl includes.
54 aidl: {
55 local_include_dirs: ["telephony/java"],
56 },
Jiyong Park7fb4b182019-12-20 14:35:43 +090057 libs: ["framework-internal-utils"],
58 installable: false,
59 annotations_enabled: true,
60 previous_api: ":last-released-public-api",
61 merge_annotations_dirs: [
62 "metalava-manual",
63 ],
64 api_levels_annotations_enabled: true,
65 api_levels_annotations_dirs: [
66 "sdk-dir",
67 "api-versions-jars-dir",
68 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +090069 filter_packages: packages_to_document,
70}
71
Jiyong Parke3095162019-12-20 15:30:28 +090072stubs_defaults {
Anton Hansson822cdb32020-03-06 17:16:06 +000073 name: "metalava-full-api-stubs-default",
74 defaults: ["metalava-base-api-stubs-default"],
Jiyong Parke3095162019-12-20 15:30:28 +090075 srcs: [":framework-updatable-sources"],
76 sdk_version: "core_platform",
77}
78
Anton Hansson822cdb32020-03-06 17:16:06 +000079stubs_defaults {
80 name: "metalava-non-updatable-api-stubs-default",
81 defaults: ["metalava-base-api-stubs-default"],
Anton Hansson92d79fd2020-03-20 09:12:52 +000082 sdk_version: "core_platform",
83 libs: ["framework-all"],
84 aidl: {
85 local_include_dirs: ["apex/media/framework/java"],
86 },
Anton Hansson822cdb32020-03-06 17:16:06 +000087}
88
Jiyong Park7fb4b182019-12-20 14:35:43 +090089/////////////////////////////////////////////////////////////////////
90// *-api-stubs-docs modules providing source files for the stub libraries
91/////////////////////////////////////////////////////////////////////
92
Jiyong Parke3095162019-12-20 15:30:28 +090093// api-stubs-docs, system-api-stubs-docs, and test-api-stubs-docs have APIs
94// from the non-updatable part of the platform as well as from the updatable
95// modules
Jiyong Park7fb4b182019-12-20 14:35:43 +090096droidstubs {
97 name: "api-stubs-docs",
Anton Hansson822cdb32020-03-06 17:16:06 +000098 defaults: ["metalava-full-api-stubs-default"],
Jiyong Park7fb4b182019-12-20 14:35:43 +090099 api_filename: "public_api.txt",
100 private_api_filename: "private.txt",
101 removed_api_filename: "removed.txt",
102 arg_files: [
103 "core/res/AndroidManifest.xml",
104 ],
105 args: metalava_framework_docs_args,
106 check_api: {
107 current: {
108 api_file: "api/current.txt",
109 removed_api_file: "api/removed.txt",
110 },
111 last_released: {
112 api_file: ":last-released-public-api",
113 removed_api_file: "api/removed.txt",
114 baseline_file: ":public-api-incompatibilities-with-last-released",
115 },
116 api_lint: {
117 enabled: true,
118 new_since: ":last-released-public-api",
119 baseline_file: "api/lint-baseline.txt",
120 },
121 },
Anton Hanssond9a3fee2020-03-23 18:08:55 +0000122 dist: {
123 targets: ["sdk", "win_sdk"],
124 dir: "apistubs/android/public/api",
125 dest: "android.txt",
126 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900127 jdiff_enabled: true,
128}
129
Anton Hansson81969c22020-02-03 20:45:56 +0000130priv_apps = " " +
131 "--show-annotation android.annotation.SystemApi\\(" +
132 "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
133 "\\) "
134
135module_libs = " " +
136 " --show-annotation android.annotation.SystemApi\\(" +
137 "client=android.annotation.SystemApi.Client.MODULE_LIBRARIES" +
138 "\\) "
139
Jiyong Park7fb4b182019-12-20 14:35:43 +0900140droidstubs {
141 name: "system-api-stubs-docs",
Anton Hansson822cdb32020-03-06 17:16:06 +0000142 defaults: ["metalava-full-api-stubs-default"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900143 api_tag_name: "SYSTEM",
144 api_filename: "system-api.txt",
145 private_api_filename: "system-private.txt",
146 private_dex_api_filename: "system-private-dex.txt",
147 removed_api_filename: "system-removed.txt",
148 arg_files: [
149 "core/res/AndroidManifest.xml",
150 ],
Anton Hansson81969c22020-02-03 20:45:56 +0000151 args: metalava_framework_docs_args + priv_apps,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900152 check_api: {
153 current: {
154 api_file: "api/system-current.txt",
155 removed_api_file: "api/system-removed.txt",
156 },
157 last_released: {
158 api_file: ":last-released-system-api",
159 removed_api_file: "api/system-removed.txt",
160 baseline_file: ":system-api-incompatibilities-with-last-released"
161 },
162 api_lint: {
163 enabled: true,
164 new_since: ":last-released-system-api",
165 baseline_file: "api/system-lint-baseline.txt",
166 },
167 },
Anton Hanssond9a3fee2020-03-23 18:08:55 +0000168 dist: {
169 targets: ["sdk", "win_sdk"],
170 dir: "apistubs/android/system/api",
171 dest: "android.txt",
172 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900173 jdiff_enabled: true,
174}
175
176droidstubs {
177 name: "test-api-stubs-docs",
Anton Hansson822cdb32020-03-06 17:16:06 +0000178 defaults: ["metalava-full-api-stubs-default"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900179 api_tag_name: "TEST",
180 api_filename: "test-api.txt",
181 removed_api_filename: "test-removed.txt",
182 arg_files: [
183 "core/res/AndroidManifest.xml",
184 ],
185 args: metalava_framework_docs_args + " --show-annotation android.annotation.TestApi",
186 check_api: {
187 current: {
188 api_file: "api/test-current.txt",
189 removed_api_file: "api/test-removed.txt",
190 },
191 api_lint: {
192 enabled: true,
193 baseline_file: "api/test-lint-baseline.txt",
194 },
195 },
Anton Hanssond9a3fee2020-03-23 18:08:55 +0000196 dist: {
197 targets: ["sdk", "win_sdk"],
198 dir: "apistubs/android/test/api",
199 dest: "android.txt",
200 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900201}
202
203/////////////////////////////////////////////////////////////////////
Jiyong Parke3095162019-12-20 15:30:28 +0900204// Following droidstubs modules are for extra APIs for modules.
205// The framework currently have two more API surfaces for modules:
206// @SystemApi(client=MODULE_APPS) and @SystemApi(client=MODULE_LIBRARIES)
207/////////////////////////////////////////////////////////////////////
208
Anton Hansson81969c22020-02-03 20:45:56 +0000209// TODO(b/146727827) remove the *-api module when we can teach metalava
Jiyong Parke3095162019-12-20 15:30:28 +0900210// about the relationship among the API surfaces. Currently, these modules are only to generate
211// the API signature files and ensure that the APIs evolve in a backwards compatible manner.
212// They however are NOT used for building the API stub.
Jiyong Parke3095162019-12-20 15:30:28 +0900213
214droidstubs {
215 name: "module-lib-api",
Anton Hansson822cdb32020-03-06 17:16:06 +0000216 defaults: ["metalava-full-api-stubs-default"],
Anton Hansson7b0414b2020-03-19 15:09:44 +0000217 api_tag_name: "MODULE_LIB",
Jiyong Parke3095162019-12-20 15:30:28 +0900218 arg_files: ["core/res/AndroidManifest.xml"],
Anton Hansson81969c22020-02-03 20:45:56 +0000219 args: metalava_framework_docs_args + module_libs,
Jiyong Parke3095162019-12-20 15:30:28 +0900220 check_api: {
221 current: {
222 api_file: "api/module-lib-current.txt",
223 removed_api_file: "api/module-lib-removed.txt",
224 },
Anton Hansson79e35c32020-02-11 14:36:40 +0000225 last_released: {
226 api_file: ":last-released-module-lib-api",
227 removed_api_file: "api/module-lib-removed.txt",
228 baseline_file: ":module-lib-api-incompatibilities-with-last-released"
229 },
230 api_lint: {
231 enabled: true,
232 new_since: ":last-released-module-lib-api",
233 baseline_file: "api/module-lib-lint-baseline.txt",
234 },
Jiyong Parke3095162019-12-20 15:30:28 +0900235 },
Anton Hanssond9a3fee2020-03-23 18:08:55 +0000236 dist: {
237 targets: ["sdk", "win_sdk"],
238 dir: "apistubs/android/module-lib/api",
239 dest: "android.txt",
240 },
Jiyong Parke3095162019-12-20 15:30:28 +0900241}
242
Anton Hansson81969c22020-02-03 20:45:56 +0000243
244// The following droidstub module generates source files for the API stub library for
245// modules. Note that it not only includes its own APIs but also other APIs that have
246// narrower scope (all @SystemApis, not just the ones with 'client=MODULE_LIBRARIES').
Jiyong Parke3095162019-12-20 15:30:28 +0900247
248droidstubs {
249 name: "module-lib-api-stubs-docs",
Anton Hansson822cdb32020-03-06 17:16:06 +0000250 defaults: ["metalava-non-updatable-api-stubs-default"],
Jiyong Parke3095162019-12-20 15:30:28 +0900251 arg_files: ["core/res/AndroidManifest.xml"],
Anton Hansson81969c22020-02-03 20:45:56 +0000252 args: metalava_framework_docs_args + priv_apps + module_libs,
Jiyong Parke3095162019-12-20 15:30:28 +0900253}
254
255/////////////////////////////////////////////////////////////////////
Jiyong Park7fb4b182019-12-20 14:35:43 +0900256// android_*_stubs_current modules are the stubs libraries compiled
257// from *-api-stubs-docs
258/////////////////////////////////////////////////////////////////////
259
260java_defaults {
261 name: "framework-stubs-default",
Anton Hansson08b48bb2020-02-08 20:43:19 +0000262 libs: [ "stub-annotations" ],
263 static_libs: [ "private-stub-annotations-jar" ],
264 sdk_version: "core_current",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900265 errorprone: {
266 javacflags: [
267 "-XepDisableAllChecks",
268 ],
269 },
270 java_resources: [
271 ":notices-for-framework-stubs",
272 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900273 system_modules: "none",
274 java_version: "1.8",
275 compile_dex: true,
276}
277
278java_library_static {
279 name: "android_stubs_current",
Anton Hansson08b48bb2020-02-08 20:43:19 +0000280 srcs: [ ":api-stubs-docs" ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900281 defaults: ["framework-stubs-default"],
282}
283
284java_library_static {
285 name: "android_system_stubs_current",
Anton Hansson08b48bb2020-02-08 20:43:19 +0000286 srcs: [ ":system-api-stubs-docs" ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900287 defaults: ["framework-stubs-default"],
288}
289
290java_library_static {
291 name: "android_test_stubs_current",
Anton Hansson08b48bb2020-02-08 20:43:19 +0000292 srcs: [ ":test-api-stubs-docs" ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900293 defaults: ["framework-stubs-default"],
Jiyong Parke3095162019-12-20 15:30:28 +0900294}
295
296java_library_static {
Anton Hansson1b9cf092020-01-30 12:09:02 +0000297 name: "android_module_lib_stubs_current",
Anton Hansson08b48bb2020-02-08 20:43:19 +0000298 srcs: [ ":module-lib-api-stubs-docs" ],
Jiyong Parke3095162019-12-20 15:30:28 +0900299 defaults: ["framework-stubs-default"],
Anton Hansson822cdb32020-03-06 17:16:06 +0000300 libs: ["android_system_stubs_current"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900301}
302
Jiyong Park7fb4b182019-12-20 14:35:43 +0900303/////////////////////////////////////////////////////////////////////
304// hwbinder.stubs provides APIs required for building HIDL Java
305// libraries.
306/////////////////////////////////////////////////////////////////////
307
308droidstubs {
309 name: "hwbinder-stubs-docs",
310 srcs: [
311 "core/java/android/os/HidlSupport.java",
312 "core/java/android/annotation/IntDef.java",
313 "core/java/android/annotation/IntRange.java",
314 "core/java/android/annotation/NonNull.java",
315 "core/java/android/annotation/SystemApi.java",
316 "core/java/android/os/HidlMemory.java",
317 "core/java/android/os/HwBinder.java",
318 "core/java/android/os/HwBlob.java",
319 "core/java/android/os/HwParcel.java",
320 "core/java/android/os/IHwBinder.java",
321 "core/java/android/os/IHwInterface.java",
322 "core/java/android/os/DeadObjectException.java",
323 "core/java/android/os/DeadSystemException.java",
324 "core/java/android/os/NativeHandle.java",
325 "core/java/android/os/RemoteException.java",
326 "core/java/android/util/AndroidException.java",
327 ],
328 installable: false,
329 sdk_version: "core_platform",
330 annotations_enabled: true,
331 previous_api: ":last-released-public-api",
332 merge_annotations_dirs: [
333 "metalava-manual",
334 ],
Anton Hansson81969c22020-02-03 20:45:56 +0000335 args: priv_apps,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900336}
337
338java_library_static {
339 name: "hwbinder.stubs",
340 sdk_version: "core_current",
341 srcs: [
342 ":hwbinder-stubs-docs",
343 ],
344}
345
346/////////////////////////////////////////////////////////////////////
347// Stubs for hiddenapi processing.
348/////////////////////////////////////////////////////////////////////
349
350droidstubs {
351 name: "hiddenapi-lists-docs",
Anton Hansson822cdb32020-03-06 17:16:06 +0000352 defaults: ["metalava-full-api-stubs-default"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900353 arg_files: [
354 "core/res/AndroidManifest.xml",
355 ],
356 dex_api_filename: "public-dex.txt",
357 private_dex_api_filename: "private-dex.txt",
358 removed_dex_api_filename: "removed-dex.txt",
359 args: metalava_framework_docs_args +
360 " --show-unannotated " +
Anton Hansson81969c22020-02-03 20:45:56 +0000361 priv_apps +
Jiyong Park7fb4b182019-12-20 14:35:43 +0900362 " --show-annotation android.annotation.TestApi ",
363}
364
365droidstubs {
366 name: "hiddenapi-mappings",
Anton Hansson822cdb32020-03-06 17:16:06 +0000367 defaults: ["metalava-full-api-stubs-default"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900368 srcs: [
369 ":opt-telephony-common-srcs",
370 ],
371
372 arg_files: [
373 "core/res/AndroidManifest.xml",
374 ],
375 dex_mapping_filename: "dex-mapping.txt",
376 args: metalava_framework_docs_args +
377 " --hide ReferencesHidden " +
378 " --hide UnhiddenSystemApi " +
379 " --show-unannotated " +
Anton Hansson81969c22020-02-03 20:45:56 +0000380 priv_apps +
Jiyong Park7fb4b182019-12-20 14:35:43 +0900381 " --show-annotation android.annotation.TestApi ",
382}
383
384/////////////////////////////////////////////////////////////////////
385// api/*-current.txt files for use by modules in other directories
386// like the CTS test
387/////////////////////////////////////////////////////////////////////
388
389filegroup {
390 name: "frameworks-base-api-current.txt",
391 srcs: [
392 "api/current.txt",
393 ],
394}
395
396filegroup {
397 name: "frameworks-base-api-system-current.txt",
398 srcs: [
399 "api/system-current.txt",
400 ],
401}
402
403filegroup {
404 name: "frameworks-base-api-system-removed.txt",
405 srcs: [
406 "api/system-removed.txt",
407 ],
408}