blob: f06f2792e0d75a7185bbbb78b615ab574530ebd1 [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",
50 ":core-current-stubs-source",
51 ":core_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,
60 previous_api: ":last-released-public-api",
61 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"],
Jiyong Parke3095162019-12-20 15:30:28 +090071 srcs: [":framework-updatable-sources"],
72 sdk_version: "core_platform",
73}
74
Anton Hansson822cdb32020-03-06 17:16:06 +000075stubs_defaults {
76 name: "metalava-non-updatable-api-stubs-default",
77 defaults: ["metalava-base-api-stubs-default"],
Anton Hansson92d79fd2020-03-20 09:12:52 +000078 sdk_version: "core_platform",
79 libs: ["framework-all"],
80 aidl: {
81 local_include_dirs: ["apex/media/framework/java"],
82 },
Anton Hansson822cdb32020-03-06 17:16:06 +000083}
84
Jiyong Park7fb4b182019-12-20 14:35:43 +090085/////////////////////////////////////////////////////////////////////
86// *-api-stubs-docs modules providing source files for the stub libraries
87/////////////////////////////////////////////////////////////////////
88
Jiyong Parke3095162019-12-20 15:30:28 +090089// api-stubs-docs, system-api-stubs-docs, and test-api-stubs-docs have APIs
90// from the non-updatable part of the platform as well as from the updatable
91// modules
Jiyong Park7fb4b182019-12-20 14:35:43 +090092droidstubs {
93 name: "api-stubs-docs",
Anton Hansson822cdb32020-03-06 17:16:06 +000094 defaults: ["metalava-full-api-stubs-default"],
Jiyong Park7fb4b182019-12-20 14:35:43 +090095 api_filename: "public_api.txt",
96 private_api_filename: "private.txt",
97 removed_api_filename: "removed.txt",
Artur Satayev7e7fdde2020-03-25 16:45:56 +000098 removed_dex_api_filename: "removed-dex.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +090099 arg_files: [
100 "core/res/AndroidManifest.xml",
101 ],
102 args: metalava_framework_docs_args,
103 check_api: {
104 current: {
105 api_file: "api/current.txt",
106 removed_api_file: "api/removed.txt",
107 },
108 last_released: {
109 api_file: ":last-released-public-api",
110 removed_api_file: "api/removed.txt",
111 baseline_file: ":public-api-incompatibilities-with-last-released",
112 },
113 api_lint: {
114 enabled: true,
115 new_since: ":last-released-public-api",
116 baseline_file: "api/lint-baseline.txt",
117 },
118 },
Anton Hanssond9a3fee2020-03-23 18:08:55 +0000119 dist: {
120 targets: ["sdk", "win_sdk"],
121 dir: "apistubs/android/public/api",
122 dest: "android.txt",
123 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900124 jdiff_enabled: true,
125}
126
Anton Hansson81969c22020-02-03 20:45:56 +0000127priv_apps = " " +
128 "--show-annotation android.annotation.SystemApi\\(" +
129 "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
130 "\\) "
131
132module_libs = " " +
133 " --show-annotation android.annotation.SystemApi\\(" +
134 "client=android.annotation.SystemApi.Client.MODULE_LIBRARIES" +
135 "\\) "
136
Jiyong Park7fb4b182019-12-20 14:35:43 +0900137droidstubs {
138 name: "system-api-stubs-docs",
Anton Hansson822cdb32020-03-06 17:16:06 +0000139 defaults: ["metalava-full-api-stubs-default"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900140 api_tag_name: "SYSTEM",
141 api_filename: "system-api.txt",
142 private_api_filename: "system-private.txt",
143 private_dex_api_filename: "system-private-dex.txt",
144 removed_api_filename: "system-removed.txt",
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: {
156 api_file: ":last-released-system-api",
157 removed_api_file: "api/system-removed.txt",
158 baseline_file: ":system-api-incompatibilities-with-last-released"
159 },
160 api_lint: {
161 enabled: true,
162 new_since: ":last-released-system-api",
163 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 api_tag_name: "TEST",
178 api_filename: "test-api.txt",
179 removed_api_filename: "test-removed.txt",
180 arg_files: [
181 "core/res/AndroidManifest.xml",
182 ],
183 args: metalava_framework_docs_args + " --show-annotation android.annotation.TestApi",
184 check_api: {
185 current: {
186 api_file: "api/test-current.txt",
187 removed_api_file: "api/test-removed.txt",
188 },
189 api_lint: {
190 enabled: true,
191 baseline_file: "api/test-lint-baseline.txt",
192 },
193 },
Anton Hanssond9a3fee2020-03-23 18:08:55 +0000194 dist: {
195 targets: ["sdk", "win_sdk"],
196 dir: "apistubs/android/test/api",
197 dest: "android.txt",
198 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900199}
200
201/////////////////////////////////////////////////////////////////////
Jiyong Parke3095162019-12-20 15:30:28 +0900202// Following droidstubs modules are for extra APIs for modules.
203// The framework currently have two more API surfaces for modules:
204// @SystemApi(client=MODULE_APPS) and @SystemApi(client=MODULE_LIBRARIES)
205/////////////////////////////////////////////////////////////////////
206
Anton Hansson81969c22020-02-03 20:45:56 +0000207// TODO(b/146727827) remove the *-api module when we can teach metalava
Jiyong Parke3095162019-12-20 15:30:28 +0900208// about the relationship among the API surfaces. Currently, these modules are only to generate
209// the API signature files and ensure that the APIs evolve in a backwards compatible manner.
210// They however are NOT used for building the API stub.
Jiyong Parke3095162019-12-20 15:30:28 +0900211
212droidstubs {
213 name: "module-lib-api",
Anton Hansson822cdb32020-03-06 17:16:06 +0000214 defaults: ["metalava-full-api-stubs-default"],
Anton Hansson7b0414b2020-03-19 15:09:44 +0000215 api_tag_name: "MODULE_LIB",
Jiyong Parke3095162019-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 + module_libs,
Jiyong Parke3095162019-12-20 15:30:28 +0900218 check_api: {
219 current: {
220 api_file: "api/module-lib-current.txt",
221 removed_api_file: "api/module-lib-removed.txt",
222 },
Anton Hansson79e35c32020-02-11 14:36:40 +0000223 last_released: {
224 api_file: ":last-released-module-lib-api",
225 removed_api_file: "api/module-lib-removed.txt",
226 baseline_file: ":module-lib-api-incompatibilities-with-last-released"
227 },
228 api_lint: {
229 enabled: true,
230 new_since: ":last-released-module-lib-api",
231 baseline_file: "api/module-lib-lint-baseline.txt",
232 },
Jiyong Parke3095162019-12-20 15:30:28 +0900233 },
Anton Hanssond9a3fee2020-03-23 18:08:55 +0000234 dist: {
235 targets: ["sdk", "win_sdk"],
236 dir: "apistubs/android/module-lib/api",
237 dest: "android.txt",
238 },
Jiyong Parke3095162019-12-20 15:30:28 +0900239}
240
Anton Hansson81969c22020-02-03 20:45:56 +0000241
242// The following droidstub module generates source files for the API stub library for
243// modules. Note that it not only includes its own APIs but also other APIs that have
244// narrower scope (all @SystemApis, not just the ones with 'client=MODULE_LIBRARIES').
Jiyong Parke3095162019-12-20 15:30:28 +0900245
246droidstubs {
247 name: "module-lib-api-stubs-docs",
Anton Hansson822cdb32020-03-06 17:16:06 +0000248 defaults: ["metalava-non-updatable-api-stubs-default"],
Jiyong Parke3095162019-12-20 15:30:28 +0900249 arg_files: ["core/res/AndroidManifest.xml"],
Anton Hansson81969c22020-02-03 20:45:56 +0000250 args: metalava_framework_docs_args + priv_apps + module_libs,
Jiyong Parke3095162019-12-20 15:30:28 +0900251}
252
253/////////////////////////////////////////////////////////////////////
Jiyong Park7fb4b182019-12-20 14:35:43 +0900254// android_*_stubs_current modules are the stubs libraries compiled
255// from *-api-stubs-docs
256/////////////////////////////////////////////////////////////////////
257
258java_defaults {
Anton Hansson87c7d282020-04-09 14:16:37 +0100259 name: "android_defaults_stubs_current",
Anton Hansson08b48bb2020-02-08 20:43:19 +0000260 libs: [ "stub-annotations" ],
261 static_libs: [ "private-stub-annotations-jar" ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900262 errorprone: {
263 javacflags: [
264 "-XepDisableAllChecks",
265 ],
266 },
Anton Hansson87c7d282020-04-09 14:16:37 +0100267 java_resources: [":notices-for-framework-stubs"],
268 sdk_version: "none",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900269 system_modules: "none",
270 java_version: "1.8",
271 compile_dex: true,
272}
273
274java_library_static {
275 name: "android_stubs_current",
Anton Hansson08b48bb2020-02-08 20:43:19 +0000276 srcs: [ ":api-stubs-docs" ],
Anton Hansson87c7d282020-04-09 14:16:37 +0100277 defaults: ["android_defaults_stubs_current"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900278}
279
280java_library_static {
281 name: "android_system_stubs_current",
Anton Hansson08b48bb2020-02-08 20:43:19 +0000282 srcs: [ ":system-api-stubs-docs" ],
Anton Hansson87c7d282020-04-09 14:16:37 +0100283 defaults: ["android_defaults_stubs_current"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900284}
285
286java_library_static {
287 name: "android_test_stubs_current",
Anton Hansson08b48bb2020-02-08 20:43:19 +0000288 srcs: [ ":test-api-stubs-docs" ],
Anton Hansson87c7d282020-04-09 14:16:37 +0100289 defaults: ["android_defaults_stubs_current"],
Jiyong Parke3095162019-12-20 15:30:28 +0900290}
291
292java_library_static {
Anton Hansson1b9cf092020-01-30 12:09:02 +0000293 name: "android_module_lib_stubs_current",
Anton Hansson08b48bb2020-02-08 20:43:19 +0000294 srcs: [ ":module-lib-api-stubs-docs" ],
Anton Hansson87c7d282020-04-09 14:16:37 +0100295 defaults: ["android_defaults_stubs_current"],
Anton Hansson822cdb32020-03-06 17:16:06 +0000296 libs: ["android_system_stubs_current"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900297}
298
Jiyong Park7fb4b182019-12-20 14:35:43 +0900299/////////////////////////////////////////////////////////////////////
300// hwbinder.stubs provides APIs required for building HIDL Java
301// libraries.
302/////////////////////////////////////////////////////////////////////
303
304droidstubs {
305 name: "hwbinder-stubs-docs",
306 srcs: [
307 "core/java/android/os/HidlSupport.java",
308 "core/java/android/annotation/IntDef.java",
309 "core/java/android/annotation/IntRange.java",
310 "core/java/android/annotation/NonNull.java",
311 "core/java/android/annotation/SystemApi.java",
312 "core/java/android/os/HidlMemory.java",
313 "core/java/android/os/HwBinder.java",
314 "core/java/android/os/HwBlob.java",
315 "core/java/android/os/HwParcel.java",
316 "core/java/android/os/IHwBinder.java",
317 "core/java/android/os/IHwInterface.java",
318 "core/java/android/os/DeadObjectException.java",
319 "core/java/android/os/DeadSystemException.java",
320 "core/java/android/os/NativeHandle.java",
321 "core/java/android/os/RemoteException.java",
322 "core/java/android/util/AndroidException.java",
323 ],
324 installable: false,
325 sdk_version: "core_platform",
326 annotations_enabled: true,
327 previous_api: ":last-released-public-api",
328 merge_annotations_dirs: [
329 "metalava-manual",
330 ],
Anton Hansson81969c22020-02-03 20:45:56 +0000331 args: priv_apps,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900332}
333
334java_library_static {
335 name: "hwbinder.stubs",
336 sdk_version: "core_current",
337 srcs: [
338 ":hwbinder-stubs-docs",
339 ],
340}
341
342/////////////////////////////////////////////////////////////////////
Jiyong Park7fb4b182019-12-20 14:35:43 +0900343// api/*-current.txt files for use by modules in other directories
344// like the CTS test
345/////////////////////////////////////////////////////////////////////
346
347filegroup {
348 name: "frameworks-base-api-current.txt",
349 srcs: [
350 "api/current.txt",
351 ],
352}
353
354filegroup {
355 name: "frameworks-base-api-system-current.txt",
356 srcs: [
357 "api/system-current.txt",
358 ],
359}
360
361filegroup {
362 name: "frameworks-base-api-system-removed.txt",
363 srcs: [
364 "api/system-removed.txt",
365 ],
366}