blob: 50d23ad2d65769d54ca64d398519ccee1b8ac48e [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 },
200 // TODO(b/147559833) enable the compatibility check against the last release API
201 // and the API lint
202 //last_released: {
203 // api_file: ":last-released-module-lib-api",
204 // removed_api_file: "api/module-lib-removed.txt",
205 // baseline_file: ":module-lib-api-incompatibilities-with-last-released"
206 //},
207 //api_lint: {
208 // enabled: true,
209 // new_since: ":last-released-module-lib-api",
210 // baseline_file: "api/module-lib-lint-baseline.txt",
211 //},
212 },
213 //jdiff_enabled: true,
214}
215
Anton Hansson81969c22020-02-03 20:45:56 +0000216
217// The following droidstub module generates source files for the API stub library for
218// modules. Note that it not only includes its own APIs but also other APIs that have
219// narrower scope (all @SystemApis, not just the ones with 'client=MODULE_LIBRARIES').
Jiyong Parke3095162019-12-20 15:30:28 +0900220
221droidstubs {
222 name: "module-lib-api-stubs-docs",
Anton Hansson970c0532020-01-17 13:42:43 +0000223 defaults: ["metalava-api-stubs-default"],
Jiyong Parke3095162019-12-20 15:30:28 +0900224 arg_files: ["core/res/AndroidManifest.xml"],
Anton Hansson81969c22020-02-03 20:45:56 +0000225 args: metalava_framework_docs_args + priv_apps + module_libs,
Jiyong Parke3095162019-12-20 15:30:28 +0900226}
227
228/////////////////////////////////////////////////////////////////////
Jiyong Park7fb4b182019-12-20 14:35:43 +0900229// android_*_stubs_current modules are the stubs libraries compiled
230// from *-api-stubs-docs
231/////////////////////////////////////////////////////////////////////
232
233java_defaults {
234 name: "framework-stubs-default",
Anton Hansson08b48bb2020-02-08 20:43:19 +0000235 libs: [ "stub-annotations" ],
236 static_libs: [ "private-stub-annotations-jar" ],
237 sdk_version: "core_current",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900238 errorprone: {
239 javacflags: [
240 "-XepDisableAllChecks",
241 ],
242 },
243 java_resources: [
244 ":notices-for-framework-stubs",
245 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900246 system_modules: "none",
247 java_version: "1.8",
248 compile_dex: true,
249}
250
251java_library_static {
252 name: "android_stubs_current",
Anton Hansson08b48bb2020-02-08 20:43:19 +0000253 srcs: [ ":api-stubs-docs" ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900254 defaults: ["framework-stubs-default"],
255}
256
257java_library_static {
258 name: "android_system_stubs_current",
Anton Hansson08b48bb2020-02-08 20:43:19 +0000259 srcs: [ ":system-api-stubs-docs" ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900260 defaults: ["framework-stubs-default"],
261}
262
263java_library_static {
264 name: "android_test_stubs_current",
Anton Hansson08b48bb2020-02-08 20:43:19 +0000265 srcs: [ ":test-api-stubs-docs" ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900266 defaults: ["framework-stubs-default"],
Jiyong Parke3095162019-12-20 15:30:28 +0900267}
268
269java_library_static {
Anton Hansson1b9cf092020-01-30 12:09:02 +0000270 name: "android_module_lib_stubs_current",
Anton Hansson08b48bb2020-02-08 20:43:19 +0000271 srcs: [ ":module-lib-api-stubs-docs" ],
Jiyong Parke3095162019-12-20 15:30:28 +0900272 defaults: ["framework-stubs-default"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900273}
274
Jiyong Park7fb4b182019-12-20 14:35:43 +0900275/////////////////////////////////////////////////////////////////////
276// hwbinder.stubs provides APIs required for building HIDL Java
277// libraries.
278/////////////////////////////////////////////////////////////////////
279
280droidstubs {
281 name: "hwbinder-stubs-docs",
282 srcs: [
283 "core/java/android/os/HidlSupport.java",
284 "core/java/android/annotation/IntDef.java",
285 "core/java/android/annotation/IntRange.java",
286 "core/java/android/annotation/NonNull.java",
287 "core/java/android/annotation/SystemApi.java",
288 "core/java/android/os/HidlMemory.java",
289 "core/java/android/os/HwBinder.java",
290 "core/java/android/os/HwBlob.java",
291 "core/java/android/os/HwParcel.java",
292 "core/java/android/os/IHwBinder.java",
293 "core/java/android/os/IHwInterface.java",
294 "core/java/android/os/DeadObjectException.java",
295 "core/java/android/os/DeadSystemException.java",
296 "core/java/android/os/NativeHandle.java",
297 "core/java/android/os/RemoteException.java",
298 "core/java/android/util/AndroidException.java",
299 ],
300 installable: false,
301 sdk_version: "core_platform",
302 annotations_enabled: true,
303 previous_api: ":last-released-public-api",
304 merge_annotations_dirs: [
305 "metalava-manual",
306 ],
Anton Hansson81969c22020-02-03 20:45:56 +0000307 args: priv_apps,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900308}
309
310java_library_static {
311 name: "hwbinder.stubs",
312 sdk_version: "core_current",
313 srcs: [
314 ":hwbinder-stubs-docs",
315 ],
316}
317
318/////////////////////////////////////////////////////////////////////
319// Stubs for hiddenapi processing.
320/////////////////////////////////////////////////////////////////////
321
322droidstubs {
323 name: "hiddenapi-lists-docs",
324 defaults: ["metalava-api-stubs-default"],
325 arg_files: [
326 "core/res/AndroidManifest.xml",
327 ],
328 dex_api_filename: "public-dex.txt",
329 private_dex_api_filename: "private-dex.txt",
330 removed_dex_api_filename: "removed-dex.txt",
331 args: metalava_framework_docs_args +
332 " --show-unannotated " +
Anton Hansson81969c22020-02-03 20:45:56 +0000333 priv_apps +
Jiyong Park7fb4b182019-12-20 14:35:43 +0900334 " --show-annotation android.annotation.TestApi ",
335}
336
337droidstubs {
338 name: "hiddenapi-mappings",
339 defaults: ["metalava-api-stubs-default"],
340 srcs: [
341 ":opt-telephony-common-srcs",
342 ],
343
344 arg_files: [
345 "core/res/AndroidManifest.xml",
346 ],
347 dex_mapping_filename: "dex-mapping.txt",
348 args: metalava_framework_docs_args +
349 " --hide ReferencesHidden " +
350 " --hide UnhiddenSystemApi " +
351 " --show-unannotated " +
Anton Hansson81969c22020-02-03 20:45:56 +0000352 priv_apps +
Jiyong Park7fb4b182019-12-20 14:35:43 +0900353 " --show-annotation android.annotation.TestApi ",
354}
355
356/////////////////////////////////////////////////////////////////////
357// api/*-current.txt files for use by modules in other directories
358// like the CTS test
359/////////////////////////////////////////////////////////////////////
360
361filegroup {
362 name: "frameworks-base-api-current.txt",
363 srcs: [
364 "api/current.txt",
365 ],
366}
367
368filegroup {
369 name: "frameworks-base-api-system-current.txt",
370 srcs: [
371 "api/system-current.txt",
372 ],
373}
374
375filegroup {
376 name: "frameworks-base-api-system-removed.txt",
377 srcs: [
378 "api/system-removed.txt",
379 ],
380}