blob: 84693623da2b5cd80e539bfe23da5842d09de846 [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 Park2e6cdcc2019-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",
Jiyong Park7fb4b182019-12-20 14:35:43 +090052 ],
53 libs: ["framework-internal-utils"],
54 installable: false,
55 annotations_enabled: true,
56 previous_api: ":last-released-public-api",
57 merge_annotations_dirs: [
58 "metalava-manual",
59 ],
Aurimas Liutikas94bac9c2020-03-12 17:06:12 -070060 api_levels_annotations_enabled: false,
Jiyong Park7fb4b182019-12-20 14:35:43 +090061 filter_packages: packages_to_document,
62}
63
Jiyong Park2e6cdcc2019-12-20 15:30:28 +090064stubs_defaults {
65 name: "metalava-api-stubs-default",
66 defaults: ["metalava-non-updatable-api-stubs-default"],
67 srcs: [":framework-updatable-sources"],
68 sdk_version: "core_platform",
69}
70
Jiyong Park7fb4b182019-12-20 14:35:43 +090071/////////////////////////////////////////////////////////////////////
72// *-api-stubs-docs modules providing source files for the stub libraries
73/////////////////////////////////////////////////////////////////////
74
Jiyong Park2e6cdcc2019-12-20 15:30:28 +090075// api-stubs-docs, system-api-stubs-docs, and test-api-stubs-docs have APIs
76// from the non-updatable part of the platform as well as from the updatable
77// modules
Jiyong Park7fb4b182019-12-20 14:35:43 +090078droidstubs {
79 name: "api-stubs-docs",
80 defaults: ["metalava-api-stubs-default"],
81 api_filename: "public_api.txt",
82 private_api_filename: "private.txt",
83 removed_api_filename: "removed.txt",
84 arg_files: [
85 "core/res/AndroidManifest.xml",
86 ],
87 args: metalava_framework_docs_args,
88 check_api: {
89 current: {
90 api_file: "api/current.txt",
91 removed_api_file: "api/removed.txt",
92 },
93 last_released: {
94 api_file: ":last-released-public-api",
95 removed_api_file: "api/removed.txt",
96 baseline_file: ":public-api-incompatibilities-with-last-released",
97 },
98 api_lint: {
99 enabled: true,
100 new_since: ":last-released-public-api",
101 baseline_file: "api/lint-baseline.txt",
102 },
103 },
104 jdiff_enabled: true,
105}
106
Anton Hansson81969c22020-02-03 20:45:56 +0000107priv_apps = " " +
108 "--show-annotation android.annotation.SystemApi\\(" +
109 "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
110 "\\) "
111
112module_libs = " " +
113 " --show-annotation android.annotation.SystemApi\\(" +
114 "client=android.annotation.SystemApi.Client.MODULE_LIBRARIES" +
115 "\\) "
116
Jiyong Park7fb4b182019-12-20 14:35:43 +0900117droidstubs {
118 name: "system-api-stubs-docs",
119 defaults: ["metalava-api-stubs-default"],
120 api_tag_name: "SYSTEM",
121 api_filename: "system-api.txt",
122 private_api_filename: "system-private.txt",
123 private_dex_api_filename: "system-private-dex.txt",
124 removed_api_filename: "system-removed.txt",
125 arg_files: [
126 "core/res/AndroidManifest.xml",
127 ],
Anton Hansson81969c22020-02-03 20:45:56 +0000128 args: metalava_framework_docs_args + priv_apps,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900129 check_api: {
130 current: {
131 api_file: "api/system-current.txt",
132 removed_api_file: "api/system-removed.txt",
133 },
134 last_released: {
135 api_file: ":last-released-system-api",
136 removed_api_file: "api/system-removed.txt",
137 baseline_file: ":system-api-incompatibilities-with-last-released"
138 },
139 api_lint: {
140 enabled: true,
141 new_since: ":last-released-system-api",
142 baseline_file: "api/system-lint-baseline.txt",
143 },
144 },
145 jdiff_enabled: true,
146}
147
148droidstubs {
149 name: "test-api-stubs-docs",
150 defaults: ["metalava-api-stubs-default"],
151 api_tag_name: "TEST",
152 api_filename: "test-api.txt",
153 removed_api_filename: "test-removed.txt",
154 arg_files: [
155 "core/res/AndroidManifest.xml",
156 ],
157 args: metalava_framework_docs_args + " --show-annotation android.annotation.TestApi",
158 check_api: {
159 current: {
160 api_file: "api/test-current.txt",
161 removed_api_file: "api/test-removed.txt",
162 },
163 api_lint: {
164 enabled: true,
165 baseline_file: "api/test-lint-baseline.txt",
166 },
167 },
168}
169
170/////////////////////////////////////////////////////////////////////
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900171// Following droidstubs modules are for extra APIs for modules.
172// The framework currently have two more API surfaces for modules:
173// @SystemApi(client=MODULE_APPS) and @SystemApi(client=MODULE_LIBRARIES)
174/////////////////////////////////////////////////////////////////////
175
Anton Hansson81969c22020-02-03 20:45:56 +0000176// TODO(b/146727827) remove the *-api module when we can teach metalava
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900177// about the relationship among the API surfaces. Currently, these modules are only to generate
178// the API signature files and ensure that the APIs evolve in a backwards compatible manner.
179// They however are NOT used for building the API stub.
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900180
181droidstubs {
182 name: "module-lib-api",
Anton Hanssonc3668112020-01-17 13:42:43 +0000183 defaults: ["metalava-api-stubs-default"],
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900184 arg_files: ["core/res/AndroidManifest.xml"],
Anton Hansson81969c22020-02-03 20:45:56 +0000185 args: metalava_framework_docs_args + module_libs,
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900186 check_api: {
187 current: {
188 api_file: "api/module-lib-current.txt",
189 removed_api_file: "api/module-lib-removed.txt",
190 },
Anton Hansson626afea2020-02-11 14:36:40 +0000191 last_released: {
192 api_file: ":last-released-module-lib-api",
193 removed_api_file: "api/module-lib-removed.txt",
194 baseline_file: ":module-lib-api-incompatibilities-with-last-released"
195 },
196 api_lint: {
197 enabled: true,
198 new_since: ":last-released-module-lib-api",
199 baseline_file: "api/module-lib-lint-baseline.txt",
200 },
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900201 },
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900202}
203
Anton Hansson81969c22020-02-03 20:45:56 +0000204
205// The following droidstub module generates source files for the API stub library for
206// modules. Note that it not only includes its own APIs but also other APIs that have
207// narrower scope (all @SystemApis, not just the ones with 'client=MODULE_LIBRARIES').
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900208
209droidstubs {
210 name: "module-lib-api-stubs-docs",
Anton Hanssonc3668112020-01-17 13:42:43 +0000211 defaults: ["metalava-api-stubs-default"],
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900212 arg_files: ["core/res/AndroidManifest.xml"],
Anton Hansson81969c22020-02-03 20:45:56 +0000213 args: metalava_framework_docs_args + priv_apps + module_libs,
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900214}
215
216/////////////////////////////////////////////////////////////////////
Jiyong Park7fb4b182019-12-20 14:35:43 +0900217// android_*_stubs_current modules are the stubs libraries compiled
218// from *-api-stubs-docs
219/////////////////////////////////////////////////////////////////////
220
221java_defaults {
222 name: "framework-stubs-default",
Anton Hansson42afd612020-02-08 20:43:19 +0000223 libs: [ "stub-annotations" ],
224 static_libs: [ "private-stub-annotations-jar" ],
225 sdk_version: "core_current",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900226 errorprone: {
227 javacflags: [
228 "-XepDisableAllChecks",
229 ],
230 },
231 java_resources: [
232 ":notices-for-framework-stubs",
233 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900234 system_modules: "none",
235 java_version: "1.8",
236 compile_dex: true,
237}
238
239java_library_static {
240 name: "android_stubs_current",
Anton Hansson42afd612020-02-08 20:43:19 +0000241 srcs: [ ":api-stubs-docs" ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900242 defaults: ["framework-stubs-default"],
243}
244
245java_library_static {
246 name: "android_system_stubs_current",
Anton Hansson42afd612020-02-08 20:43:19 +0000247 srcs: [ ":system-api-stubs-docs" ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900248 defaults: ["framework-stubs-default"],
249}
250
251java_library_static {
252 name: "android_test_stubs_current",
Anton Hansson42afd612020-02-08 20:43:19 +0000253 srcs: [ ":test-api-stubs-docs" ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900254 defaults: ["framework-stubs-default"],
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900255}
256
257java_library_static {
Anton Hansson9c4bbe92020-01-30 12:09:02 +0000258 name: "android_module_lib_stubs_current",
Anton Hansson42afd612020-02-08 20:43:19 +0000259 srcs: [ ":module-lib-api-stubs-docs" ],
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900260 defaults: ["framework-stubs-default"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900261}
262
Jiyong Park7fb4b182019-12-20 14:35:43 +0900263/////////////////////////////////////////////////////////////////////
264// hwbinder.stubs provides APIs required for building HIDL Java
265// libraries.
266/////////////////////////////////////////////////////////////////////
267
268droidstubs {
269 name: "hwbinder-stubs-docs",
270 srcs: [
271 "core/java/android/os/HidlSupport.java",
272 "core/java/android/annotation/IntDef.java",
273 "core/java/android/annotation/IntRange.java",
274 "core/java/android/annotation/NonNull.java",
275 "core/java/android/annotation/SystemApi.java",
276 "core/java/android/os/HidlMemory.java",
277 "core/java/android/os/HwBinder.java",
278 "core/java/android/os/HwBlob.java",
279 "core/java/android/os/HwParcel.java",
280 "core/java/android/os/IHwBinder.java",
281 "core/java/android/os/IHwInterface.java",
282 "core/java/android/os/DeadObjectException.java",
283 "core/java/android/os/DeadSystemException.java",
284 "core/java/android/os/NativeHandle.java",
285 "core/java/android/os/RemoteException.java",
286 "core/java/android/util/AndroidException.java",
287 ],
288 installable: false,
289 sdk_version: "core_platform",
290 annotations_enabled: true,
291 previous_api: ":last-released-public-api",
292 merge_annotations_dirs: [
293 "metalava-manual",
294 ],
Anton Hansson81969c22020-02-03 20:45:56 +0000295 args: priv_apps,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900296}
297
298java_library_static {
299 name: "hwbinder.stubs",
300 sdk_version: "core_current",
301 srcs: [
302 ":hwbinder-stubs-docs",
303 ],
304}
305
306/////////////////////////////////////////////////////////////////////
307// Stubs for hiddenapi processing.
308/////////////////////////////////////////////////////////////////////
309
310droidstubs {
311 name: "hiddenapi-lists-docs",
312 defaults: ["metalava-api-stubs-default"],
313 arg_files: [
314 "core/res/AndroidManifest.xml",
315 ],
316 dex_api_filename: "public-dex.txt",
317 private_dex_api_filename: "private-dex.txt",
318 removed_dex_api_filename: "removed-dex.txt",
319 args: metalava_framework_docs_args +
320 " --show-unannotated " +
Anton Hansson81969c22020-02-03 20:45:56 +0000321 priv_apps +
Jiyong Park7fb4b182019-12-20 14:35:43 +0900322 " --show-annotation android.annotation.TestApi ",
323}
324
325droidstubs {
326 name: "hiddenapi-mappings",
327 defaults: ["metalava-api-stubs-default"],
328 srcs: [
329 ":opt-telephony-common-srcs",
330 ],
331
332 arg_files: [
333 "core/res/AndroidManifest.xml",
334 ],
335 dex_mapping_filename: "dex-mapping.txt",
336 args: metalava_framework_docs_args +
337 " --hide ReferencesHidden " +
338 " --hide UnhiddenSystemApi " +
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
344/////////////////////////////////////////////////////////////////////
345// api/*-current.txt files for use by modules in other directories
346// like the CTS test
347/////////////////////////////////////////////////////////////////////
348
349filegroup {
350 name: "frameworks-base-api-current.txt",
351 srcs: [
352 "api/current.txt",
353 ],
354}
355
356filegroup {
357 name: "frameworks-base-api-system-current.txt",
358 srcs: [
359 "api/system-current.txt",
360 ],
361}
362
363filegroup {
364 name: "frameworks-base-api-system-removed.txt",
365 srcs: [
366 "api/system-removed.txt",
367 ],
368}