blob: 68e1b1b2872f7ddbffae083c84568edd98d047d4 [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 },
122 jdiff_enabled: true,
123}
124
Anton Hansson81969c22020-02-03 20:45:56 +0000125priv_apps = " " +
126 "--show-annotation android.annotation.SystemApi\\(" +
127 "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
128 "\\) "
129
130module_libs = " " +
131 " --show-annotation android.annotation.SystemApi\\(" +
132 "client=android.annotation.SystemApi.Client.MODULE_LIBRARIES" +
133 "\\) "
134
Jiyong Park7fb4b182019-12-20 14:35:43 +0900135droidstubs {
136 name: "system-api-stubs-docs",
Anton Hansson822cdb32020-03-06 17:16:06 +0000137 defaults: ["metalava-full-api-stubs-default"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900138 api_tag_name: "SYSTEM",
139 api_filename: "system-api.txt",
140 private_api_filename: "system-private.txt",
141 private_dex_api_filename: "system-private-dex.txt",
142 removed_api_filename: "system-removed.txt",
143 arg_files: [
144 "core/res/AndroidManifest.xml",
145 ],
Anton Hansson81969c22020-02-03 20:45:56 +0000146 args: metalava_framework_docs_args + priv_apps,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900147 check_api: {
148 current: {
149 api_file: "api/system-current.txt",
150 removed_api_file: "api/system-removed.txt",
151 },
152 last_released: {
153 api_file: ":last-released-system-api",
154 removed_api_file: "api/system-removed.txt",
155 baseline_file: ":system-api-incompatibilities-with-last-released"
156 },
157 api_lint: {
158 enabled: true,
159 new_since: ":last-released-system-api",
160 baseline_file: "api/system-lint-baseline.txt",
161 },
162 },
163 jdiff_enabled: true,
164}
165
166droidstubs {
167 name: "test-api-stubs-docs",
Anton Hansson822cdb32020-03-06 17:16:06 +0000168 defaults: ["metalava-full-api-stubs-default"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900169 api_tag_name: "TEST",
170 api_filename: "test-api.txt",
171 removed_api_filename: "test-removed.txt",
172 arg_files: [
173 "core/res/AndroidManifest.xml",
174 ],
175 args: metalava_framework_docs_args + " --show-annotation android.annotation.TestApi",
176 check_api: {
177 current: {
178 api_file: "api/test-current.txt",
179 removed_api_file: "api/test-removed.txt",
180 },
181 api_lint: {
182 enabled: true,
183 baseline_file: "api/test-lint-baseline.txt",
184 },
185 },
186}
187
188/////////////////////////////////////////////////////////////////////
Jiyong Parke3095162019-12-20 15:30:28 +0900189// Following droidstubs modules are for extra APIs for modules.
190// The framework currently have two more API surfaces for modules:
191// @SystemApi(client=MODULE_APPS) and @SystemApi(client=MODULE_LIBRARIES)
192/////////////////////////////////////////////////////////////////////
193
Anton Hansson81969c22020-02-03 20:45:56 +0000194// TODO(b/146727827) remove the *-api module when we can teach metalava
Jiyong Parke3095162019-12-20 15:30:28 +0900195// about the relationship among the API surfaces. Currently, these modules are only to generate
196// the API signature files and ensure that the APIs evolve in a backwards compatible manner.
197// They however are NOT used for building the API stub.
Jiyong Parke3095162019-12-20 15:30:28 +0900198
199droidstubs {
200 name: "module-lib-api",
Anton Hansson822cdb32020-03-06 17:16:06 +0000201 defaults: ["metalava-full-api-stubs-default"],
Jiyong Parke3095162019-12-20 15:30:28 +0900202 arg_files: ["core/res/AndroidManifest.xml"],
Anton Hansson81969c22020-02-03 20:45:56 +0000203 args: metalava_framework_docs_args + module_libs,
Jiyong Parke3095162019-12-20 15:30:28 +0900204 check_api: {
205 current: {
206 api_file: "api/module-lib-current.txt",
207 removed_api_file: "api/module-lib-removed.txt",
208 },
Anton Hansson79e35c32020-02-11 14:36:40 +0000209 last_released: {
210 api_file: ":last-released-module-lib-api",
211 removed_api_file: "api/module-lib-removed.txt",
212 baseline_file: ":module-lib-api-incompatibilities-with-last-released"
213 },
214 api_lint: {
215 enabled: true,
216 new_since: ":last-released-module-lib-api",
217 baseline_file: "api/module-lib-lint-baseline.txt",
218 },
Jiyong Parke3095162019-12-20 15:30:28 +0900219 },
Jiyong Parke3095162019-12-20 15:30:28 +0900220}
221
Anton Hansson81969c22020-02-03 20:45:56 +0000222
223// The following droidstub module generates source files for the API stub library for
224// modules. Note that it not only includes its own APIs but also other APIs that have
225// narrower scope (all @SystemApis, not just the ones with 'client=MODULE_LIBRARIES').
Jiyong Parke3095162019-12-20 15:30:28 +0900226
227droidstubs {
228 name: "module-lib-api-stubs-docs",
Anton Hansson822cdb32020-03-06 17:16:06 +0000229 defaults: ["metalava-non-updatable-api-stubs-default"],
Jiyong Parke3095162019-12-20 15:30:28 +0900230 arg_files: ["core/res/AndroidManifest.xml"],
Anton Hansson81969c22020-02-03 20:45:56 +0000231 args: metalava_framework_docs_args + priv_apps + module_libs,
Jiyong Parke3095162019-12-20 15:30:28 +0900232}
233
234/////////////////////////////////////////////////////////////////////
Jiyong Park7fb4b182019-12-20 14:35:43 +0900235// android_*_stubs_current modules are the stubs libraries compiled
236// from *-api-stubs-docs
237/////////////////////////////////////////////////////////////////////
238
239java_defaults {
240 name: "framework-stubs-default",
Anton Hansson08b48bb2020-02-08 20:43:19 +0000241 libs: [ "stub-annotations" ],
242 static_libs: [ "private-stub-annotations-jar" ],
243 sdk_version: "core_current",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900244 errorprone: {
245 javacflags: [
246 "-XepDisableAllChecks",
247 ],
248 },
249 java_resources: [
250 ":notices-for-framework-stubs",
251 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900252 system_modules: "none",
253 java_version: "1.8",
254 compile_dex: true,
255}
256
257java_library_static {
258 name: "android_stubs_current",
Anton Hansson08b48bb2020-02-08 20:43:19 +0000259 srcs: [ ":api-stubs-docs" ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900260 defaults: ["framework-stubs-default"],
261}
262
263java_library_static {
264 name: "android_system_stubs_current",
Anton Hansson08b48bb2020-02-08 20:43:19 +0000265 srcs: [ ":system-api-stubs-docs" ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900266 defaults: ["framework-stubs-default"],
267}
268
269java_library_static {
270 name: "android_test_stubs_current",
Anton Hansson08b48bb2020-02-08 20:43:19 +0000271 srcs: [ ":test-api-stubs-docs" ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900272 defaults: ["framework-stubs-default"],
Jiyong Parke3095162019-12-20 15:30:28 +0900273}
274
275java_library_static {
Anton Hansson1b9cf092020-01-30 12:09:02 +0000276 name: "android_module_lib_stubs_current",
Anton Hansson08b48bb2020-02-08 20:43:19 +0000277 srcs: [ ":module-lib-api-stubs-docs" ],
Jiyong Parke3095162019-12-20 15:30:28 +0900278 defaults: ["framework-stubs-default"],
Anton Hansson822cdb32020-03-06 17:16:06 +0000279 libs: ["android_system_stubs_current"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900280}
281
Jiyong Park7fb4b182019-12-20 14:35:43 +0900282/////////////////////////////////////////////////////////////////////
283// hwbinder.stubs provides APIs required for building HIDL Java
284// libraries.
285/////////////////////////////////////////////////////////////////////
286
287droidstubs {
288 name: "hwbinder-stubs-docs",
289 srcs: [
290 "core/java/android/os/HidlSupport.java",
291 "core/java/android/annotation/IntDef.java",
292 "core/java/android/annotation/IntRange.java",
293 "core/java/android/annotation/NonNull.java",
294 "core/java/android/annotation/SystemApi.java",
295 "core/java/android/os/HidlMemory.java",
296 "core/java/android/os/HwBinder.java",
297 "core/java/android/os/HwBlob.java",
298 "core/java/android/os/HwParcel.java",
299 "core/java/android/os/IHwBinder.java",
300 "core/java/android/os/IHwInterface.java",
301 "core/java/android/os/DeadObjectException.java",
302 "core/java/android/os/DeadSystemException.java",
303 "core/java/android/os/NativeHandle.java",
304 "core/java/android/os/RemoteException.java",
305 "core/java/android/util/AndroidException.java",
306 ],
307 installable: false,
308 sdk_version: "core_platform",
309 annotations_enabled: true,
310 previous_api: ":last-released-public-api",
311 merge_annotations_dirs: [
312 "metalava-manual",
313 ],
Anton Hansson81969c22020-02-03 20:45:56 +0000314 args: priv_apps,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900315}
316
317java_library_static {
318 name: "hwbinder.stubs",
319 sdk_version: "core_current",
320 srcs: [
321 ":hwbinder-stubs-docs",
322 ],
323}
324
325/////////////////////////////////////////////////////////////////////
326// Stubs for hiddenapi processing.
327/////////////////////////////////////////////////////////////////////
328
329droidstubs {
330 name: "hiddenapi-lists-docs",
Anton Hansson822cdb32020-03-06 17:16:06 +0000331 defaults: ["metalava-full-api-stubs-default"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900332 arg_files: [
333 "core/res/AndroidManifest.xml",
334 ],
335 dex_api_filename: "public-dex.txt",
336 private_dex_api_filename: "private-dex.txt",
337 removed_dex_api_filename: "removed-dex.txt",
338 args: metalava_framework_docs_args +
339 " --show-unannotated " +
Anton Hansson81969c22020-02-03 20:45:56 +0000340 priv_apps +
Jiyong Park7fb4b182019-12-20 14:35:43 +0900341 " --show-annotation android.annotation.TestApi ",
342}
343
344droidstubs {
345 name: "hiddenapi-mappings",
Anton Hansson822cdb32020-03-06 17:16:06 +0000346 defaults: ["metalava-full-api-stubs-default"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900347 srcs: [
348 ":opt-telephony-common-srcs",
349 ],
350
351 arg_files: [
352 "core/res/AndroidManifest.xml",
353 ],
354 dex_mapping_filename: "dex-mapping.txt",
355 args: metalava_framework_docs_args +
356 " --hide ReferencesHidden " +
357 " --hide UnhiddenSystemApi " +
358 " --show-unannotated " +
Anton Hansson81969c22020-02-03 20:45:56 +0000359 priv_apps +
Jiyong Park7fb4b182019-12-20 14:35:43 +0900360 " --show-annotation android.annotation.TestApi ",
361}
362
363/////////////////////////////////////////////////////////////////////
364// api/*-current.txt files for use by modules in other directories
365// like the CTS test
366/////////////////////////////////////////////////////////////////////
367
368filegroup {
369 name: "frameworks-base-api-current.txt",
370 srcs: [
371 "api/current.txt",
372 ],
373}
374
375filegroup {
376 name: "frameworks-base-api-system-current.txt",
377 srcs: [
378 "api/system-current.txt",
379 ],
380}
381
382filegroup {
383 name: "frameworks-base-api-system-removed.txt",
384 srcs: [
385 "api/system-removed.txt",
386 ],
387}