blob: f345f61716e5b02903454020283dfdd365164fc1 [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//
Anton Hansson2feb3f12020-11-13 11:44:32 +000019// - The metalava conversion is done by droidstub modules
20// - The javac compilation is done by java_library modules
21//
Jiyong Park7fb4b182019-12-20 14:35:43 +090022// The metalava conversion is also responsible for creating API signature files
Anton Hansson2feb3f12020-11-13 11:44:32 +000023// and comparing them against the checked in API signature, and also checking compatibility
24// with the latest frozen API signature.
Jiyong Park7fb4b182019-12-20 14:35:43 +090025
26/////////////////////////////////////////////////////////////////////
Anton Hansson51861e72020-11-13 09:55:29 +000027// These modules provide source files for the stub libraries
Jiyong Park7fb4b182019-12-20 14:35:43 +090028/////////////////////////////////////////////////////////////////////
29
Anton Hansson76d3db42020-04-09 14:16:37 +010030droidstubs {
31 name: "api-stubs-docs-non-updatable",
Liz Kammer01544b92023-09-20 15:15:43 +000032 srcs: [
33 ":framework-minus-apex-aconfig-srcjars",
34 ],
Anton Hansson9dce8322022-01-24 14:14:33 +000035 defaults: [
36 "android-non-updatable-stubs-defaults",
37 "module-classpath-stubs-defaults",
38 ],
Adrian Roos8be09522023-09-08 12:52:42 +000039 args: metalava_framework_docs_args + "--error UnflaggedApi ",
Anton Hansson76d3db42020-04-09 14:16:37 +010040 check_api: {
41 current: {
Anton Hanssonb7cda922023-03-03 15:38:28 +000042 api_file: ":non-updatable-current.txt",
43 removed_api_file: ":non-updatable-removed.txt",
Anton Hansson76d3db42020-04-09 14:16:37 +010044 },
Anton Hansson37e102e2020-10-05 16:42:40 +010045 last_released: {
46 api_file: ":android-non-updatable.api.public.latest",
47 removed_api_file: ":android-non-updatable-removed.api.public.latest",
Anton Hansson7f3393d2021-04-12 11:56:53 +010048 baseline_file: ":android-non-updatable-incompatibilities.api.public.latest",
Anton Hansson37e102e2020-10-05 16:42:40 +010049 },
Anton Hansson76d3db42020-04-09 14:16:37 +010050 api_lint: {
51 enabled: true,
Anton Hansson4f90aa52021-06-04 22:23:59 +010052 new_since: ":android.api.public.latest",
Adrian Roos38dd1612023-09-06 14:45:35 +000053 baseline_file: ":non-updatable-lint-baseline.txt",
Anton Hansson76d3db42020-04-09 14:16:37 +010054 },
55 },
Anton Hansson85785fe2021-01-20 20:23:34 +000056 dists: [
57 {
Anton Hanssondd8ef672022-01-04 08:53:19 +000058 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +000059 dir: "apistubs/android/public/api",
60 dest: "android-non-updatable.txt",
61 tag: ".api.txt",
62 },
63 {
Anton Hanssondd8ef672022-01-04 08:53:19 +000064 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +000065 dir: "apistubs/android/public/api",
66 dest: "android-non-updatable-removed.txt",
67 tag: ".removed-api.txt",
68 },
69 ],
Anton Hansson76d3db42020-04-09 14:16:37 +010070}
71
Anton Hansson240ee482021-04-14 12:52:00 +010072priv_apps = " --show-annotation android.annotation.SystemApi\\(" +
73 "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
Anton Hansson2feb3f12020-11-13 11:44:32 +000074 "\\)"
75
Anton Hansson240ee482021-04-14 12:52:00 +010076priv_apps_in_stubs = " --show-for-stub-purposes-annotation android.annotation.SystemApi\\(" +
77 "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
Anton Hansson2feb3f12020-11-13 11:44:32 +000078 "\\)"
79
Adrian Roos38dd1612023-09-06 14:45:35 +000080test = " --show-annotation android.annotation.TestApi" +
81 " --hide UnflaggedApi" // TODO(b/297362755): TestApi lint doesn't ignore existing APIs.
Anton Hansson2feb3f12020-11-13 11:44:32 +000082
Anton Hansson240ee482021-04-14 12:52:00 +010083module_libs = " --show-annotation android.annotation.SystemApi\\(" +
84 "client=android.annotation.SystemApi.Client.MODULE_LIBRARIES" +
Anton Hansson2feb3f12020-11-13 11:44:32 +000085 "\\)"
Anton Hansson81969c22020-02-03 20:45:56 +000086
Jiyong Park7fb4b182019-12-20 14:35:43 +090087droidstubs {
Anton Hansson76d3db42020-04-09 14:16:37 +010088 name: "system-api-stubs-docs-non-updatable",
Anton Hansson9dce8322022-01-24 14:14:33 +000089 defaults: [
90 "android-non-updatable-stubs-defaults",
91 "module-classpath-stubs-defaults",
92 ],
Anton Hansson76d3db42020-04-09 14:16:37 +010093 args: metalava_framework_docs_args + priv_apps,
94 check_api: {
95 current: {
Anton Hanssonb7cda922023-03-03 15:38:28 +000096 api_file: ":non-updatable-system-current.txt",
97 removed_api_file: ":non-updatable-system-removed.txt",
Anton Hansson76d3db42020-04-09 14:16:37 +010098 },
Anton Hansson37e102e2020-10-05 16:42:40 +010099 last_released: {
100 api_file: ":android-non-updatable.api.system.latest",
101 removed_api_file: ":android-non-updatable-removed.api.system.latest",
Anton Hansson240ee482021-04-14 12:52:00 +0100102 baseline_file: ":android-non-updatable-incompatibilities.api.system.latest",
Anton Hansson37e102e2020-10-05 16:42:40 +0100103 },
Anton Hansson76d3db42020-04-09 14:16:37 +0100104 api_lint: {
105 enabled: true,
Anton Hansson4f90aa52021-06-04 22:23:59 +0100106 new_since: ":android.api.system.latest",
Anton Hanssonb7cda922023-03-03 15:38:28 +0000107 baseline_file: ":non-updatable-system-lint-baseline.txt",
Anton Hansson76d3db42020-04-09 14:16:37 +0100108 },
109 },
Anton Hansson85785fe2021-01-20 20:23:34 +0000110 dists: [
111 {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000112 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +0000113 dir: "apistubs/android/system/api",
114 dest: "android-non-updatable.txt",
115 tag: ".api.txt",
116 },
117 {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000118 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +0000119 dir: "apistubs/android/system/api",
120 dest: "android-non-updatable-removed.txt",
121 tag: ".removed-api.txt",
122 },
123 ],
Anton Hansson76d3db42020-04-09 14:16:37 +0100124}
125
126droidstubs {
Anton Hansson022aac52020-11-05 10:45:13 +0000127 name: "test-api-stubs-docs-non-updatable",
Anton Hansson9dce8322022-01-24 14:14:33 +0000128 defaults: [
129 "android-non-updatable-stubs-defaults",
130 "module-classpath-stubs-defaults",
131 ],
Anton Hansson2feb3f12020-11-13 11:44:32 +0000132 args: metalava_framework_docs_args + test + priv_apps_in_stubs,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900133 check_api: {
134 current: {
Anton Hanssonb7cda922023-03-03 15:38:28 +0000135 api_file: ":non-updatable-test-current.txt",
136 removed_api_file: ":non-updatable-test-removed.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900137 },
138 api_lint: {
139 enabled: true,
Anton Hanssonb7cda922023-03-03 15:38:28 +0000140 baseline_file: ":non-updatable-test-lint-baseline.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900141 },
142 },
Anton Hansson85785fe2021-01-20 20:23:34 +0000143 dists: [
144 {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000145 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +0000146 dir: "apistubs/android/test/api",
147 dest: "android.txt",
148 tag: ".api.txt",
149 },
150 {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000151 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +0000152 dir: "apistubs/android/test/api",
153 dest: "removed.txt",
154 tag: ".removed-api.txt",
155 },
156 {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000157 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +0000158 dir: "apistubs/android/test/api",
159 dest: "android-non-updatable.txt",
160 tag: ".api.txt",
161 },
162 {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000163 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +0000164 dir: "apistubs/android/test/api",
165 dest: "android-non-updatable-removed.txt",
166 tag: ".removed-api.txt",
167 },
168 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900169}
170
Jiyong Parke3095162019-12-20 15:30:28 +0900171droidstubs {
Anton Hansson76d3db42020-04-09 14:16:37 +0100172 name: "module-lib-api-stubs-docs-non-updatable",
Anton Hansson9dce8322022-01-24 14:14:33 +0000173 defaults: [
174 "android-non-updatable-stubs-defaults",
175 "module-classpath-stubs-defaults",
176 ],
Anton Hansson2feb3f12020-11-13 11:44:32 +0000177 args: metalava_framework_docs_args + priv_apps_in_stubs + module_libs,
Anton Hansson76d3db42020-04-09 14:16:37 +0100178 check_api: {
179 current: {
Anton Hanssonb7cda922023-03-03 15:38:28 +0000180 api_file: ":non-updatable-module-lib-current.txt",
181 removed_api_file: ":non-updatable-module-lib-removed.txt",
Anton Hansson76d3db42020-04-09 14:16:37 +0100182 },
Anton Hanssonc3ef1f562020-10-07 14:55:36 +0100183 last_released: {
184 api_file: ":android-non-updatable.api.module-lib.latest",
185 removed_api_file: ":android-non-updatable-removed.api.module-lib.latest",
Junyu Lai2dbb1772022-01-12 17:38:02 +0000186 baseline_file: ":android-non-updatable-incompatibilities.api.module-lib.latest",
Anton Hanssonc3ef1f562020-10-07 14:55:36 +0100187 },
Anton Hansson76d3db42020-04-09 14:16:37 +0100188 api_lint: {
189 enabled: true,
Anton Hansson4f90aa52021-06-04 22:23:59 +0100190 new_since: ":android.api.module-lib.latest",
Anton Hanssonb7cda922023-03-03 15:38:28 +0000191 baseline_file: ":non-updatable-module-lib-lint-baseline.txt",
Anton Hansson76d3db42020-04-09 14:16:37 +0100192 },
193 },
Anton Hansson85785fe2021-01-20 20:23:34 +0000194 dists: [
195 {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000196 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +0000197 dir: "apistubs/android/module-lib/api",
198 dest: "android-non-updatable.txt",
199 tag: ".api.txt",
200 },
201 {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000202 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +0000203 dir: "apistubs/android/module-lib/api",
204 dest: "android-non-updatable-removed.txt",
205 tag: ".removed-api.txt",
206 },
207 ],
Anton Hansson76d3db42020-04-09 14:16:37 +0100208}
Anton Hansson81969c22020-02-03 20:45:56 +0000209
Jiyong Parke3095162019-12-20 15:30:28 +0900210/////////////////////////////////////////////////////////////////////
Jiyong Park7fb4b182019-12-20 14:35:43 +0900211// android_*_stubs_current modules are the stubs libraries compiled
Anton Hansson2feb3f12020-11-13 11:44:32 +0000212// from stub sources
Jiyong Park7fb4b182019-12-20 14:35:43 +0900213/////////////////////////////////////////////////////////////////////
214
215java_defaults {
Anton Hanssonc43a66b2022-03-03 15:14:04 +0000216 name: "android.jar_defaults",
217 sdk_version: "none",
218 system_modules: "none",
219 java_version: "1.8",
220 compile_dex: true,
Anton Hanssonc43a66b2022-03-03 15:14:04 +0000221 visibility: ["//visibility:public"],
222}
223
224java_defaults {
Jihoon Kang491c7082023-06-15 18:37:01 +0000225 name: "android-non-updatable_defaults",
Anton Hanssonfbd32f32020-04-09 14:16:37 +0100226 sdk_version: "none",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900227 system_modules: "none",
228 java_version: "1.8",
229 compile_dex: true,
Jihoon Kang491c7082023-06-15 18:37:01 +0000230}
231
232java_defaults {
233 name: "android-non-updatable_from_source_defaults",
234 libs: ["stub-annotations"],
235 static_libs: ["framework-res-package-jar"], // Export package of framework-res
Anton Hanssona4108912021-04-09 13:40:11 +0100236 dist: {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000237 targets: ["sdk"],
Anton Hanssona4108912021-04-09 13:40:11 +0100238 tag: ".jar",
239 dest: "android-non-updatable.jar",
Anton Hansson240ee482021-04-14 12:52:00 +0100240 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900241}
242
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100243java_library {
Anton Hanssona4748cd2021-04-09 10:16:19 +0100244 name: "android-non-updatable.stubs",
Jihoon Kang491c7082023-06-15 18:37:01 +0000245 defaults: ["android-non-updatable_defaults"],
246 static_libs: [
247 "android-non-updatable.stubs.from-source",
248 ],
249 product_variables: {
250 build_from_text_stub: {
251 static_libs: [
252 "android-non-updatable.stubs.from-text",
253 ],
254 exclude_static_libs: [
255 "android-non-updatable.stubs.from-source",
256 ],
257 },
258 },
259}
260
261java_library {
262 name: "android-non-updatable.stubs.system",
263 defaults: ["android-non-updatable_defaults"],
264 static_libs: [
265 "android-non-updatable.stubs.system.from-source",
266 ],
267 product_variables: {
268 build_from_text_stub: {
269 static_libs: [
270 "android-non-updatable.stubs.system.from-text",
271 ],
272 exclude_static_libs: [
273 "android-non-updatable.stubs.system.from-source",
274 ],
275 },
276 },
277}
278
279java_library {
280 name: "android-non-updatable.stubs.module_lib",
281 defaults: ["android-non-updatable_defaults"],
282 static_libs: [
283 "android-non-updatable.stubs.module_lib.from-source",
284 ],
285 product_variables: {
286 build_from_text_stub: {
287 static_libs: [
288 "android-non-updatable.stubs.module_lib.from-text",
289 ],
290 exclude_static_libs: [
291 "android-non-updatable.stubs.module_lib.from-source",
292 ],
293 },
294 },
295}
296
297java_library {
298 name: "android-non-updatable.stubs.test",
299 defaults: ["android-non-updatable_defaults"],
300 static_libs: [
301 "android-non-updatable.stubs.test.from-source",
302 ],
303 product_variables: {
304 build_from_text_stub: {
305 static_libs: [
306 "android-non-updatable.stubs.test.from-text",
307 ],
308 exclude_static_libs: [
309 "android-non-updatable.stubs.test.from-source",
310 ],
311 },
312 },
313}
314
315java_library {
316 name: "android-non-updatable.stubs.from-source",
317 defaults: [
318 "android-non-updatable_defaults",
319 "android-non-updatable_from_source_defaults",
320 ],
Anton Hanssona4748cd2021-04-09 10:16:19 +0100321 srcs: [":api-stubs-docs-non-updatable"],
Anton Hanssonc6e9d2f2022-01-25 15:53:43 +0000322 libs: ["all-modules-public-stubs"],
Anton Hanssona4108912021-04-09 13:40:11 +0100323 dist: {
324 dir: "apistubs/android/public",
325 },
Anton Hanssona4748cd2021-04-09 10:16:19 +0100326}
327
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100328java_library {
Jihoon Kang491c7082023-06-15 18:37:01 +0000329 name: "android-non-updatable.stubs.system.from-source",
330 defaults: [
331 "android-non-updatable_defaults",
332 "android-non-updatable_from_source_defaults",
333 ],
Anton Hansson240ee482021-04-14 12:52:00 +0100334 srcs: [":system-api-stubs-docs-non-updatable"],
Anton Hanssonc6e9d2f2022-01-25 15:53:43 +0000335 libs: ["all-modules-system-stubs"],
Anton Hanssona4108912021-04-09 13:40:11 +0100336 dist: {
337 dir: "apistubs/android/system",
338 },
Anton Hanssona4748cd2021-04-09 10:16:19 +0100339}
340
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100341java_library {
Jihoon Kang491c7082023-06-15 18:37:01 +0000342 name: "android-non-updatable.stubs.module_lib.from-source",
343 defaults: [
344 "android-non-updatable_defaults",
345 "android-non-updatable_from_source_defaults",
346 ],
Anton Hanssona4748cd2021-04-09 10:16:19 +0100347 srcs: [":module-lib-api-stubs-docs-non-updatable"],
348 libs: [
markchiencd813a32021-11-11 00:42:55 +0800349 "sdk_module-lib_current_framework-tethering",
paulhu2a8c2c32022-02-08 21:23:06 +0800350 "sdk_module-lib_current_framework-connectivity-t",
Roopa Sattiraju86058b62022-01-20 10:05:19 -0800351 "sdk_public_current_framework-bluetooth",
352 // NOTE: The below can be removed once the prebuilt stub contains bluetooth.
Anton Hanssona4748cd2021-04-09 10:16:19 +0100353 "sdk_system_current_android",
354 // NOTE: The below can be removed once the prebuilt stub contains IKE.
355 "sdk_system_current_android.net.ipsec.ike",
356 ],
Anton Hanssona4108912021-04-09 13:40:11 +0100357 dist: {
358 dir: "apistubs/android/module-lib",
359 },
Anton Hanssona4748cd2021-04-09 10:16:19 +0100360}
361
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100362java_library {
Jihoon Kang491c7082023-06-15 18:37:01 +0000363 name: "android-non-updatable.stubs.test.from-source",
364 defaults: [
365 "android-non-updatable_defaults",
366 "android-non-updatable_from_source_defaults",
367 ],
Anton Hanssona4748cd2021-04-09 10:16:19 +0100368 srcs: [":test-api-stubs-docs-non-updatable"],
Anton Hanssonc6e9d2f2022-01-25 15:53:43 +0000369 libs: ["all-modules-system-stubs"],
Anton Hanssona4108912021-04-09 13:40:11 +0100370 dist: {
371 dir: "apistubs/android/test",
372 },
Anton Hanssona4748cd2021-04-09 10:16:19 +0100373}
374
375java_defaults {
Jihoon Kang491c7082023-06-15 18:37:01 +0000376 name: "android-non-updatable_from_text_defaults",
Jihoon Kang0c101db2023-03-14 07:03:46 +0000377 static_libs: ["framework-res-package-jar"],
378 libs: ["stub-annotations"],
379}
380
381java_api_library {
382 name: "android-non-updatable.stubs.from-text",
383 api_surface: "public",
384 api_files: [
385 ":non-updatable-current.txt",
386 ],
Jihoon Kang491c7082023-06-15 18:37:01 +0000387 defaults: ["android-non-updatable_from_text_defaults"],
Jihoon Kang12cddb32023-06-29 21:35:24 +0000388 full_api_surface_stub: "android_stubs_current.from-text",
Jihoon Kang0c101db2023-03-14 07:03:46 +0000389}
390
391java_api_library {
392 name: "android-non-updatable.stubs.system.from-text",
393 api_surface: "system",
394 api_files: [
395 ":non-updatable-current.txt",
396 ":non-updatable-system-current.txt",
397 ],
Jihoon Kang491c7082023-06-15 18:37:01 +0000398 defaults: ["android-non-updatable_from_text_defaults"],
Jihoon Kang12cddb32023-06-29 21:35:24 +0000399 full_api_surface_stub: "android_system_stubs_current.from-text",
Jihoon Kang0c101db2023-03-14 07:03:46 +0000400}
401
402java_api_library {
403 name: "android-non-updatable.stubs.test.from-text",
404 api_surface: "test",
405 api_files: [
406 ":non-updatable-current.txt",
407 ":non-updatable-system-current.txt",
408 ":non-updatable-test-current.txt",
409 ],
Jihoon Kang491c7082023-06-15 18:37:01 +0000410 defaults: ["android-non-updatable_from_text_defaults"],
Jihoon Kang12cddb32023-06-29 21:35:24 +0000411 full_api_surface_stub: "android_test_stubs_current.from-text",
Jihoon Kang0c101db2023-03-14 07:03:46 +0000412}
413
414java_api_library {
415 name: "android-non-updatable.stubs.module_lib.from-text",
416 api_surface: "module_lib",
417 api_files: [
418 ":non-updatable-current.txt",
419 ":non-updatable-system-current.txt",
420 ":non-updatable-module-lib-current.txt",
421 ],
Jihoon Kang491c7082023-06-15 18:37:01 +0000422 defaults: ["android-non-updatable_from_text_defaults"],
Jihoon Kang12cddb32023-06-29 21:35:24 +0000423 full_api_surface_stub: "android_module_lib_stubs_current_full.from-text",
Jihoon Kang0c101db2023-03-14 07:03:46 +0000424}
425
426java_defaults {
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000427 name: "android_stubs_dists_default",
428 dist: {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000429 targets: ["sdk"],
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000430 tag: ".jar",
431 dest: "android.jar",
432 },
Anton Hansson86925682021-04-14 14:54:43 +0100433 defaults_visibility: ["//frameworks/base/services"],
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000434}
435
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100436java_library {
Jihoon Kang1453baa2023-05-27 05:32:30 +0000437 name: "android_stubs_current.from-source",
Anton Hanssonc6e9d2f2022-01-25 15:53:43 +0000438 static_libs: [
439 "all-modules-public-stubs",
Anton Hanssona4748cd2021-04-09 10:16:19 +0100440 "android-non-updatable.stubs",
Anton Hanssonbf63f942020-05-20 12:06:23 +0100441 "private-stub-annotations-jar",
Anton Hansson76d3db42020-04-09 14:16:37 +0100442 ],
Anton Hansson65057af2021-04-14 18:52:08 +0100443 defaults: ["android.jar_defaults"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900444}
445
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100446java_library {
Jihoon Kang1453baa2023-05-27 05:32:30 +0000447 name: "android_system_stubs_current.from-source",
Anton Hanssonc6e9d2f2022-01-25 15:53:43 +0000448 static_libs: [
449 "all-modules-system-stubs",
Anton Hanssona4748cd2021-04-09 10:16:19 +0100450 "android-non-updatable.stubs.system",
Anton Hanssonbf63f942020-05-20 12:06:23 +0100451 "private-stub-annotations-jar",
Anton Hansson76d3db42020-04-09 14:16:37 +0100452 ],
Anton Hanssonc3002e52020-11-18 18:23:55 +0000453 defaults: [
Anton Hansson65057af2021-04-14 18:52:08 +0100454 "android.jar_defaults",
Anton Hanssonc3002e52020-11-18 18:23:55 +0000455 "android_stubs_dists_default",
456 ],
457 dist: {
458 dir: "apistubs/android/system",
459 },
460 dists: [
461 {
462 // Legacy dist path
Anton Hanssondd8ef672022-01-04 08:53:19 +0000463 targets: ["sdk"],
Anton Hanssonc3002e52020-11-18 18:23:55 +0000464 tag: ".jar",
465 dest: "android_system.jar",
466 },
467 ],
Anton Hansson76d3db42020-04-09 14:16:37 +0100468}
469
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100470java_library {
Jihoon Kang1453baa2023-05-27 05:32:30 +0000471 name: "android_test_stubs_current.from-source",
Anton Hanssonc6e9d2f2022-01-25 15:53:43 +0000472 static_libs: [
Nikita Ioffe5593fbb2022-12-01 14:52:34 +0000473 // Updatable modules do not have test APIs, but we want to include their SystemApis, like we
474 // include the SystemApi of framework-non-updatable-sources.
475 "all-updatable-modules-system-stubs",
476 // Non-updatable modules on the other hand can have test APIs, so include their test-stubs.
477 "all-non-updatable-modules-test-stubs",
Anton Hanssona4748cd2021-04-09 10:16:19 +0100478 "android-non-updatable.stubs.test",
Anton Hansson7ce31c12020-10-15 18:38:49 +0100479 "private-stub-annotations-jar",
480 ],
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000481 defaults: [
Anton Hansson65057af2021-04-14 18:52:08 +0100482 "android.jar_defaults",
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000483 "android_stubs_dists_default",
484 ],
485 dist: {
486 dir: "apistubs/android/test",
487 },
Jiyong Parke3095162019-12-20 15:30:28 +0900488}
489
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100490java_library {
Mark Whiteb03c1fc2023-08-12 01:31:26 +0000491 name: "android_test_frameworks_core_stubs_current.from-source",
492 static_libs: [
493 "all-updatable-modules-system-stubs",
494 "android-non-updatable.stubs.test",
Mark Whiteb03c1fc2023-08-12 01:31:26 +0000495 ],
496 defaults: [
497 "android.jar_defaults",
498 "android_stubs_dists_default",
499 ],
500 dist: {
501 dir: "apistubs/android/test-core",
502 },
503}
504
505java_library {
Jihoon Kang1453baa2023-05-27 05:32:30 +0000506 name: "android_module_lib_stubs_current.from-source",
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000507 defaults: [
Anton Hansson65057af2021-04-14 18:52:08 +0100508 "android.jar_defaults",
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000509 "android_stubs_dists_default",
510 ],
Anton Hanssona4748cd2021-04-09 10:16:19 +0100511 static_libs: [
512 "android-non-updatable.stubs.module_lib",
Victor Chang6b107a92021-06-17 23:49:42 +0100513 "art.module.public.api.stubs.module_lib",
Giulio Fiscella68a04112021-11-30 16:32:44 +0000514 "i18n.module.public.api.stubs",
Anton Hanssonb7d532e2021-02-05 11:40:25 +0000515 ],
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000516 dist: {
517 dir: "apistubs/android/module-lib",
518 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900519}
520
Andrei Oneafaa271a2021-03-17 13:32:51 +0000521java_library {
Jihoon Kang1453baa2023-05-27 05:32:30 +0000522 name: "android_system_server_stubs_current.from-source",
Anton Hansson21fb1082023-03-03 16:22:42 +0000523 defaults: [
524 "android.jar_defaults",
525 "android_stubs_dists_default",
526 ],
Andrei Oneafaa271a2021-03-17 13:32:51 +0000527 srcs: [":services-non-updatable-stubs"],
528 installable: false,
529 static_libs: [
Jihoon Kang1453baa2023-05-27 05:32:30 +0000530 "android_module_lib_stubs_current.from-source",
Andrei Oneafaa271a2021-03-17 13:32:51 +0000531 ],
Andrei Oneafaa271a2021-03-17 13:32:51 +0000532 dist: {
533 dir: "apistubs/android/system-server",
534 },
535}
536
Colin Crosscf87a572022-10-20 14:06:53 -0700537java_library {
538 name: "android_stubs_private_jar",
539 defaults: ["android.jar_defaults"],
540 visibility: [
541 "//visibility:override",
542 "//visibility:private",
543 ],
544 static_libs: [
545 "stable.core.platform.api.stubs",
546 "core-lambda-stubs-for-system-modules",
547 "core-generated-annotation-stubs",
548 "framework",
549 "ext",
550 "framework-res-package-jar",
551 // The order of this matters, it has to be last to provide a
552 // package-private androidx.annotation.RecentlyNonNull without
553 // overriding the public android.annotation.Nullable in framework.jar
554 // with its own package-private android.annotation.Nullable.
555 "private-stub-annotations-jar",
556 ],
557}
558
559java_genrule {
560 name: "android_stubs_private_hjar",
Colin Crosscf87a572022-10-20 14:06:53 -0700561 srcs: [":android_stubs_private_jar{.hjar}"],
562 out: ["android_stubs_private.jar"],
563 cmd: "cp $(in) $(out)",
564}
565
566java_library {
567 name: "android_stubs_private",
568 defaults: ["android_stubs_dists_default"],
Colin Crosscf87a572022-10-20 14:06:53 -0700569 sdk_version: "none",
570 system_modules: "none",
571 static_libs: ["android_stubs_private_hjar"],
572 dist: {
573 dir: "apistubs/android/private",
574 },
575}
576
577java_genrule {
578 name: "android_stubs_private_framework_aidl",
Colin Crosscf87a572022-10-20 14:06:53 -0700579 tools: ["sdkparcelables"],
580 srcs: [":android_stubs_private"],
581 out: ["framework.aidl"],
582 cmd: "rm -f $(genDir)/framework.aidl.merged && " +
583 "for i in $(in); do " +
584 " rm -f $(genDir)/framework.aidl.tmp && " +
585 " $(location sdkparcelables) $$i $(genDir)/framework.aidl.tmp && " +
586 " cat $(genDir)/framework.aidl.tmp >> $(genDir)/framework.aidl.merged; " +
587 "done && " +
588 "sort -u $(genDir)/framework.aidl.merged > $(out)",
589 dist: {
590 targets: ["sdk"],
591 dir: "apistubs/android/private",
592 },
593}
594
Jihoon Kang1f406452023-08-16 19:06:38 +0000595//
596// Java API defaults and libraries for single tree build
597//
598
599java_defaults {
600 name: "stub-annotation-defaults",
601 libs: [
602 "stub-annotations",
603 ],
604 static_libs: [
605 // stub annotations do not contribute to the API surfaces but are statically
606 // linked in the stubs for API surfaces (see frameworks/base/StubLibraries.bp).
607 // This is because annotation processors insist on loading the classes for any
608 // annotations found, thus should exist inside android.jar.
609 "private-stub-annotations-jar",
610 ],
611}
612
613// Listing of API domains contribution and dependencies per API surfaces
614java_defaults {
615 name: "android_test_stubs_current_contributions",
616 api_surface: "test",
617 api_contributions: [
618 "test-api-stubs-docs-non-updatable.api.contribution",
619 "framework-virtualization.stubs.source.test.api.contribution",
Mark White9ee18662023-08-07 11:18:09 +0000620 "framework-location.stubs.source.test.api.contribution",
Jihoon Kang1f406452023-08-16 19:06:38 +0000621 ],
622}
623
624java_defaults {
625 name: "android_test_frameworks_core_stubs_current_contributions",
626 api_surface: "test",
627 api_contributions: [
628 "test-api-stubs-docs-non-updatable.api.contribution",
629 ],
630}
631
632java_defaults {
633 name: "android_module_lib_stubs_current_contributions",
634 api_surface: "module-lib",
635 api_contributions: [
636 "api-stubs-docs-non-updatable.api.contribution",
637 "system-api-stubs-docs-non-updatable.api.contribution",
638 "module-lib-api-stubs-docs-non-updatable.api.contribution",
639 "art.module.public.api.stubs.source.api.contribution",
640 "art.module.public.api.stubs.source.system.api.contribution",
641 "art.module.public.api.stubs.source.module_lib.api.contribution",
642 "i18n.module.public.api.stubs.source.api.contribution",
643 "i18n.module.public.api.stubs.source.system.api.contribution",
644 "i18n.module.public.api.stubs.source.module_lib.api.contribution",
645 ],
646}
647
648// Java API library definitions per API surface
649java_api_library {
650 name: "android_stubs_current.from-text",
651 api_surface: "public",
652 defaults: [
653 // This module is dynamically created at frameworks/base/api/api.go
654 // instead of being written out, in order to minimize edits in the codebase
655 // when there is a change in the list of modules.
656 // that contributes to an api surface.
657 "android_stubs_current_contributions",
658 "stub-annotation-defaults",
659 ],
660 api_contributions: [
661 "api-stubs-docs-non-updatable.api.contribution",
662 ],
663 visibility: ["//visibility:public"],
664}
665
666java_api_library {
667 name: "android_system_stubs_current.from-text",
668 api_surface: "system",
669 defaults: [
670 "android_stubs_current_contributions",
671 "android_system_stubs_current_contributions",
672 "stub-annotation-defaults",
673 ],
674 api_contributions: [
675 "api-stubs-docs-non-updatable.api.contribution",
676 "system-api-stubs-docs-non-updatable.api.contribution",
677 ],
678 visibility: ["//visibility:public"],
679}
680
681java_api_library {
682 name: "android_test_stubs_current.from-text",
683 api_surface: "test",
684 defaults: [
685 "android_stubs_current_contributions",
686 "android_system_stubs_current_contributions",
687 "android_test_stubs_current_contributions",
688 "stub-annotation-defaults",
689 ],
690 api_contributions: [
691 "api-stubs-docs-non-updatable.api.contribution",
692 "system-api-stubs-docs-non-updatable.api.contribution",
693 ],
694 visibility: ["//visibility:public"],
695}
696
697java_api_library {
698 name: "android_test_frameworks_core_stubs_current.from-text",
699 api_surface: "test",
700 defaults: [
701 "android_stubs_current_contributions",
702 "android_system_stubs_current_contributions",
703 "android_test_frameworks_core_stubs_current_contributions",
704 "stub-annotation-defaults",
705 ],
706 api_contributions: [
707 "api-stubs-docs-non-updatable.api.contribution",
708 "system-api-stubs-docs-non-updatable.api.contribution",
709 ],
710}
711
712java_api_library {
713 name: "android_module_lib_stubs_current_full.from-text",
714 api_surface: "module-lib",
715 defaults: [
716 "android_stubs_current_contributions",
717 "android_system_stubs_current_contributions",
718 "android_module_lib_stubs_current_contributions_full",
719 ],
720 libs: [
721 "stub-annotations",
722 ],
723 api_contributions: [
724 "api-stubs-docs-non-updatable.api.contribution",
725 "system-api-stubs-docs-non-updatable.api.contribution",
726 "module-lib-api-stubs-docs-non-updatable.api.contribution",
727 ],
728 visibility: ["//visibility:public"],
729}
730
731java_api_library {
732 name: "android_module_lib_stubs_current.from-text",
733 api_surface: "module-lib",
734 defaults: [
735 "android_module_lib_stubs_current_contributions",
736 ],
737 libs: [
738 "android_module_lib_stubs_current_full.from-text",
739 "stub-annotations",
740 ],
741 visibility: ["//visibility:public"],
742}
743
744java_api_library {
745 name: "android_system_server_stubs_current.from-text",
746 api_surface: "system-server",
747 api_contributions: [
748 "services-non-updatable-stubs.api.contribution",
749 ],
750 libs: [
751 "android_module_lib_stubs_current.from-text",
752 "stub-annotations",
753 ],
754 static_libs: [
755 "android_module_lib_stubs_current.from-text",
756 ],
757 visibility: ["//visibility:public"],
758}
759
Anton Hansson36bc27c2021-09-14 15:45:13 +0100760////////////////////////////////////////////////////////////////////////
761// api-versions.xml generation, for public and system. This API database
762// also contains the android.test.* APIs.
763////////////////////////////////////////////////////////////////////////
764
765java_library {
766 name: "android_stubs_current_with_test_libs",
767 static_libs: [
768 "android_stubs_current",
769 "android.test.base.stubs",
770 "android.test.mock.stubs",
771 "android.test.runner.stubs",
772 ],
773 defaults: ["android.jar_defaults"],
774 visibility: [
775 "//visibility:override",
776 "//visibility:private",
777 ],
778}
779
780java_library {
781 name: "android_system_stubs_current_with_test_libs",
782 static_libs: [
783 "android_system_stubs_current",
784 "android.test.base.stubs.system",
785 "android.test.mock.stubs.system",
786 "android.test.runner.stubs.system",
787 ],
788 defaults: ["android.jar_defaults"],
789 visibility: [
790 "//visibility:override",
791 "//visibility:private",
792 ],
793}
794
Cole Faustdcda3702022-10-04 14:46:35 -0700795java_library {
796 name: "android_module_stubs_current_with_test_libs",
797 static_libs: [
798 "android_module_lib_stubs_current",
799 "android.test.base.stubs",
800 "android.test.mock.stubs",
801 "android.test.runner.stubs",
802 ],
803 defaults: ["android.jar_defaults"],
804 visibility: [
805 "//visibility:override",
806 "//visibility:private",
807 ],
808}
809
810java_library {
811 name: "android_system_server_stubs_current_with_test_libs",
812 static_libs: [
813 "android_system_server_stubs_current",
814 "android.test.base.stubs.system",
815 "android.test.mock.stubs.system",
816 "android.test.runner.stubs.system",
817 ],
818 defaults: ["android.jar_defaults"],
819 visibility: [
820 "//visibility:override",
821 "//visibility:private",
822 ],
823}
824
Anton Hansson36bc27c2021-09-14 15:45:13 +0100825droidstubs {
826 name: "api_versions_public",
827 srcs: [":android_stubs_current_with_test_libs{.jar}"],
828 generate_stubs: false,
829 api_levels_annotations_enabled: true,
830 api_levels_annotations_dirs: [
831 "sdk-dir",
832 "api-versions-jars-dir",
833 ],
Cole Faustdcda3702022-10-04 14:46:35 -0700834 api_levels_sdk_type: "public",
Mårten Kongstad54845332022-09-06 15:50:37 +0200835 extensions_info_file: ":sdk-extensions-info",
Anton Hanssonca6e67a2023-03-03 17:55:09 +0000836 visibility: ["//frameworks/base"],
Anton Hansson36bc27c2021-09-14 15:45:13 +0100837}
838
839droidstubs {
840 name: "api_versions_system",
841 srcs: [":android_system_stubs_current_with_test_libs{.jar}"],
842 generate_stubs: false,
843 api_levels_annotations_enabled: true,
844 api_levels_annotations_dirs: [
845 "sdk-dir",
846 "api-versions-jars-dir",
847 ],
848 api_levels_sdk_type: "system",
Mårten Kongstad54845332022-09-06 15:50:37 +0200849 extensions_info_file: ":sdk-extensions-info",
Anton Hansson36bc27c2021-09-14 15:45:13 +0100850}
851
Cole Faustbf4ce752023-02-08 12:46:06 -0800852// This module can be built with:
853// m out/soong/.intermediates/frameworks/base/api_versions_module_lib/android_common/metalava/api-versions.xml
Cole Faustdcda3702022-10-04 14:46:35 -0700854droidstubs {
855 name: "api_versions_module_lib",
856 srcs: [":android_module_stubs_current_with_test_libs{.jar}"],
857 generate_stubs: false,
858 api_levels_annotations_enabled: true,
Cole Faustbf4ce752023-02-08 12:46:06 -0800859 // this only has the non-updatable portions of the module lib sdk,
860 // which can reference classes from updatable apexes, so remove references to them
861 // from this api_versions file.
862 flags: ["--remove-missing-class-references-in-api-levels"],
Cole Faustdcda3702022-10-04 14:46:35 -0700863 api_levels_annotations_dirs: [
864 "sdk-dir",
865 "api-versions-jars-dir",
866 ],
867 api_levels_sdk_type: "module-lib",
Cole Faust1deced12023-02-15 13:24:18 -0800868 // extensions_info_file is purposefully omitted, because this module should just be
869 // the non-updatable portions of the sdk, and extension sdks are updatable.
Cole Faustdcda3702022-10-04 14:46:35 -0700870}
871
872droidstubs {
873 name: "api_versions_system_server",
874 srcs: [":android_system_server_stubs_current_with_test_libs{.jar}"],
875 generate_stubs: false,
876 api_levels_annotations_enabled: true,
Cole Faustbf4ce752023-02-08 12:46:06 -0800877 // this only has the non-updatable portions of the system server sdk,
878 // which can reference classes from updatable apexes, so remove references to them
879 // from this api_versions file.
880 flags: ["--remove-missing-class-references-in-api-levels"],
Cole Faustdcda3702022-10-04 14:46:35 -0700881 api_levels_annotations_dirs: [
882 "sdk-dir",
883 "api-versions-jars-dir",
884 ],
885 api_levels_sdk_type: "system-server",
Cole Faust1deced12023-02-15 13:24:18 -0800886 // extensions_info_file is purposefully omitted, because this module should just be
887 // the non-updatable portions of the sdk, and extension sdks are updatable.
Cole Faustdcda3702022-10-04 14:46:35 -0700888}
889
Jiyong Park7fb4b182019-12-20 14:35:43 +0900890/////////////////////////////////////////////////////////////////////
891// hwbinder.stubs provides APIs required for building HIDL Java
892// libraries.
893/////////////////////////////////////////////////////////////////////
894
895droidstubs {
896 name: "hwbinder-stubs-docs",
Anton Hansson23f319f2023-03-03 16:04:02 +0000897 srcs: [":hwbinder-stubs-srcs"],
Colin Cross037d7fb2021-03-25 17:01:55 -0700898 libs: ["framework-annotations-lib"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900899 installable: false,
900 sdk_version: "core_platform",
901 annotations_enabled: true,
Anton Hansson48ee95e2020-05-02 17:49:26 +0100902 previous_api: ":android.api.public.latest",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900903 merge_annotations_dirs: [
904 "metalava-manual",
905 ],
Anton Hansson81969c22020-02-03 20:45:56 +0000906 args: priv_apps,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900907}
908
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100909java_library {
Jiyong Park7fb4b182019-12-20 14:35:43 +0900910 name: "hwbinder.stubs",
911 sdk_version: "core_current",
Colin Cross037d7fb2021-03-25 17:01:55 -0700912 libs: ["framework-annotations-lib"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900913 srcs: [
914 ":hwbinder-stubs-docs",
915 ],
Anton Hansson86925682021-04-14 14:54:43 +0100916 visibility: ["//visibility:public"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900917}