blob: 84b36255df51c96bbef8b134bb636509ebafac64 [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 ],
60 api_levels_annotations_enabled: true,
61 api_levels_annotations_dirs: [
62 "sdk-dir",
63 "api-versions-jars-dir",
64 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +090065 filter_packages: packages_to_document,
66}
67
Jiyong Park2e6cdcc2019-12-20 15:30:28 +090068stubs_defaults {
69 name: "metalava-api-stubs-default",
70 defaults: ["metalava-non-updatable-api-stubs-default"],
71 srcs: [":framework-updatable-sources"],
72 sdk_version: "core_platform",
73}
74
Jiyong Park7fb4b182019-12-20 14:35:43 +090075/////////////////////////////////////////////////////////////////////
76// *-api-stubs-docs modules providing source files for the stub libraries
77/////////////////////////////////////////////////////////////////////
78
Jiyong Park2e6cdcc2019-12-20 15:30:28 +090079// api-stubs-docs, system-api-stubs-docs, and test-api-stubs-docs have APIs
80// from the non-updatable part of the platform as well as from the updatable
81// modules
Jiyong Park7fb4b182019-12-20 14:35:43 +090082droidstubs {
83 name: "api-stubs-docs",
84 defaults: ["metalava-api-stubs-default"],
85 api_filename: "public_api.txt",
86 private_api_filename: "private.txt",
87 removed_api_filename: "removed.txt",
88 arg_files: [
89 "core/res/AndroidManifest.xml",
90 ],
91 args: metalava_framework_docs_args,
92 check_api: {
93 current: {
94 api_file: "api/current.txt",
95 removed_api_file: "api/removed.txt",
96 },
97 last_released: {
98 api_file: ":last-released-public-api",
99 removed_api_file: "api/removed.txt",
100 baseline_file: ":public-api-incompatibilities-with-last-released",
101 },
102 api_lint: {
103 enabled: true,
104 new_since: ":last-released-public-api",
105 baseline_file: "api/lint-baseline.txt",
106 },
107 },
108 jdiff_enabled: true,
109}
110
Anton Hansson81969c22020-02-03 20:45:56 +0000111priv_apps = " " +
112 "--show-annotation android.annotation.SystemApi\\(" +
113 "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
114 "\\) "
115
116module_libs = " " +
117 " --show-annotation android.annotation.SystemApi\\(" +
118 "client=android.annotation.SystemApi.Client.MODULE_LIBRARIES" +
119 "\\) "
120
Jiyong Park7fb4b182019-12-20 14:35:43 +0900121droidstubs {
122 name: "system-api-stubs-docs",
123 defaults: ["metalava-api-stubs-default"],
124 api_tag_name: "SYSTEM",
125 api_filename: "system-api.txt",
126 private_api_filename: "system-private.txt",
127 private_dex_api_filename: "system-private-dex.txt",
128 removed_api_filename: "system-removed.txt",
129 arg_files: [
130 "core/res/AndroidManifest.xml",
131 ],
Anton Hansson81969c22020-02-03 20:45:56 +0000132 args: metalava_framework_docs_args + priv_apps,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900133 check_api: {
134 current: {
135 api_file: "api/system-current.txt",
136 removed_api_file: "api/system-removed.txt",
137 },
138 last_released: {
139 api_file: ":last-released-system-api",
140 removed_api_file: "api/system-removed.txt",
141 baseline_file: ":system-api-incompatibilities-with-last-released"
142 },
143 api_lint: {
144 enabled: true,
145 new_since: ":last-released-system-api",
146 baseline_file: "api/system-lint-baseline.txt",
147 },
148 },
149 jdiff_enabled: true,
150}
151
152droidstubs {
153 name: "test-api-stubs-docs",
154 defaults: ["metalava-api-stubs-default"],
155 api_tag_name: "TEST",
156 api_filename: "test-api.txt",
157 removed_api_filename: "test-removed.txt",
158 arg_files: [
159 "core/res/AndroidManifest.xml",
160 ],
161 args: metalava_framework_docs_args + " --show-annotation android.annotation.TestApi",
162 check_api: {
163 current: {
164 api_file: "api/test-current.txt",
165 removed_api_file: "api/test-removed.txt",
166 },
167 api_lint: {
168 enabled: true,
169 baseline_file: "api/test-lint-baseline.txt",
170 },
171 },
172}
173
174/////////////////////////////////////////////////////////////////////
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900175// Following droidstubs modules are for extra APIs for modules.
176// The framework currently have two more API surfaces for modules:
177// @SystemApi(client=MODULE_APPS) and @SystemApi(client=MODULE_LIBRARIES)
178/////////////////////////////////////////////////////////////////////
179
Anton Hansson81969c22020-02-03 20:45:56 +0000180// TODO(b/146727827) remove the *-api module when we can teach metalava
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900181// about the relationship among the API surfaces. Currently, these modules are only to generate
182// the API signature files and ensure that the APIs evolve in a backwards compatible manner.
183// They however are NOT used for building the API stub.
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900184
185droidstubs {
186 name: "module-lib-api",
Anton Hanssonc3668112020-01-17 13:42:43 +0000187 defaults: ["metalava-api-stubs-default"],
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900188 arg_files: ["core/res/AndroidManifest.xml"],
Anton Hansson81969c22020-02-03 20:45:56 +0000189 args: metalava_framework_docs_args + module_libs,
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900190 check_api: {
191 current: {
192 api_file: "api/module-lib-current.txt",
193 removed_api_file: "api/module-lib-removed.txt",
194 },
Anton Hansson626afea2020-02-11 14:36:40 +0000195 last_released: {
196 api_file: ":last-released-module-lib-api",
197 removed_api_file: "api/module-lib-removed.txt",
198 baseline_file: ":module-lib-api-incompatibilities-with-last-released"
199 },
200 api_lint: {
201 enabled: true,
202 new_since: ":last-released-module-lib-api",
203 baseline_file: "api/module-lib-lint-baseline.txt",
204 },
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900205 },
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900206}
207
Anton Hansson81969c22020-02-03 20:45:56 +0000208
209// The following droidstub module generates source files for the API stub library for
210// modules. Note that it not only includes its own APIs but also other APIs that have
211// narrower scope (all @SystemApis, not just the ones with 'client=MODULE_LIBRARIES').
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900212
213droidstubs {
214 name: "module-lib-api-stubs-docs",
Anton Hanssonc3668112020-01-17 13:42:43 +0000215 defaults: ["metalava-api-stubs-default"],
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900216 arg_files: ["core/res/AndroidManifest.xml"],
Anton Hansson81969c22020-02-03 20:45:56 +0000217 args: metalava_framework_docs_args + priv_apps + module_libs,
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900218}
219
220/////////////////////////////////////////////////////////////////////
Jiyong Park7fb4b182019-12-20 14:35:43 +0900221// android_*_stubs_current modules are the stubs libraries compiled
222// from *-api-stubs-docs
223/////////////////////////////////////////////////////////////////////
224
225java_defaults {
226 name: "framework-stubs-default",
Anton Hansson42afd612020-02-08 20:43:19 +0000227 libs: [ "stub-annotations" ],
228 static_libs: [ "private-stub-annotations-jar" ],
229 sdk_version: "core_current",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900230 errorprone: {
231 javacflags: [
232 "-XepDisableAllChecks",
233 ],
234 },
235 java_resources: [
236 ":notices-for-framework-stubs",
237 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900238 system_modules: "none",
239 java_version: "1.8",
240 compile_dex: true,
241}
242
243java_library_static {
244 name: "android_stubs_current",
Anton Hansson42afd612020-02-08 20:43:19 +0000245 srcs: [ ":api-stubs-docs" ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900246 defaults: ["framework-stubs-default"],
247}
248
249java_library_static {
250 name: "android_system_stubs_current",
Anton Hansson42afd612020-02-08 20:43:19 +0000251 srcs: [ ":system-api-stubs-docs" ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900252 defaults: ["framework-stubs-default"],
253}
254
255java_library_static {
256 name: "android_test_stubs_current",
Anton Hansson42afd612020-02-08 20:43:19 +0000257 srcs: [ ":test-api-stubs-docs" ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900258 defaults: ["framework-stubs-default"],
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900259}
260
261java_library_static {
Anton Hansson9c4bbe92020-01-30 12:09:02 +0000262 name: "android_module_lib_stubs_current",
Anton Hansson42afd612020-02-08 20:43:19 +0000263 srcs: [ ":module-lib-api-stubs-docs" ],
Jiyong Park2e6cdcc2019-12-20 15:30:28 +0900264 defaults: ["framework-stubs-default"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900265}
266
Jiyong Park7fb4b182019-12-20 14:35:43 +0900267/////////////////////////////////////////////////////////////////////
268// hwbinder.stubs provides APIs required for building HIDL Java
269// libraries.
270/////////////////////////////////////////////////////////////////////
271
272droidstubs {
273 name: "hwbinder-stubs-docs",
274 srcs: [
275 "core/java/android/os/HidlSupport.java",
276 "core/java/android/annotation/IntDef.java",
277 "core/java/android/annotation/IntRange.java",
278 "core/java/android/annotation/NonNull.java",
279 "core/java/android/annotation/SystemApi.java",
280 "core/java/android/os/HidlMemory.java",
281 "core/java/android/os/HwBinder.java",
282 "core/java/android/os/HwBlob.java",
283 "core/java/android/os/HwParcel.java",
284 "core/java/android/os/IHwBinder.java",
285 "core/java/android/os/IHwInterface.java",
286 "core/java/android/os/DeadObjectException.java",
287 "core/java/android/os/DeadSystemException.java",
288 "core/java/android/os/NativeHandle.java",
289 "core/java/android/os/RemoteException.java",
290 "core/java/android/util/AndroidException.java",
291 ],
292 installable: false,
293 sdk_version: "core_platform",
294 annotations_enabled: true,
295 previous_api: ":last-released-public-api",
296 merge_annotations_dirs: [
297 "metalava-manual",
298 ],
Anton Hansson81969c22020-02-03 20:45:56 +0000299 args: priv_apps,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900300}
301
302java_library_static {
303 name: "hwbinder.stubs",
304 sdk_version: "core_current",
305 srcs: [
306 ":hwbinder-stubs-docs",
307 ],
308}
309
310/////////////////////////////////////////////////////////////////////
311// Stubs for hiddenapi processing.
312/////////////////////////////////////////////////////////////////////
313
314droidstubs {
315 name: "hiddenapi-lists-docs",
316 defaults: ["metalava-api-stubs-default"],
317 arg_files: [
318 "core/res/AndroidManifest.xml",
319 ],
320 dex_api_filename: "public-dex.txt",
321 private_dex_api_filename: "private-dex.txt",
322 removed_dex_api_filename: "removed-dex.txt",
323 args: metalava_framework_docs_args +
324 " --show-unannotated " +
Anton Hansson81969c22020-02-03 20:45:56 +0000325 priv_apps +
Jiyong Park7fb4b182019-12-20 14:35:43 +0900326 " --show-annotation android.annotation.TestApi ",
327}
328
329droidstubs {
330 name: "hiddenapi-mappings",
331 defaults: ["metalava-api-stubs-default"],
332 srcs: [
333 ":opt-telephony-common-srcs",
334 ],
335
336 arg_files: [
337 "core/res/AndroidManifest.xml",
338 ],
339 dex_mapping_filename: "dex-mapping.txt",
340 args: metalava_framework_docs_args +
341 " --hide ReferencesHidden " +
342 " --hide UnhiddenSystemApi " +
343 " --show-unannotated " +
Anton Hansson81969c22020-02-03 20:45:56 +0000344 priv_apps +
Jiyong Park7fb4b182019-12-20 14:35:43 +0900345 " --show-annotation android.annotation.TestApi ",
346}
347
348/////////////////////////////////////////////////////////////////////
349// api/*-current.txt files for use by modules in other directories
350// like the CTS test
351/////////////////////////////////////////////////////////////////////
352
353filegroup {
354 name: "frameworks-base-api-current.txt",
355 srcs: [
356 "api/current.txt",
357 ],
358}
359
360filegroup {
361 name: "frameworks-base-api-system-current.txt",
362 srcs: [
363 "api/system-current.txt",
364 ],
365}
366
367filegroup {
368 name: "frameworks-base-api-system-removed.txt",
369 srcs: [
370 "api/system-removed.txt",
371 ],
372}