blob: 12f211df45496d490eb75146863726b98cf14d0f [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 ],
Aurimas Liutikas6bb95ad2020-03-12 17:06:12 -070064 api_levels_annotations_enabled: false,
Jiyong Park7fb4b182019-12-20 14:35:43 +090065 filter_packages: packages_to_document,
66}
67
Jiyong Parke3095162019-12-20 15:30:28 +090068stubs_defaults {
Anton Hansson822cdb32020-03-06 17:16:06 +000069 name: "metalava-full-api-stubs-default",
70 defaults: ["metalava-base-api-stubs-default"],
Jiyong Parke3095162019-12-20 15:30:28 +090071 srcs: [":framework-updatable-sources"],
72 sdk_version: "core_platform",
73}
74
Anton Hansson822cdb32020-03-06 17:16:06 +000075stubs_defaults {
76 name: "metalava-non-updatable-api-stubs-default",
77 defaults: ["metalava-base-api-stubs-default"],
Anton Hansson92d79fd2020-03-20 09:12:52 +000078 sdk_version: "core_platform",
79 libs: ["framework-all"],
80 aidl: {
81 local_include_dirs: ["apex/media/framework/java"],
82 },
Anton Hansson822cdb32020-03-06 17:16:06 +000083}
84
Jiyong Park7fb4b182019-12-20 14:35:43 +090085/////////////////////////////////////////////////////////////////////
86// *-api-stubs-docs modules providing source files for the stub libraries
87/////////////////////////////////////////////////////////////////////
88
Jiyong Parke3095162019-12-20 15:30:28 +090089// api-stubs-docs, system-api-stubs-docs, and test-api-stubs-docs have APIs
90// from the non-updatable part of the platform as well as from the updatable
91// modules
Jiyong Park7fb4b182019-12-20 14:35:43 +090092droidstubs {
93 name: "api-stubs-docs",
Anton Hansson822cdb32020-03-06 17:16:06 +000094 defaults: ["metalava-full-api-stubs-default"],
Jiyong Park7fb4b182019-12-20 14:35:43 +090095 api_filename: "public_api.txt",
96 private_api_filename: "private.txt",
97 removed_api_filename: "removed.txt",
98 arg_files: [
99 "core/res/AndroidManifest.xml",
100 ],
101 args: metalava_framework_docs_args,
102 check_api: {
103 current: {
104 api_file: "api/current.txt",
105 removed_api_file: "api/removed.txt",
106 },
107 last_released: {
108 api_file: ":last-released-public-api",
109 removed_api_file: "api/removed.txt",
110 baseline_file: ":public-api-incompatibilities-with-last-released",
111 },
112 api_lint: {
113 enabled: true,
114 new_since: ":last-released-public-api",
115 baseline_file: "api/lint-baseline.txt",
116 },
117 },
118 jdiff_enabled: true,
119}
120
Anton Hansson81969c22020-02-03 20:45:56 +0000121priv_apps = " " +
122 "--show-annotation android.annotation.SystemApi\\(" +
123 "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
124 "\\) "
125
126module_libs = " " +
127 " --show-annotation android.annotation.SystemApi\\(" +
128 "client=android.annotation.SystemApi.Client.MODULE_LIBRARIES" +
129 "\\) "
130
Jiyong Park7fb4b182019-12-20 14:35:43 +0900131droidstubs {
132 name: "system-api-stubs-docs",
Anton Hansson822cdb32020-03-06 17:16:06 +0000133 defaults: ["metalava-full-api-stubs-default"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900134 api_tag_name: "SYSTEM",
135 api_filename: "system-api.txt",
136 private_api_filename: "system-private.txt",
137 private_dex_api_filename: "system-private-dex.txt",
138 removed_api_filename: "system-removed.txt",
139 arg_files: [
140 "core/res/AndroidManifest.xml",
141 ],
Anton Hansson81969c22020-02-03 20:45:56 +0000142 args: metalava_framework_docs_args + priv_apps,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900143 check_api: {
144 current: {
145 api_file: "api/system-current.txt",
146 removed_api_file: "api/system-removed.txt",
147 },
148 last_released: {
149 api_file: ":last-released-system-api",
150 removed_api_file: "api/system-removed.txt",
151 baseline_file: ":system-api-incompatibilities-with-last-released"
152 },
153 api_lint: {
154 enabled: true,
155 new_since: ":last-released-system-api",
156 baseline_file: "api/system-lint-baseline.txt",
157 },
158 },
159 jdiff_enabled: true,
160}
161
162droidstubs {
163 name: "test-api-stubs-docs",
Anton Hansson822cdb32020-03-06 17:16:06 +0000164 defaults: ["metalava-full-api-stubs-default"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900165 api_tag_name: "TEST",
166 api_filename: "test-api.txt",
167 removed_api_filename: "test-removed.txt",
168 arg_files: [
169 "core/res/AndroidManifest.xml",
170 ],
171 args: metalava_framework_docs_args + " --show-annotation android.annotation.TestApi",
172 check_api: {
173 current: {
174 api_file: "api/test-current.txt",
175 removed_api_file: "api/test-removed.txt",
176 },
177 api_lint: {
178 enabled: true,
179 baseline_file: "api/test-lint-baseline.txt",
180 },
181 },
182}
183
184/////////////////////////////////////////////////////////////////////
Jiyong Parke3095162019-12-20 15:30:28 +0900185// Following droidstubs modules are for extra APIs for modules.
186// The framework currently have two more API surfaces for modules:
187// @SystemApi(client=MODULE_APPS) and @SystemApi(client=MODULE_LIBRARIES)
188/////////////////////////////////////////////////////////////////////
189
Anton Hansson81969c22020-02-03 20:45:56 +0000190// TODO(b/146727827) remove the *-api module when we can teach metalava
Jiyong Parke3095162019-12-20 15:30:28 +0900191// about the relationship among the API surfaces. Currently, these modules are only to generate
192// the API signature files and ensure that the APIs evolve in a backwards compatible manner.
193// They however are NOT used for building the API stub.
Jiyong Parke3095162019-12-20 15:30:28 +0900194
195droidstubs {
196 name: "module-lib-api",
Anton Hansson822cdb32020-03-06 17:16:06 +0000197 defaults: ["metalava-full-api-stubs-default"],
Anton Hansson7b0414b2020-03-19 15:09:44 +0000198 api_tag_name: "MODULE_LIB",
Jiyong Parke3095162019-12-20 15:30:28 +0900199 arg_files: ["core/res/AndroidManifest.xml"],
Anton Hansson81969c22020-02-03 20:45:56 +0000200 args: metalava_framework_docs_args + module_libs,
Jiyong Parke3095162019-12-20 15:30:28 +0900201 check_api: {
202 current: {
203 api_file: "api/module-lib-current.txt",
204 removed_api_file: "api/module-lib-removed.txt",
205 },
Anton Hansson79e35c32020-02-11 14:36:40 +0000206 last_released: {
207 api_file: ":last-released-module-lib-api",
208 removed_api_file: "api/module-lib-removed.txt",
209 baseline_file: ":module-lib-api-incompatibilities-with-last-released"
210 },
211 api_lint: {
212 enabled: true,
213 new_since: ":last-released-module-lib-api",
214 baseline_file: "api/module-lib-lint-baseline.txt",
215 },
Jiyong Parke3095162019-12-20 15:30:28 +0900216 },
Jiyong Parke3095162019-12-20 15:30:28 +0900217}
218
Anton Hansson81969c22020-02-03 20:45:56 +0000219
220// The following droidstub module generates source files for the API stub library for
221// modules. Note that it not only includes its own APIs but also other APIs that have
222// narrower scope (all @SystemApis, not just the ones with 'client=MODULE_LIBRARIES').
Jiyong Parke3095162019-12-20 15:30:28 +0900223
224droidstubs {
225 name: "module-lib-api-stubs-docs",
Anton Hansson822cdb32020-03-06 17:16:06 +0000226 defaults: ["metalava-non-updatable-api-stubs-default"],
Jiyong Parke3095162019-12-20 15:30:28 +0900227 arg_files: ["core/res/AndroidManifest.xml"],
Anton Hansson81969c22020-02-03 20:45:56 +0000228 args: metalava_framework_docs_args + priv_apps + module_libs,
Jiyong Parke3095162019-12-20 15:30:28 +0900229}
230
231/////////////////////////////////////////////////////////////////////
Jiyong Park7fb4b182019-12-20 14:35:43 +0900232// android_*_stubs_current modules are the stubs libraries compiled
233// from *-api-stubs-docs
234/////////////////////////////////////////////////////////////////////
235
236java_defaults {
237 name: "framework-stubs-default",
Anton Hansson08b48bb2020-02-08 20:43:19 +0000238 libs: [ "stub-annotations" ],
239 static_libs: [ "private-stub-annotations-jar" ],
240 sdk_version: "core_current",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900241 errorprone: {
242 javacflags: [
243 "-XepDisableAllChecks",
244 ],
245 },
246 java_resources: [
247 ":notices-for-framework-stubs",
248 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900249 system_modules: "none",
250 java_version: "1.8",
251 compile_dex: true,
252}
253
254java_library_static {
255 name: "android_stubs_current",
Anton Hansson08b48bb2020-02-08 20:43:19 +0000256 srcs: [ ":api-stubs-docs" ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900257 defaults: ["framework-stubs-default"],
258}
259
260java_library_static {
261 name: "android_system_stubs_current",
Anton Hansson08b48bb2020-02-08 20:43:19 +0000262 srcs: [ ":system-api-stubs-docs" ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900263 defaults: ["framework-stubs-default"],
264}
265
266java_library_static {
267 name: "android_test_stubs_current",
Anton Hansson08b48bb2020-02-08 20:43:19 +0000268 srcs: [ ":test-api-stubs-docs" ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900269 defaults: ["framework-stubs-default"],
Jiyong Parke3095162019-12-20 15:30:28 +0900270}
271
272java_library_static {
Anton Hansson1b9cf092020-01-30 12:09:02 +0000273 name: "android_module_lib_stubs_current",
Anton Hansson08b48bb2020-02-08 20:43:19 +0000274 srcs: [ ":module-lib-api-stubs-docs" ],
Jiyong Parke3095162019-12-20 15:30:28 +0900275 defaults: ["framework-stubs-default"],
Anton Hansson822cdb32020-03-06 17:16:06 +0000276 libs: ["android_system_stubs_current"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900277}
278
Jiyong Park7fb4b182019-12-20 14:35:43 +0900279/////////////////////////////////////////////////////////////////////
280// hwbinder.stubs provides APIs required for building HIDL Java
281// libraries.
282/////////////////////////////////////////////////////////////////////
283
284droidstubs {
285 name: "hwbinder-stubs-docs",
286 srcs: [
287 "core/java/android/os/HidlSupport.java",
288 "core/java/android/annotation/IntDef.java",
289 "core/java/android/annotation/IntRange.java",
290 "core/java/android/annotation/NonNull.java",
291 "core/java/android/annotation/SystemApi.java",
292 "core/java/android/os/HidlMemory.java",
293 "core/java/android/os/HwBinder.java",
294 "core/java/android/os/HwBlob.java",
295 "core/java/android/os/HwParcel.java",
296 "core/java/android/os/IHwBinder.java",
297 "core/java/android/os/IHwInterface.java",
298 "core/java/android/os/DeadObjectException.java",
299 "core/java/android/os/DeadSystemException.java",
300 "core/java/android/os/NativeHandle.java",
301 "core/java/android/os/RemoteException.java",
302 "core/java/android/util/AndroidException.java",
303 ],
304 installable: false,
305 sdk_version: "core_platform",
306 annotations_enabled: true,
307 previous_api: ":last-released-public-api",
308 merge_annotations_dirs: [
309 "metalava-manual",
310 ],
Anton Hansson81969c22020-02-03 20:45:56 +0000311 args: priv_apps,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900312}
313
314java_library_static {
315 name: "hwbinder.stubs",
316 sdk_version: "core_current",
317 srcs: [
318 ":hwbinder-stubs-docs",
319 ],
320}
321
322/////////////////////////////////////////////////////////////////////
323// Stubs for hiddenapi processing.
324/////////////////////////////////////////////////////////////////////
325
326droidstubs {
327 name: "hiddenapi-lists-docs",
Anton Hansson822cdb32020-03-06 17:16:06 +0000328 defaults: ["metalava-full-api-stubs-default"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900329 arg_files: [
330 "core/res/AndroidManifest.xml",
331 ],
332 dex_api_filename: "public-dex.txt",
333 private_dex_api_filename: "private-dex.txt",
334 removed_dex_api_filename: "removed-dex.txt",
335 args: metalava_framework_docs_args +
336 " --show-unannotated " +
Anton Hansson81969c22020-02-03 20:45:56 +0000337 priv_apps +
Jiyong Park7fb4b182019-12-20 14:35:43 +0900338 " --show-annotation android.annotation.TestApi ",
339}
340
341droidstubs {
342 name: "hiddenapi-mappings",
Anton Hansson822cdb32020-03-06 17:16:06 +0000343 defaults: ["metalava-full-api-stubs-default"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900344 srcs: [
345 ":opt-telephony-common-srcs",
346 ],
347
348 arg_files: [
349 "core/res/AndroidManifest.xml",
350 ],
351 dex_mapping_filename: "dex-mapping.txt",
352 args: metalava_framework_docs_args +
353 " --hide ReferencesHidden " +
354 " --hide UnhiddenSystemApi " +
355 " --show-unannotated " +
Anton Hansson81969c22020-02-03 20:45:56 +0000356 priv_apps +
Jiyong Park7fb4b182019-12-20 14:35:43 +0900357 " --show-annotation android.annotation.TestApi ",
358}
359
360/////////////////////////////////////////////////////////////////////
361// api/*-current.txt files for use by modules in other directories
362// like the CTS test
363/////////////////////////////////////////////////////////////////////
364
365filegroup {
366 name: "frameworks-base-api-current.txt",
367 srcs: [
368 "api/current.txt",
369 ],
370}
371
372filegroup {
373 name: "frameworks-base-api-system-current.txt",
374 srcs: [
375 "api/system-current.txt",
376 ],
377}
378
379filegroup {
380 name: "frameworks-base-api-system-removed.txt",
381 srcs: [
382 "api/system-removed.txt",
383 ],
384}