blob: 50524998d4162ef08707f34445f33831ebcd67f9 [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",
Paul Duffin37c10f02020-03-26 15:33:48 +000050 ":art-module-public-api-stubs-source",
Paul Duffin37c10f02020-03-26 15:33:48 +000051 ":android_icu4j_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,
Anton Hansson48ee95e2020-05-02 17:49:26 +010060 previous_api: ":android.api.public.latest",
Jiyong Park7fb4b182019-12-20 14:35:43 +090061 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"],
Anton Hanssone89d37d2020-05-07 12:06:00 +010071 srcs: [
72 ":conscrypt.module.public.api.stubs.source",
73 ":framework-updatable-sources",
74 ],
Jiyong Parke3095162019-12-20 15:30:28 +090075 sdk_version: "core_platform",
76}
77
Anton Hansson822cdb32020-03-06 17:16:06 +000078stubs_defaults {
79 name: "metalava-non-updatable-api-stubs-default",
80 defaults: ["metalava-base-api-stubs-default"],
Anton Hansson92d79fd2020-03-20 09:12:52 +000081 sdk_version: "core_platform",
Anton Hansson394febc2020-04-14 16:35:36 +010082 // There are a few classes from modules used as type arguments that
83 // need to be resolved by metalava. For now, we can use a previously
84 // finalized stub library to resolve them. If a new class gets added,
85 // this may be need to be revisited to use a manually maintained stub
86 // library with empty classes in order to resolve those references.
87 libs: ["sdk_system_29_android"],
Anton Hansson92d79fd2020-03-20 09:12:52 +000088 aidl: {
Anton Hansson394febc2020-04-14 16:35:36 +010089 local_include_dirs: ["apex/media/aidl/stable"],
Anton Hansson92d79fd2020-03-20 09:12:52 +000090 },
Anton Hansson822cdb32020-03-06 17:16:06 +000091}
92
Jiyong Park7fb4b182019-12-20 14:35:43 +090093/////////////////////////////////////////////////////////////////////
94// *-api-stubs-docs modules providing source files for the stub libraries
95/////////////////////////////////////////////////////////////////////
96
Jiyong Parke3095162019-12-20 15:30:28 +090097// api-stubs-docs, system-api-stubs-docs, and test-api-stubs-docs have APIs
98// from the non-updatable part of the platform as well as from the updatable
99// modules
Jiyong Park7fb4b182019-12-20 14:35:43 +0900100droidstubs {
101 name: "api-stubs-docs",
Anton Hansson822cdb32020-03-06 17:16:06 +0000102 defaults: ["metalava-full-api-stubs-default"],
Artur Satayev7e7fdde2020-03-25 16:45:56 +0000103 removed_dex_api_filename: "removed-dex.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900104 arg_files: [
105 "core/res/AndroidManifest.xml",
106 ],
107 args: metalava_framework_docs_args,
108 check_api: {
109 current: {
110 api_file: "api/current.txt",
111 removed_api_file: "api/removed.txt",
112 },
113 last_released: {
Anton Hansson48ee95e2020-05-02 17:49:26 +0100114 api_file: ":android.api.public.latest",
Anton Hansson960c6752020-05-02 18:00:30 +0100115 removed_api_file: ":removed.api.public.latest",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900116 baseline_file: ":public-api-incompatibilities-with-last-released",
117 },
118 api_lint: {
119 enabled: true,
Anton Hansson48ee95e2020-05-02 17:49:26 +0100120 new_since: ":android.api.public.latest",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900121 baseline_file: "api/lint-baseline.txt",
122 },
123 },
Anton Hanssond9a3fee2020-03-23 18:08:55 +0000124 dist: {
125 targets: ["sdk", "win_sdk"],
126 dir: "apistubs/android/public/api",
127 dest: "android.txt",
128 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900129 jdiff_enabled: true,
130}
131
Anton Hansson81969c22020-02-03 20:45:56 +0000132priv_apps = " " +
133 "--show-annotation android.annotation.SystemApi\\(" +
134 "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
135 "\\) "
136
137module_libs = " " +
138 " --show-annotation android.annotation.SystemApi\\(" +
139 "client=android.annotation.SystemApi.Client.MODULE_LIBRARIES" +
140 "\\) "
141
Jiyong Park7fb4b182019-12-20 14:35:43 +0900142droidstubs {
143 name: "system-api-stubs-docs",
Anton Hansson822cdb32020-03-06 17:16:06 +0000144 defaults: ["metalava-full-api-stubs-default"],
Artur Satayev7e7fdde2020-03-25 16:45:56 +0000145 removed_dex_api_filename: "system-removed-dex.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900146 arg_files: [
147 "core/res/AndroidManifest.xml",
148 ],
Anton Hansson81969c22020-02-03 20:45:56 +0000149 args: metalava_framework_docs_args + priv_apps,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900150 check_api: {
151 current: {
152 api_file: "api/system-current.txt",
153 removed_api_file: "api/system-removed.txt",
154 },
155 last_released: {
Anton Hansson48ee95e2020-05-02 17:49:26 +0100156 api_file: ":android.api.system.latest",
Anton Hansson960c6752020-05-02 18:00:30 +0100157 removed_api_file: ":removed.api.system.latest",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900158 baseline_file: ":system-api-incompatibilities-with-last-released"
159 },
160 api_lint: {
161 enabled: true,
Anton Hansson48ee95e2020-05-02 17:49:26 +0100162 new_since: ":android.api.system.latest",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900163 baseline_file: "api/system-lint-baseline.txt",
164 },
165 },
Anton Hanssond9a3fee2020-03-23 18:08:55 +0000166 dist: {
167 targets: ["sdk", "win_sdk"],
168 dir: "apistubs/android/system/api",
169 dest: "android.txt",
170 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900171 jdiff_enabled: true,
172}
173
174droidstubs {
175 name: "test-api-stubs-docs",
Anton Hansson822cdb32020-03-06 17:16:06 +0000176 defaults: ["metalava-full-api-stubs-default"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900177 arg_files: [
178 "core/res/AndroidManifest.xml",
179 ],
180 args: metalava_framework_docs_args + " --show-annotation android.annotation.TestApi",
181 check_api: {
182 current: {
183 api_file: "api/test-current.txt",
184 removed_api_file: "api/test-removed.txt",
185 },
186 api_lint: {
187 enabled: true,
188 baseline_file: "api/test-lint-baseline.txt",
189 },
190 },
Anton Hanssond9a3fee2020-03-23 18:08:55 +0000191 dist: {
192 targets: ["sdk", "win_sdk"],
193 dir: "apistubs/android/test/api",
194 dest: "android.txt",
195 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900196}
197
198/////////////////////////////////////////////////////////////////////
Jiyong Parke3095162019-12-20 15:30:28 +0900199// Following droidstubs modules are for extra APIs for modules.
200// The framework currently have two more API surfaces for modules:
201// @SystemApi(client=MODULE_APPS) and @SystemApi(client=MODULE_LIBRARIES)
202/////////////////////////////////////////////////////////////////////
203
Anton Hansson81969c22020-02-03 20:45:56 +0000204// TODO(b/146727827) remove the *-api module when we can teach metalava
Jiyong Parke3095162019-12-20 15:30:28 +0900205// about the relationship among the API surfaces. Currently, these modules are only to generate
206// the API signature files and ensure that the APIs evolve in a backwards compatible manner.
207// They however are NOT used for building the API stub.
Jiyong Parke3095162019-12-20 15:30:28 +0900208
209droidstubs {
210 name: "module-lib-api",
Anton Hansson822cdb32020-03-06 17:16:06 +0000211 defaults: ["metalava-full-api-stubs-default"],
Jiyong Parke3095162019-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 + module_libs,
Jiyong Parke3095162019-12-20 15:30:28 +0900214 check_api: {
215 current: {
216 api_file: "api/module-lib-current.txt",
217 removed_api_file: "api/module-lib-removed.txt",
218 },
Anton Hansson79e35c32020-02-11 14:36:40 +0000219 last_released: {
Anton Hansson48ee95e2020-05-02 17:49:26 +0100220 api_file: ":android.api.module-lib.latest",
Anton Hansson960c6752020-05-02 18:00:30 +0100221 removed_api_file: ":removed.api.module-lib.latest",
Anton Hansson79e35c32020-02-11 14:36:40 +0000222 baseline_file: ":module-lib-api-incompatibilities-with-last-released"
223 },
224 api_lint: {
225 enabled: true,
Anton Hansson48ee95e2020-05-02 17:49:26 +0100226 new_since: ":android.api.module-lib.latest",
Anton Hansson79e35c32020-02-11 14:36:40 +0000227 baseline_file: "api/module-lib-lint-baseline.txt",
228 },
Jiyong Parke3095162019-12-20 15:30:28 +0900229 },
Anton Hanssond9a3fee2020-03-23 18:08:55 +0000230 dist: {
231 targets: ["sdk", "win_sdk"],
232 dir: "apistubs/android/module-lib/api",
233 dest: "android.txt",
234 },
Jiyong Parke3095162019-12-20 15:30:28 +0900235}
236
Anton Hansson81969c22020-02-03 20:45:56 +0000237
238// The following droidstub module generates source files for the API stub library for
239// modules. Note that it not only includes its own APIs but also other APIs that have
240// narrower scope (all @SystemApis, not just the ones with 'client=MODULE_LIBRARIES').
Jiyong Parke3095162019-12-20 15:30:28 +0900241
242droidstubs {
243 name: "module-lib-api-stubs-docs",
Anton Hansson822cdb32020-03-06 17:16:06 +0000244 defaults: ["metalava-non-updatable-api-stubs-default"],
Jiyong Parke3095162019-12-20 15:30:28 +0900245 arg_files: ["core/res/AndroidManifest.xml"],
Anton Hansson81969c22020-02-03 20:45:56 +0000246 args: metalava_framework_docs_args + priv_apps + module_libs,
Jiyong Parke3095162019-12-20 15:30:28 +0900247}
248
249/////////////////////////////////////////////////////////////////////
Jiyong Park7fb4b182019-12-20 14:35:43 +0900250// android_*_stubs_current modules are the stubs libraries compiled
251// from *-api-stubs-docs
252/////////////////////////////////////////////////////////////////////
253
254java_defaults {
Anton Hansson87c7d282020-04-09 14:16:37 +0100255 name: "android_defaults_stubs_current",
Anton Hansson08b48bb2020-02-08 20:43:19 +0000256 libs: [ "stub-annotations" ],
257 static_libs: [ "private-stub-annotations-jar" ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900258 errorprone: {
259 javacflags: [
260 "-XepDisableAllChecks",
261 ],
262 },
Anton Hansson87c7d282020-04-09 14:16:37 +0100263 java_resources: [":notices-for-framework-stubs"],
264 sdk_version: "none",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900265 system_modules: "none",
266 java_version: "1.8",
267 compile_dex: true,
268}
269
270java_library_static {
271 name: "android_stubs_current",
Anton Hansson08b48bb2020-02-08 20:43:19 +0000272 srcs: [ ":api-stubs-docs" ],
Anton Hansson87c7d282020-04-09 14:16:37 +0100273 defaults: ["android_defaults_stubs_current"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900274}
275
276java_library_static {
277 name: "android_system_stubs_current",
Anton Hansson08b48bb2020-02-08 20:43:19 +0000278 srcs: [ ":system-api-stubs-docs" ],
Anton Hansson87c7d282020-04-09 14:16:37 +0100279 defaults: ["android_defaults_stubs_current"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900280}
281
282java_library_static {
283 name: "android_test_stubs_current",
Anton Hansson08b48bb2020-02-08 20:43:19 +0000284 srcs: [ ":test-api-stubs-docs" ],
Anton Hansson87c7d282020-04-09 14:16:37 +0100285 defaults: ["android_defaults_stubs_current"],
Jiyong Parke3095162019-12-20 15:30:28 +0900286}
287
288java_library_static {
Anton Hansson1b9cf092020-01-30 12:09:02 +0000289 name: "android_module_lib_stubs_current",
Anton Hansson08b48bb2020-02-08 20:43:19 +0000290 srcs: [ ":module-lib-api-stubs-docs" ],
Anton Hansson87c7d282020-04-09 14:16:37 +0100291 defaults: ["android_defaults_stubs_current"],
Anton Hansson394febc2020-04-14 16:35:36 +0100292 libs: ["sdk_system_29_android"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900293}
294
Jiyong Park7fb4b182019-12-20 14:35:43 +0900295/////////////////////////////////////////////////////////////////////
296// hwbinder.stubs provides APIs required for building HIDL Java
297// libraries.
298/////////////////////////////////////////////////////////////////////
299
300droidstubs {
301 name: "hwbinder-stubs-docs",
302 srcs: [
303 "core/java/android/os/HidlSupport.java",
304 "core/java/android/annotation/IntDef.java",
305 "core/java/android/annotation/IntRange.java",
306 "core/java/android/annotation/NonNull.java",
307 "core/java/android/annotation/SystemApi.java",
308 "core/java/android/os/HidlMemory.java",
309 "core/java/android/os/HwBinder.java",
310 "core/java/android/os/HwBlob.java",
311 "core/java/android/os/HwParcel.java",
312 "core/java/android/os/IHwBinder.java",
313 "core/java/android/os/IHwInterface.java",
314 "core/java/android/os/DeadObjectException.java",
315 "core/java/android/os/DeadSystemException.java",
316 "core/java/android/os/NativeHandle.java",
317 "core/java/android/os/RemoteException.java",
318 "core/java/android/util/AndroidException.java",
319 ],
320 installable: false,
321 sdk_version: "core_platform",
322 annotations_enabled: true,
Anton Hansson48ee95e2020-05-02 17:49:26 +0100323 previous_api: ":android.api.public.latest",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900324 merge_annotations_dirs: [
325 "metalava-manual",
326 ],
Anton Hansson81969c22020-02-03 20:45:56 +0000327 args: priv_apps,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900328}
329
330java_library_static {
331 name: "hwbinder.stubs",
332 sdk_version: "core_current",
333 srcs: [
334 ":hwbinder-stubs-docs",
335 ],
336}
337
338/////////////////////////////////////////////////////////////////////
Jiyong Park7fb4b182019-12-20 14:35:43 +0900339// api/*-current.txt files for use by modules in other directories
340// like the CTS test
341/////////////////////////////////////////////////////////////////////
342
343filegroup {
344 name: "frameworks-base-api-current.txt",
345 srcs: [
346 "api/current.txt",
347 ],
348}
349
350filegroup {
351 name: "frameworks-base-api-system-current.txt",
352 srcs: [
353 "api/system-current.txt",
354 ],
355}
356
357filegroup {
358 name: "frameworks-base-api-system-removed.txt",
359 srcs: [
360 "api/system-removed.txt",
361 ],
362}