blob: 8b535926a8e744753717e90b8ef9caa33109b487 [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 Kammer56896172023-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 ],
Anton Hansson76d3db42020-04-09 14:16:37 +010039 args: metalava_framework_docs_args,
40 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",
Anton Hansson76d3db42020-04-09 14:16:37 +010053 },
54 },
Anton Hansson85785fe2021-01-20 20:23:34 +000055 dists: [
56 {
Anton Hanssondd8ef672022-01-04 08:53:19 +000057 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +000058 dir: "apistubs/android/public/api",
59 dest: "android-non-updatable.txt",
60 tag: ".api.txt",
61 },
62 {
Anton Hanssondd8ef672022-01-04 08:53:19 +000063 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +000064 dir: "apistubs/android/public/api",
65 dest: "android-non-updatable-removed.txt",
66 tag: ".removed-api.txt",
67 },
68 ],
Jihoon Kang866b9b7a2023-09-20 22:28:05 +000069 api_surface: "public",
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
80test = " --show-annotation android.annotation.TestApi"
81
Anton Hansson240ee482021-04-14 12:52:00 +010082module_libs = " --show-annotation android.annotation.SystemApi\\(" +
83 "client=android.annotation.SystemApi.Client.MODULE_LIBRARIES" +
Anton Hansson2feb3f12020-11-13 11:44:32 +000084 "\\)"
Anton Hansson81969c22020-02-03 20:45:56 +000085
Jiyong Park7fb4b182019-12-20 14:35:43 +090086droidstubs {
Anton Hansson76d3db42020-04-09 14:16:37 +010087 name: "system-api-stubs-docs-non-updatable",
Mårten Kongstad85f6bee2023-09-25 14:09:11 +020088 srcs: [
89 ":framework-minus-apex-aconfig-srcjars",
90 ],
Anton Hansson9dce8322022-01-24 14:14:33 +000091 defaults: [
92 "android-non-updatable-stubs-defaults",
93 "module-classpath-stubs-defaults",
94 ],
Anton Hansson76d3db42020-04-09 14:16:37 +010095 args: metalava_framework_docs_args + priv_apps,
96 check_api: {
97 current: {
Anton Hanssonb7cda922023-03-03 15:38:28 +000098 api_file: ":non-updatable-system-current.txt",
99 removed_api_file: ":non-updatable-system-removed.txt",
Anton Hansson76d3db42020-04-09 14:16:37 +0100100 },
Anton Hansson37e102e2020-10-05 16:42:40 +0100101 last_released: {
102 api_file: ":android-non-updatable.api.system.latest",
103 removed_api_file: ":android-non-updatable-removed.api.system.latest",
Anton Hansson240ee482021-04-14 12:52:00 +0100104 baseline_file: ":android-non-updatable-incompatibilities.api.system.latest",
Anton Hansson37e102e2020-10-05 16:42:40 +0100105 },
Anton Hansson76d3db42020-04-09 14:16:37 +0100106 api_lint: {
107 enabled: true,
Anton Hansson4f90aa52021-06-04 22:23:59 +0100108 new_since: ":android.api.system.latest",
Anton Hanssonb7cda922023-03-03 15:38:28 +0000109 baseline_file: ":non-updatable-system-lint-baseline.txt",
Anton Hansson76d3db42020-04-09 14:16:37 +0100110 },
111 },
Anton Hansson85785fe2021-01-20 20:23:34 +0000112 dists: [
113 {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000114 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +0000115 dir: "apistubs/android/system/api",
116 dest: "android-non-updatable.txt",
117 tag: ".api.txt",
118 },
119 {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000120 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +0000121 dir: "apistubs/android/system/api",
122 dest: "android-non-updatable-removed.txt",
123 tag: ".removed-api.txt",
124 },
125 ],
Jihoon Kang866b9b7a2023-09-20 22:28:05 +0000126 api_surface: "system",
Anton Hansson76d3db42020-04-09 14:16:37 +0100127}
128
129droidstubs {
Anton Hansson022aac52020-11-05 10:45:13 +0000130 name: "test-api-stubs-docs-non-updatable",
Mårten Kongstad85f6bee2023-09-25 14:09:11 +0200131 srcs: [
132 ":framework-minus-apex-aconfig-srcjars",
133 ],
Anton Hansson9dce8322022-01-24 14:14:33 +0000134 defaults: [
135 "android-non-updatable-stubs-defaults",
136 "module-classpath-stubs-defaults",
137 ],
Anton Hansson2feb3f12020-11-13 11:44:32 +0000138 args: metalava_framework_docs_args + test + priv_apps_in_stubs,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900139 check_api: {
140 current: {
Anton Hanssonb7cda922023-03-03 15:38:28 +0000141 api_file: ":non-updatable-test-current.txt",
142 removed_api_file: ":non-updatable-test-removed.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900143 },
144 api_lint: {
145 enabled: true,
Anton Hanssonb7cda922023-03-03 15:38:28 +0000146 baseline_file: ":non-updatable-test-lint-baseline.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900147 },
148 },
Anton Hansson85785fe2021-01-20 20:23:34 +0000149 dists: [
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: "android.txt",
154 tag: ".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: "removed.txt",
160 tag: ".removed-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.txt",
166 tag: ".api.txt",
167 },
168 {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000169 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +0000170 dir: "apistubs/android/test/api",
171 dest: "android-non-updatable-removed.txt",
172 tag: ".removed-api.txt",
173 },
174 ],
Jihoon Kang866b9b7a2023-09-20 22:28:05 +0000175 api_surface: "test",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900176}
177
Jiyong Parke3095162019-12-20 15:30:28 +0900178droidstubs {
Anton Hansson76d3db42020-04-09 14:16:37 +0100179 name: "module-lib-api-stubs-docs-non-updatable",
Mårten Kongstad85f6bee2023-09-25 14:09:11 +0200180 srcs: [
181 ":framework-minus-apex-aconfig-srcjars",
182 ],
Anton Hansson9dce8322022-01-24 14:14:33 +0000183 defaults: [
184 "android-non-updatable-stubs-defaults",
185 "module-classpath-stubs-defaults",
186 ],
Anton Hansson2feb3f12020-11-13 11:44:32 +0000187 args: metalava_framework_docs_args + priv_apps_in_stubs + module_libs,
Anton Hansson76d3db42020-04-09 14:16:37 +0100188 check_api: {
189 current: {
Anton Hanssonb7cda922023-03-03 15:38:28 +0000190 api_file: ":non-updatable-module-lib-current.txt",
191 removed_api_file: ":non-updatable-module-lib-removed.txt",
Anton Hansson76d3db42020-04-09 14:16:37 +0100192 },
Anton Hanssonc3ef1f562020-10-07 14:55:36 +0100193 last_released: {
194 api_file: ":android-non-updatable.api.module-lib.latest",
195 removed_api_file: ":android-non-updatable-removed.api.module-lib.latest",
Junyu Lai2dbb1772022-01-12 17:38:02 +0000196 baseline_file: ":android-non-updatable-incompatibilities.api.module-lib.latest",
Anton Hanssonc3ef1f562020-10-07 14:55:36 +0100197 },
Anton Hansson76d3db42020-04-09 14:16:37 +0100198 api_lint: {
199 enabled: true,
Anton Hansson4f90aa52021-06-04 22:23:59 +0100200 new_since: ":android.api.module-lib.latest",
Anton Hanssonb7cda922023-03-03 15:38:28 +0000201 baseline_file: ":non-updatable-module-lib-lint-baseline.txt",
Anton Hansson76d3db42020-04-09 14:16:37 +0100202 },
203 },
Anton Hansson85785fe2021-01-20 20:23:34 +0000204 dists: [
205 {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000206 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +0000207 dir: "apistubs/android/module-lib/api",
208 dest: "android-non-updatable.txt",
209 tag: ".api.txt",
210 },
211 {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000212 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +0000213 dir: "apistubs/android/module-lib/api",
214 dest: "android-non-updatable-removed.txt",
215 tag: ".removed-api.txt",
216 },
217 ],
Jihoon Kang866b9b7a2023-09-20 22:28:05 +0000218 api_surface: "module-lib",
Anton Hansson76d3db42020-04-09 14:16:37 +0100219}
Anton Hansson81969c22020-02-03 20:45:56 +0000220
Jiyong Parke3095162019-12-20 15:30:28 +0900221/////////////////////////////////////////////////////////////////////
Jiyong Park7fb4b182019-12-20 14:35:43 +0900222// android_*_stubs_current modules are the stubs libraries compiled
Anton Hansson2feb3f12020-11-13 11:44:32 +0000223// from stub sources
Jiyong Park7fb4b182019-12-20 14:35:43 +0900224/////////////////////////////////////////////////////////////////////
225
226java_defaults {
Anton Hanssonc43a66b2022-03-03 15:14:04 +0000227 name: "android.jar_defaults",
228 sdk_version: "none",
229 system_modules: "none",
230 java_version: "1.8",
231 compile_dex: true,
Anton Hanssonc43a66b2022-03-03 15:14:04 +0000232 visibility: ["//visibility:public"],
233}
234
235java_defaults {
Jihoon Kang491c7082023-06-15 18:37:01 +0000236 name: "android-non-updatable_defaults",
Anton Hanssonfbd32f32020-04-09 14:16:37 +0100237 sdk_version: "none",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900238 system_modules: "none",
239 java_version: "1.8",
240 compile_dex: true,
Jihoon Kang491c7082023-06-15 18:37:01 +0000241}
242
243java_defaults {
244 name: "android-non-updatable_from_source_defaults",
245 libs: ["stub-annotations"],
246 static_libs: ["framework-res-package-jar"], // Export package of framework-res
Anton Hanssona4108912021-04-09 13:40:11 +0100247 dist: {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000248 targets: ["sdk"],
Anton Hanssona4108912021-04-09 13:40:11 +0100249 tag: ".jar",
250 dest: "android-non-updatable.jar",
Anton Hansson240ee482021-04-14 12:52:00 +0100251 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900252}
253
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100254java_library {
Anton Hanssona4748cd2021-04-09 10:16:19 +0100255 name: "android-non-updatable.stubs",
Jihoon Kang491c7082023-06-15 18:37:01 +0000256 defaults: ["android-non-updatable_defaults"],
257 static_libs: [
258 "android-non-updatable.stubs.from-source",
259 ],
260 product_variables: {
261 build_from_text_stub: {
262 static_libs: [
263 "android-non-updatable.stubs.from-text",
264 ],
265 exclude_static_libs: [
266 "android-non-updatable.stubs.from-source",
267 ],
268 },
269 },
270}
271
272java_library {
273 name: "android-non-updatable.stubs.system",
274 defaults: ["android-non-updatable_defaults"],
275 static_libs: [
276 "android-non-updatable.stubs.system.from-source",
277 ],
278 product_variables: {
279 build_from_text_stub: {
280 static_libs: [
281 "android-non-updatable.stubs.system.from-text",
282 ],
283 exclude_static_libs: [
284 "android-non-updatable.stubs.system.from-source",
285 ],
286 },
287 },
288}
289
290java_library {
291 name: "android-non-updatable.stubs.module_lib",
292 defaults: ["android-non-updatable_defaults"],
293 static_libs: [
294 "android-non-updatable.stubs.module_lib.from-source",
295 ],
296 product_variables: {
297 build_from_text_stub: {
298 static_libs: [
299 "android-non-updatable.stubs.module_lib.from-text",
300 ],
301 exclude_static_libs: [
302 "android-non-updatable.stubs.module_lib.from-source",
303 ],
304 },
305 },
306}
307
308java_library {
309 name: "android-non-updatable.stubs.test",
310 defaults: ["android-non-updatable_defaults"],
311 static_libs: [
312 "android-non-updatable.stubs.test.from-source",
313 ],
314 product_variables: {
315 build_from_text_stub: {
316 static_libs: [
317 "android-non-updatable.stubs.test.from-text",
318 ],
319 exclude_static_libs: [
320 "android-non-updatable.stubs.test.from-source",
321 ],
322 },
323 },
324}
325
326java_library {
327 name: "android-non-updatable.stubs.from-source",
328 defaults: [
329 "android-non-updatable_defaults",
330 "android-non-updatable_from_source_defaults",
331 ],
Anton Hanssona4748cd2021-04-09 10:16:19 +0100332 srcs: [":api-stubs-docs-non-updatable"],
Anton Hanssonc6e9d2f2022-01-25 15:53:43 +0000333 libs: ["all-modules-public-stubs"],
Anton Hanssona4108912021-04-09 13:40:11 +0100334 dist: {
335 dir: "apistubs/android/public",
336 },
Anton Hanssona4748cd2021-04-09 10:16:19 +0100337}
338
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100339java_library {
Jihoon Kang491c7082023-06-15 18:37:01 +0000340 name: "android-non-updatable.stubs.system.from-source",
341 defaults: [
342 "android-non-updatable_defaults",
343 "android-non-updatable_from_source_defaults",
344 ],
Anton Hansson240ee482021-04-14 12:52:00 +0100345 srcs: [":system-api-stubs-docs-non-updatable"],
Anton Hanssonc6e9d2f2022-01-25 15:53:43 +0000346 libs: ["all-modules-system-stubs"],
Anton Hanssona4108912021-04-09 13:40:11 +0100347 dist: {
348 dir: "apistubs/android/system",
349 },
Anton Hanssona4748cd2021-04-09 10:16:19 +0100350}
351
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100352java_library {
Jihoon Kang491c7082023-06-15 18:37:01 +0000353 name: "android-non-updatable.stubs.module_lib.from-source",
354 defaults: [
355 "android-non-updatable_defaults",
356 "android-non-updatable_from_source_defaults",
357 ],
Anton Hanssona4748cd2021-04-09 10:16:19 +0100358 srcs: [":module-lib-api-stubs-docs-non-updatable"],
359 libs: [
markchiencd813a32021-11-11 00:42:55 +0800360 "sdk_module-lib_current_framework-tethering",
paulhu2a8c2c32022-02-08 21:23:06 +0800361 "sdk_module-lib_current_framework-connectivity-t",
Roopa Sattiraju86058b62022-01-20 10:05:19 -0800362 "sdk_public_current_framework-bluetooth",
363 // NOTE: The below can be removed once the prebuilt stub contains bluetooth.
Anton Hanssona4748cd2021-04-09 10:16:19 +0100364 "sdk_system_current_android",
365 // NOTE: The below can be removed once the prebuilt stub contains IKE.
366 "sdk_system_current_android.net.ipsec.ike",
367 ],
Anton Hanssona4108912021-04-09 13:40:11 +0100368 dist: {
369 dir: "apistubs/android/module-lib",
370 },
Anton Hanssona4748cd2021-04-09 10:16:19 +0100371}
372
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100373java_library {
Jihoon Kang491c7082023-06-15 18:37:01 +0000374 name: "android-non-updatable.stubs.test.from-source",
375 defaults: [
376 "android-non-updatable_defaults",
377 "android-non-updatable_from_source_defaults",
378 ],
Anton Hanssona4748cd2021-04-09 10:16:19 +0100379 srcs: [":test-api-stubs-docs-non-updatable"],
Anton Hanssonc6e9d2f2022-01-25 15:53:43 +0000380 libs: ["all-modules-system-stubs"],
Anton Hanssona4108912021-04-09 13:40:11 +0100381 dist: {
382 dir: "apistubs/android/test",
383 },
Anton Hanssona4748cd2021-04-09 10:16:19 +0100384}
385
386java_defaults {
Jihoon Kang491c7082023-06-15 18:37:01 +0000387 name: "android-non-updatable_from_text_defaults",
Jihoon Kang0c101db2023-03-14 07:03:46 +0000388 static_libs: ["framework-res-package-jar"],
389 libs: ["stub-annotations"],
390}
391
392java_api_library {
393 name: "android-non-updatable.stubs.from-text",
394 api_surface: "public",
Jihoon Kang25b6ced2023-09-20 21:48:09 +0000395 api_contributions: [
396 "api-stubs-docs-non-updatable.api.contribution",
Jihoon Kang0c101db2023-03-14 07:03:46 +0000397 ],
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_stubs_current.from-text",
Jihoon Kang0c101db2023-03-14 07:03:46 +0000400}
401
402java_api_library {
403 name: "android-non-updatable.stubs.system.from-text",
404 api_surface: "system",
Jihoon Kang25b6ced2023-09-20 21:48:09 +0000405 api_contributions: [
406 "api-stubs-docs-non-updatable.api.contribution",
407 "system-api-stubs-docs-non-updatable.api.contribution",
Jihoon Kang0c101db2023-03-14 07:03:46 +0000408 ],
Jihoon Kang491c7082023-06-15 18:37:01 +0000409 defaults: ["android-non-updatable_from_text_defaults"],
Jihoon Kang12cddb32023-06-29 21:35:24 +0000410 full_api_surface_stub: "android_system_stubs_current.from-text",
Jihoon Kang0c101db2023-03-14 07:03:46 +0000411}
412
413java_api_library {
414 name: "android-non-updatable.stubs.test.from-text",
415 api_surface: "test",
Jihoon Kang25b6ced2023-09-20 21:48:09 +0000416 api_contributions: [
417 "api-stubs-docs-non-updatable.api.contribution",
418 "system-api-stubs-docs-non-updatable.api.contribution",
419 "test-api-stubs-docs-non-updatable.api.contribution",
Jihoon Kang0c101db2023-03-14 07:03:46 +0000420 ],
Jihoon Kang491c7082023-06-15 18:37:01 +0000421 defaults: ["android-non-updatable_from_text_defaults"],
Jihoon Kang12cddb32023-06-29 21:35:24 +0000422 full_api_surface_stub: "android_test_stubs_current.from-text",
Jihoon Kang0c101db2023-03-14 07:03:46 +0000423}
424
425java_api_library {
426 name: "android-non-updatable.stubs.module_lib.from-text",
427 api_surface: "module_lib",
Jihoon Kang25b6ced2023-09-20 21:48:09 +0000428 api_contributions: [
429 "api-stubs-docs-non-updatable.api.contribution",
430 "system-api-stubs-docs-non-updatable.api.contribution",
431 "module-lib-api-stubs-docs-non-updatable.api.contribution",
Jihoon Kang0c101db2023-03-14 07:03:46 +0000432 ],
Jihoon Kang491c7082023-06-15 18:37:01 +0000433 defaults: ["android-non-updatable_from_text_defaults"],
Jihoon Kang12cddb32023-06-29 21:35:24 +0000434 full_api_surface_stub: "android_module_lib_stubs_current_full.from-text",
Jihoon Kang0c101db2023-03-14 07:03:46 +0000435}
436
437java_defaults {
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000438 name: "android_stubs_dists_default",
439 dist: {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000440 targets: ["sdk"],
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000441 tag: ".jar",
442 dest: "android.jar",
443 },
Anton Hansson86925682021-04-14 14:54:43 +0100444 defaults_visibility: ["//frameworks/base/services"],
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000445}
446
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100447java_library {
Jihoon Kang1453baa2023-05-27 05:32:30 +0000448 name: "android_stubs_current.from-source",
Anton Hanssonc6e9d2f2022-01-25 15:53:43 +0000449 static_libs: [
450 "all-modules-public-stubs",
Anton Hanssona4748cd2021-04-09 10:16:19 +0100451 "android-non-updatable.stubs",
Anton Hanssonbf63f942020-05-20 12:06:23 +0100452 "private-stub-annotations-jar",
Anton Hansson76d3db42020-04-09 14:16:37 +0100453 ],
Anton Hansson65057af2021-04-14 18:52:08 +0100454 defaults: ["android.jar_defaults"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900455}
456
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100457java_library {
Jihoon Kang1453baa2023-05-27 05:32:30 +0000458 name: "android_system_stubs_current.from-source",
Anton Hanssonc6e9d2f2022-01-25 15:53:43 +0000459 static_libs: [
460 "all-modules-system-stubs",
Anton Hanssona4748cd2021-04-09 10:16:19 +0100461 "android-non-updatable.stubs.system",
Anton Hanssonbf63f942020-05-20 12:06:23 +0100462 "private-stub-annotations-jar",
Anton Hansson76d3db42020-04-09 14:16:37 +0100463 ],
Anton Hanssonc3002e52020-11-18 18:23:55 +0000464 defaults: [
Anton Hansson65057af2021-04-14 18:52:08 +0100465 "android.jar_defaults",
Anton Hanssonc3002e52020-11-18 18:23:55 +0000466 "android_stubs_dists_default",
467 ],
468 dist: {
469 dir: "apistubs/android/system",
470 },
471 dists: [
472 {
473 // Legacy dist path
Anton Hanssondd8ef672022-01-04 08:53:19 +0000474 targets: ["sdk"],
Anton Hanssonc3002e52020-11-18 18:23:55 +0000475 tag: ".jar",
476 dest: "android_system.jar",
477 },
478 ],
Anton Hansson76d3db42020-04-09 14:16:37 +0100479}
480
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100481java_library {
Jihoon Kang1453baa2023-05-27 05:32:30 +0000482 name: "android_test_stubs_current.from-source",
Anton Hanssonc6e9d2f2022-01-25 15:53:43 +0000483 static_libs: [
Nikita Ioffe5593fbb2022-12-01 14:52:34 +0000484 // Updatable modules do not have test APIs, but we want to include their SystemApis, like we
485 // include the SystemApi of framework-non-updatable-sources.
486 "all-updatable-modules-system-stubs",
487 // Non-updatable modules on the other hand can have test APIs, so include their test-stubs.
488 "all-non-updatable-modules-test-stubs",
Anton Hanssona4748cd2021-04-09 10:16:19 +0100489 "android-non-updatable.stubs.test",
Anton Hansson7ce31c12020-10-15 18:38:49 +0100490 "private-stub-annotations-jar",
491 ],
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000492 defaults: [
Anton Hansson65057af2021-04-14 18:52:08 +0100493 "android.jar_defaults",
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000494 "android_stubs_dists_default",
495 ],
496 dist: {
497 dir: "apistubs/android/test",
498 },
Jiyong Parke3095162019-12-20 15:30:28 +0900499}
500
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100501java_library {
Jihoon Kang1453baa2023-05-27 05:32:30 +0000502 name: "android_module_lib_stubs_current.from-source",
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000503 defaults: [
Anton Hansson65057af2021-04-14 18:52:08 +0100504 "android.jar_defaults",
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000505 "android_stubs_dists_default",
506 ],
Anton Hanssona4748cd2021-04-09 10:16:19 +0100507 static_libs: [
508 "android-non-updatable.stubs.module_lib",
Victor Chang6b107a92021-06-17 23:49:42 +0100509 "art.module.public.api.stubs.module_lib",
Giulio Fiscella68a04112021-11-30 16:32:44 +0000510 "i18n.module.public.api.stubs",
Anton Hanssonb7d532e2021-02-05 11:40:25 +0000511 ],
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000512 dist: {
513 dir: "apistubs/android/module-lib",
514 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900515}
516
Andrei Oneafaa271a2021-03-17 13:32:51 +0000517java_library {
Jihoon Kang1453baa2023-05-27 05:32:30 +0000518 name: "android_system_server_stubs_current.from-source",
Anton Hansson21fb1082023-03-03 16:22:42 +0000519 defaults: [
520 "android.jar_defaults",
521 "android_stubs_dists_default",
522 ],
Andrei Oneafaa271a2021-03-17 13:32:51 +0000523 srcs: [":services-non-updatable-stubs"],
524 installable: false,
525 static_libs: [
Jihoon Kang1453baa2023-05-27 05:32:30 +0000526 "android_module_lib_stubs_current.from-source",
Andrei Oneafaa271a2021-03-17 13:32:51 +0000527 ],
Andrei Oneafaa271a2021-03-17 13:32:51 +0000528 dist: {
529 dir: "apistubs/android/system-server",
530 },
531}
532
Colin Crosscf87a572022-10-20 14:06:53 -0700533java_library {
534 name: "android_stubs_private_jar",
535 defaults: ["android.jar_defaults"],
536 visibility: [
537 "//visibility:override",
538 "//visibility:private",
539 ],
540 static_libs: [
541 "stable.core.platform.api.stubs",
542 "core-lambda-stubs-for-system-modules",
543 "core-generated-annotation-stubs",
544 "framework",
545 "ext",
546 "framework-res-package-jar",
547 // The order of this matters, it has to be last to provide a
548 // package-private androidx.annotation.RecentlyNonNull without
549 // overriding the public android.annotation.Nullable in framework.jar
550 // with its own package-private android.annotation.Nullable.
551 "private-stub-annotations-jar",
552 ],
553}
554
555java_genrule {
556 name: "android_stubs_private_hjar",
Colin Crosscf87a572022-10-20 14:06:53 -0700557 srcs: [":android_stubs_private_jar{.hjar}"],
558 out: ["android_stubs_private.jar"],
559 cmd: "cp $(in) $(out)",
560}
561
562java_library {
563 name: "android_stubs_private",
564 defaults: ["android_stubs_dists_default"],
Colin Crosscf87a572022-10-20 14:06:53 -0700565 sdk_version: "none",
566 system_modules: "none",
567 static_libs: ["android_stubs_private_hjar"],
568 dist: {
569 dir: "apistubs/android/private",
570 },
571}
572
573java_genrule {
574 name: "android_stubs_private_framework_aidl",
Colin Crosscf87a572022-10-20 14:06:53 -0700575 tools: ["sdkparcelables"],
576 srcs: [":android_stubs_private"],
577 out: ["framework.aidl"],
578 cmd: "rm -f $(genDir)/framework.aidl.merged && " +
579 "for i in $(in); do " +
580 " rm -f $(genDir)/framework.aidl.tmp && " +
581 " $(location sdkparcelables) $$i $(genDir)/framework.aidl.tmp && " +
582 " cat $(genDir)/framework.aidl.tmp >> $(genDir)/framework.aidl.merged; " +
583 "done && " +
584 "sort -u $(genDir)/framework.aidl.merged > $(out)",
585 dist: {
586 targets: ["sdk"],
587 dir: "apistubs/android/private",
588 },
589}
590
Jihoon Kang21f8b0e2023-08-17 18:14:35 +0000591//
592// Java API defaults and libraries for single tree build
593//
594
595java_defaults {
596 name: "stub-annotation-defaults",
597 libs: [
598 "stub-annotations",
599 ],
600 static_libs: [
601 // stub annotations do not contribute to the API surfaces but are statically
602 // linked in the stubs for API surfaces (see frameworks/base/StubLibraries.bp).
603 // This is because annotation processors insist on loading the classes for any
604 // annotations found, thus should exist inside android.jar.
605 "private-stub-annotations-jar",
606 ],
607}
608
609// Listing of API domains contribution and dependencies per API surfaces
610java_defaults {
611 name: "android_test_stubs_current_contributions",
612 api_surface: "test",
613 api_contributions: [
Jihoon Kang21f8b0e2023-08-17 18:14:35 +0000614 "framework-virtualization.stubs.source.test.api.contribution",
615 ],
616}
617
618java_defaults {
619 name: "android_module_lib_stubs_current_contributions",
620 api_surface: "module-lib",
621 api_contributions: [
622 "api-stubs-docs-non-updatable.api.contribution",
623 "system-api-stubs-docs-non-updatable.api.contribution",
624 "module-lib-api-stubs-docs-non-updatable.api.contribution",
625 "art.module.public.api.stubs.source.api.contribution",
626 "art.module.public.api.stubs.source.system.api.contribution",
627 "art.module.public.api.stubs.source.module_lib.api.contribution",
628 "i18n.module.public.api.stubs.source.api.contribution",
629 "i18n.module.public.api.stubs.source.system.api.contribution",
630 "i18n.module.public.api.stubs.source.module_lib.api.contribution",
631 ],
632}
633
634// Java API library definitions per API surface
635java_api_library {
636 name: "android_stubs_current.from-text",
637 api_surface: "public",
638 defaults: [
639 // This module is dynamically created at frameworks/base/api/api.go
640 // instead of being written out, in order to minimize edits in the codebase
641 // when there is a change in the list of modules.
642 // that contributes to an api surface.
643 "android_stubs_current_contributions",
644 "stub-annotation-defaults",
645 ],
646 api_contributions: [
647 "api-stubs-docs-non-updatable.api.contribution",
648 ],
649 visibility: ["//visibility:public"],
650}
651
652java_api_library {
653 name: "android_system_stubs_current.from-text",
654 api_surface: "system",
655 defaults: [
656 "android_stubs_current_contributions",
657 "android_system_stubs_current_contributions",
658 "stub-annotation-defaults",
659 ],
660 api_contributions: [
661 "api-stubs-docs-non-updatable.api.contribution",
662 "system-api-stubs-docs-non-updatable.api.contribution",
663 ],
664 visibility: ["//visibility:public"],
665}
666
667java_api_library {
668 name: "android_test_stubs_current.from-text",
669 api_surface: "test",
670 defaults: [
671 "android_stubs_current_contributions",
672 "android_system_stubs_current_contributions",
673 "android_test_stubs_current_contributions",
674 "stub-annotation-defaults",
675 ],
676 api_contributions: [
677 "api-stubs-docs-non-updatable.api.contribution",
678 "system-api-stubs-docs-non-updatable.api.contribution",
Jihoon Kang1c5022b2023-09-20 22:02:29 +0000679 "test-api-stubs-docs-non-updatable.api.contribution",
Jihoon Kang21f8b0e2023-08-17 18:14:35 +0000680 ],
681 visibility: ["//visibility:public"],
682}
683
684java_api_library {
685 name: "android_module_lib_stubs_current_full.from-text",
686 api_surface: "module-lib",
687 defaults: [
688 "android_stubs_current_contributions",
689 "android_system_stubs_current_contributions",
690 "android_module_lib_stubs_current_contributions_full",
691 ],
692 libs: [
693 "stub-annotations",
694 ],
695 api_contributions: [
696 "api-stubs-docs-non-updatable.api.contribution",
697 "system-api-stubs-docs-non-updatable.api.contribution",
698 "module-lib-api-stubs-docs-non-updatable.api.contribution",
699 ],
700 visibility: ["//visibility:public"],
701}
702
703java_api_library {
704 name: "android_module_lib_stubs_current.from-text",
705 api_surface: "module-lib",
706 defaults: [
707 "android_module_lib_stubs_current_contributions",
708 ],
709 libs: [
710 "android_module_lib_stubs_current_full.from-text",
711 "stub-annotations",
712 ],
713 visibility: ["//visibility:public"],
714}
715
716java_api_library {
717 name: "android_system_server_stubs_current.from-text",
718 api_surface: "system-server",
719 api_contributions: [
720 "services-non-updatable-stubs.api.contribution",
721 ],
722 libs: [
723 "android_module_lib_stubs_current.from-text",
724 "stub-annotations",
725 ],
726 static_libs: [
727 "android_module_lib_stubs_current.from-text",
728 ],
729 visibility: ["//visibility:public"],
730}
731
Anton Hansson36bc27c2021-09-14 15:45:13 +0100732////////////////////////////////////////////////////////////////////////
733// api-versions.xml generation, for public and system. This API database
734// also contains the android.test.* APIs.
735////////////////////////////////////////////////////////////////////////
736
737java_library {
738 name: "android_stubs_current_with_test_libs",
739 static_libs: [
740 "android_stubs_current",
741 "android.test.base.stubs",
742 "android.test.mock.stubs",
743 "android.test.runner.stubs",
744 ],
745 defaults: ["android.jar_defaults"],
746 visibility: [
747 "//visibility:override",
748 "//visibility:private",
749 ],
750}
751
752java_library {
753 name: "android_system_stubs_current_with_test_libs",
754 static_libs: [
755 "android_system_stubs_current",
756 "android.test.base.stubs.system",
757 "android.test.mock.stubs.system",
758 "android.test.runner.stubs.system",
759 ],
760 defaults: ["android.jar_defaults"],
761 visibility: [
762 "//visibility:override",
763 "//visibility:private",
764 ],
765}
766
Cole Faustdcda3702022-10-04 14:46:35 -0700767java_library {
768 name: "android_module_stubs_current_with_test_libs",
769 static_libs: [
770 "android_module_lib_stubs_current",
771 "android.test.base.stubs",
772 "android.test.mock.stubs",
773 "android.test.runner.stubs",
774 ],
775 defaults: ["android.jar_defaults"],
776 visibility: [
777 "//visibility:override",
778 "//visibility:private",
779 ],
780}
781
782java_library {
783 name: "android_system_server_stubs_current_with_test_libs",
784 static_libs: [
785 "android_system_server_stubs_current",
786 "android.test.base.stubs.system",
787 "android.test.mock.stubs.system",
788 "android.test.runner.stubs.system",
789 ],
790 defaults: ["android.jar_defaults"],
791 visibility: [
792 "//visibility:override",
793 "//visibility:private",
794 ],
795}
796
Anton Hansson36bc27c2021-09-14 15:45:13 +0100797droidstubs {
798 name: "api_versions_public",
799 srcs: [":android_stubs_current_with_test_libs{.jar}"],
800 generate_stubs: false,
801 api_levels_annotations_enabled: true,
802 api_levels_annotations_dirs: [
803 "sdk-dir",
804 "api-versions-jars-dir",
805 ],
Cole Faustdcda3702022-10-04 14:46:35 -0700806 api_levels_sdk_type: "public",
Mårten Kongstad54845332022-09-06 15:50:37 +0200807 extensions_info_file: ":sdk-extensions-info",
Anton Hanssonca6e67a2023-03-03 17:55:09 +0000808 visibility: ["//frameworks/base"],
Anton Hansson36bc27c2021-09-14 15:45:13 +0100809}
810
811droidstubs {
812 name: "api_versions_system",
813 srcs: [":android_system_stubs_current_with_test_libs{.jar}"],
814 generate_stubs: false,
815 api_levels_annotations_enabled: true,
816 api_levels_annotations_dirs: [
817 "sdk-dir",
818 "api-versions-jars-dir",
819 ],
820 api_levels_sdk_type: "system",
Mårten Kongstad54845332022-09-06 15:50:37 +0200821 extensions_info_file: ":sdk-extensions-info",
Anton Hansson36bc27c2021-09-14 15:45:13 +0100822}
823
Cole Faustbf4ce752023-02-08 12:46:06 -0800824// This module can be built with:
825// m out/soong/.intermediates/frameworks/base/api_versions_module_lib/android_common/metalava/api-versions.xml
Cole Faustdcda3702022-10-04 14:46:35 -0700826droidstubs {
827 name: "api_versions_module_lib",
828 srcs: [":android_module_stubs_current_with_test_libs{.jar}"],
829 generate_stubs: false,
830 api_levels_annotations_enabled: true,
Cole Faustbf4ce752023-02-08 12:46:06 -0800831 // this only has the non-updatable portions of the module lib sdk,
832 // which can reference classes from updatable apexes, so remove references to them
833 // from this api_versions file.
834 flags: ["--remove-missing-class-references-in-api-levels"],
Cole Faustdcda3702022-10-04 14:46:35 -0700835 api_levels_annotations_dirs: [
836 "sdk-dir",
837 "api-versions-jars-dir",
838 ],
839 api_levels_sdk_type: "module-lib",
Cole Faust1deced12023-02-15 13:24:18 -0800840 // extensions_info_file is purposefully omitted, because this module should just be
841 // the non-updatable portions of the sdk, and extension sdks are updatable.
Cole Faustdcda3702022-10-04 14:46:35 -0700842}
843
844droidstubs {
845 name: "api_versions_system_server",
846 srcs: [":android_system_server_stubs_current_with_test_libs{.jar}"],
847 generate_stubs: false,
848 api_levels_annotations_enabled: true,
Cole Faustbf4ce752023-02-08 12:46:06 -0800849 // this only has the non-updatable portions of the system server sdk,
850 // which can reference classes from updatable apexes, so remove references to them
851 // from this api_versions file.
852 flags: ["--remove-missing-class-references-in-api-levels"],
Cole Faustdcda3702022-10-04 14:46:35 -0700853 api_levels_annotations_dirs: [
854 "sdk-dir",
855 "api-versions-jars-dir",
856 ],
857 api_levels_sdk_type: "system-server",
Cole Faust1deced12023-02-15 13:24:18 -0800858 // extensions_info_file is purposefully omitted, because this module should just be
859 // the non-updatable portions of the sdk, and extension sdks are updatable.
Cole Faustdcda3702022-10-04 14:46:35 -0700860}
861
Jiyong Park7fb4b182019-12-20 14:35:43 +0900862/////////////////////////////////////////////////////////////////////
863// hwbinder.stubs provides APIs required for building HIDL Java
864// libraries.
865/////////////////////////////////////////////////////////////////////
866
867droidstubs {
868 name: "hwbinder-stubs-docs",
Anton Hansson23f319f2023-03-03 16:04:02 +0000869 srcs: [":hwbinder-stubs-srcs"],
Colin Cross037d7fb2021-03-25 17:01:55 -0700870 libs: ["framework-annotations-lib"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900871 installable: false,
872 sdk_version: "core_platform",
873 annotations_enabled: true,
Anton Hansson48ee95e2020-05-02 17:49:26 +0100874 previous_api: ":android.api.public.latest",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900875 merge_annotations_dirs: [
876 "metalava-manual",
877 ],
Anton Hansson81969c22020-02-03 20:45:56 +0000878 args: priv_apps,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900879}
880
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100881java_library {
Jiyong Park7fb4b182019-12-20 14:35:43 +0900882 name: "hwbinder.stubs",
883 sdk_version: "core_current",
Colin Cross037d7fb2021-03-25 17:01:55 -0700884 libs: ["framework-annotations-lib"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900885 srcs: [
886 ":hwbinder-stubs-docs",
887 ],
Anton Hansson86925682021-04-14 14:54:43 +0100888 visibility: ["//visibility:public"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900889}