blob: 4616ced1226c3865f3ec9373ae25a549b704ad71 [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
Anton Hansson81969c22020-02-03 20:45:56 +0000116priv_apps = " " +
117 "--show-annotation android.annotation.SystemApi\\(" +
118 "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
119 "\\) "
120
121module_libs = " " +
122 " --show-annotation android.annotation.SystemApi\\(" +
123 "client=android.annotation.SystemApi.Client.MODULE_LIBRARIES" +
124 "\\) "
125
Jiyong Park7fb4b182019-12-20 14:35:43 +0900126droidstubs {
127 name: "system-api-stubs-docs",
128 defaults: ["metalava-api-stubs-default"],
129 api_tag_name: "SYSTEM",
130 api_filename: "system-api.txt",
131 private_api_filename: "system-private.txt",
132 private_dex_api_filename: "system-private-dex.txt",
133 removed_api_filename: "system-removed.txt",
134 arg_files: [
135 "core/res/AndroidManifest.xml",
136 ],
Anton Hansson81969c22020-02-03 20:45:56 +0000137 args: metalava_framework_docs_args + priv_apps,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900138 check_api: {
139 current: {
140 api_file: "api/system-current.txt",
141 removed_api_file: "api/system-removed.txt",
142 },
143 last_released: {
144 api_file: ":last-released-system-api",
145 removed_api_file: "api/system-removed.txt",
146 baseline_file: ":system-api-incompatibilities-with-last-released"
147 },
148 api_lint: {
149 enabled: true,
150 new_since: ":last-released-system-api",
151 baseline_file: "api/system-lint-baseline.txt",
152 },
153 },
154 jdiff_enabled: true,
155}
156
157droidstubs {
158 name: "test-api-stubs-docs",
159 defaults: ["metalava-api-stubs-default"],
160 api_tag_name: "TEST",
161 api_filename: "test-api.txt",
162 removed_api_filename: "test-removed.txt",
163 arg_files: [
164 "core/res/AndroidManifest.xml",
165 ],
166 args: metalava_framework_docs_args + " --show-annotation android.annotation.TestApi",
167 check_api: {
168 current: {
169 api_file: "api/test-current.txt",
170 removed_api_file: "api/test-removed.txt",
171 },
172 api_lint: {
173 enabled: true,
174 baseline_file: "api/test-lint-baseline.txt",
175 },
176 },
177}
178
179/////////////////////////////////////////////////////////////////////
Jiyong Parke3095162019-12-20 15:30:28 +0900180// Following droidstubs modules are for extra APIs for modules.
181// The framework currently have two more API surfaces for modules:
182// @SystemApi(client=MODULE_APPS) and @SystemApi(client=MODULE_LIBRARIES)
183/////////////////////////////////////////////////////////////////////
184
Anton Hansson81969c22020-02-03 20:45:56 +0000185// TODO(b/146727827) remove the *-api module when we can teach metalava
Jiyong Parke3095162019-12-20 15:30:28 +0900186// about the relationship among the API surfaces. Currently, these modules are only to generate
187// the API signature files and ensure that the APIs evolve in a backwards compatible manner.
188// They however are NOT used for building the API stub.
Jiyong Parke3095162019-12-20 15:30:28 +0900189
190droidstubs {
191 name: "module-lib-api",
Anton Hansson970c0532020-01-17 13:42:43 +0000192 defaults: ["metalava-api-stubs-default"],
Jiyong Parke3095162019-12-20 15:30:28 +0900193 arg_files: ["core/res/AndroidManifest.xml"],
Anton Hansson81969c22020-02-03 20:45:56 +0000194 args: metalava_framework_docs_args + module_libs,
Jiyong Parke3095162019-12-20 15:30:28 +0900195 check_api: {
196 current: {
197 api_file: "api/module-lib-current.txt",
198 removed_api_file: "api/module-lib-removed.txt",
199 },
Anton Hansson79e35c32020-02-11 14:36:40 +0000200 last_released: {
201 api_file: ":last-released-module-lib-api",
202 removed_api_file: "api/module-lib-removed.txt",
203 baseline_file: ":module-lib-api-incompatibilities-with-last-released"
204 },
205 api_lint: {
206 enabled: true,
207 new_since: ":last-released-module-lib-api",
208 baseline_file: "api/module-lib-lint-baseline.txt",
209 },
Jiyong Parke3095162019-12-20 15:30:28 +0900210 },
Jiyong Parke3095162019-12-20 15:30:28 +0900211}
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 Parke3095162019-12-20 15:30:28 +0900217
218droidstubs {
219 name: "module-lib-api-stubs-docs",
Anton Hansson970c0532020-01-17 13:42:43 +0000220 defaults: ["metalava-api-stubs-default"],
Jiyong Parke3095162019-12-20 15:30:28 +0900221 arg_files: ["core/res/AndroidManifest.xml"],
Anton Hansson81969c22020-02-03 20:45:56 +0000222 args: metalava_framework_docs_args + priv_apps + module_libs,
Jiyong Parke3095162019-12-20 15:30:28 +0900223}
224
225/////////////////////////////////////////////////////////////////////
Jiyong Park7fb4b182019-12-20 14:35:43 +0900226// android_*_stubs_current modules are the stubs libraries compiled
227// from *-api-stubs-docs
228/////////////////////////////////////////////////////////////////////
229
230java_defaults {
231 name: "framework-stubs-default",
Anton Hansson08b48bb2020-02-08 20:43:19 +0000232 libs: [ "stub-annotations" ],
233 static_libs: [ "private-stub-annotations-jar" ],
234 sdk_version: "core_current",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900235 errorprone: {
236 javacflags: [
237 "-XepDisableAllChecks",
238 ],
239 },
240 java_resources: [
241 ":notices-for-framework-stubs",
242 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900243 system_modules: "none",
244 java_version: "1.8",
245 compile_dex: true,
246}
247
248java_library_static {
249 name: "android_stubs_current",
Anton Hansson08b48bb2020-02-08 20:43:19 +0000250 srcs: [ ":api-stubs-docs" ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900251 defaults: ["framework-stubs-default"],
252}
253
254java_library_static {
255 name: "android_system_stubs_current",
Anton Hansson08b48bb2020-02-08 20:43:19 +0000256 srcs: [ ":system-api-stubs-docs" ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900257 defaults: ["framework-stubs-default"],
258}
259
260java_library_static {
261 name: "android_test_stubs_current",
Anton Hansson08b48bb2020-02-08 20:43:19 +0000262 srcs: [ ":test-api-stubs-docs" ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900263 defaults: ["framework-stubs-default"],
Jiyong Parke3095162019-12-20 15:30:28 +0900264}
265
266java_library_static {
Anton Hansson1b9cf092020-01-30 12:09:02 +0000267 name: "android_module_lib_stubs_current",
Anton Hansson08b48bb2020-02-08 20:43:19 +0000268 srcs: [ ":module-lib-api-stubs-docs" ],
Jiyong Parke3095162019-12-20 15:30:28 +0900269 defaults: ["framework-stubs-default"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900270}
271
Jiyong Park7fb4b182019-12-20 14:35:43 +0900272/////////////////////////////////////////////////////////////////////
273// hwbinder.stubs provides APIs required for building HIDL Java
274// libraries.
275/////////////////////////////////////////////////////////////////////
276
277droidstubs {
278 name: "hwbinder-stubs-docs",
279 srcs: [
280 "core/java/android/os/HidlSupport.java",
281 "core/java/android/annotation/IntDef.java",
282 "core/java/android/annotation/IntRange.java",
283 "core/java/android/annotation/NonNull.java",
284 "core/java/android/annotation/SystemApi.java",
285 "core/java/android/os/HidlMemory.java",
286 "core/java/android/os/HwBinder.java",
287 "core/java/android/os/HwBlob.java",
288 "core/java/android/os/HwParcel.java",
289 "core/java/android/os/IHwBinder.java",
290 "core/java/android/os/IHwInterface.java",
291 "core/java/android/os/DeadObjectException.java",
292 "core/java/android/os/DeadSystemException.java",
293 "core/java/android/os/NativeHandle.java",
294 "core/java/android/os/RemoteException.java",
295 "core/java/android/util/AndroidException.java",
296 ],
297 installable: false,
298 sdk_version: "core_platform",
299 annotations_enabled: true,
300 previous_api: ":last-released-public-api",
301 merge_annotations_dirs: [
302 "metalava-manual",
303 ],
Anton Hansson81969c22020-02-03 20:45:56 +0000304 args: priv_apps,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900305}
306
307java_library_static {
308 name: "hwbinder.stubs",
309 sdk_version: "core_current",
310 srcs: [
311 ":hwbinder-stubs-docs",
312 ],
313}
314
315/////////////////////////////////////////////////////////////////////
316// Stubs for hiddenapi processing.
317/////////////////////////////////////////////////////////////////////
318
319droidstubs {
320 name: "hiddenapi-lists-docs",
321 defaults: ["metalava-api-stubs-default"],
322 arg_files: [
323 "core/res/AndroidManifest.xml",
324 ],
325 dex_api_filename: "public-dex.txt",
326 private_dex_api_filename: "private-dex.txt",
327 removed_dex_api_filename: "removed-dex.txt",
328 args: metalava_framework_docs_args +
329 " --show-unannotated " +
Anton Hansson81969c22020-02-03 20:45:56 +0000330 priv_apps +
Jiyong Park7fb4b182019-12-20 14:35:43 +0900331 " --show-annotation android.annotation.TestApi ",
332}
333
334droidstubs {
335 name: "hiddenapi-mappings",
336 defaults: ["metalava-api-stubs-default"],
337 srcs: [
338 ":opt-telephony-common-srcs",
339 ],
340
341 arg_files: [
342 "core/res/AndroidManifest.xml",
343 ],
344 dex_mapping_filename: "dex-mapping.txt",
345 args: metalava_framework_docs_args +
346 " --hide ReferencesHidden " +
347 " --hide UnhiddenSystemApi " +
348 " --show-unannotated " +
Anton Hansson81969c22020-02-03 20:45:56 +0000349 priv_apps +
Jiyong Park7fb4b182019-12-20 14:35:43 +0900350 " --show-annotation android.annotation.TestApi ",
351}
352
353/////////////////////////////////////////////////////////////////////
354// api/*-current.txt files for use by modules in other directories
355// like the CTS test
356/////////////////////////////////////////////////////////////////////
357
358filegroup {
359 name: "frameworks-base-api-current.txt",
360 srcs: [
361 "api/current.txt",
362 ],
363}
364
365filegroup {
366 name: "frameworks-base-api-system-current.txt",
367 srcs: [
368 "api/system-current.txt",
369 ],
370}
371
372filegroup {
373 name: "frameworks-base-api-system-removed.txt",
374 srcs: [
375 "api/system-removed.txt",
376 ],
377}