blob: e481fe9971fc2bd5a2afaa8708f7ffed2b048782 [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",
Anton Hansson9dce8322022-01-24 14:14:33 +000032 defaults: [
33 "android-non-updatable-stubs-defaults",
34 "module-classpath-stubs-defaults",
35 ],
Anton Hansson76d3db42020-04-09 14:16:37 +010036 args: metalava_framework_docs_args,
37 check_api: {
38 current: {
Anton Hanssonb7cda922023-03-03 15:38:28 +000039 api_file: ":non-updatable-current.txt",
40 removed_api_file: ":non-updatable-removed.txt",
Anton Hansson76d3db42020-04-09 14:16:37 +010041 },
Anton Hansson37e102e2020-10-05 16:42:40 +010042 last_released: {
43 api_file: ":android-non-updatable.api.public.latest",
44 removed_api_file: ":android-non-updatable-removed.api.public.latest",
Anton Hansson7f3393d2021-04-12 11:56:53 +010045 baseline_file: ":android-non-updatable-incompatibilities.api.public.latest",
Anton Hansson37e102e2020-10-05 16:42:40 +010046 },
Anton Hansson76d3db42020-04-09 14:16:37 +010047 api_lint: {
48 enabled: true,
Anton Hansson4f90aa52021-06-04 22:23:59 +010049 new_since: ":android.api.public.latest",
Anton Hansson76d3db42020-04-09 14:16:37 +010050 },
51 },
Anton Hansson85785fe2021-01-20 20:23:34 +000052 dists: [
53 {
Anton Hanssondd8ef672022-01-04 08:53:19 +000054 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +000055 dir: "apistubs/android/public/api",
56 dest: "android-non-updatable.txt",
57 tag: ".api.txt",
58 },
59 {
Anton Hanssondd8ef672022-01-04 08:53:19 +000060 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +000061 dir: "apistubs/android/public/api",
62 dest: "android-non-updatable-removed.txt",
63 tag: ".removed-api.txt",
64 },
65 ],
Anton Hansson76d3db42020-04-09 14:16:37 +010066}
67
Anton Hansson240ee482021-04-14 12:52:00 +010068priv_apps = " --show-annotation android.annotation.SystemApi\\(" +
69 "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
Anton Hansson2feb3f12020-11-13 11:44:32 +000070 "\\)"
71
Anton Hansson240ee482021-04-14 12:52:00 +010072priv_apps_in_stubs = " --show-for-stub-purposes-annotation android.annotation.SystemApi\\(" +
73 "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
Anton Hansson2feb3f12020-11-13 11:44:32 +000074 "\\)"
75
76test = " --show-annotation android.annotation.TestApi"
77
Anton Hansson240ee482021-04-14 12:52:00 +010078module_libs = " --show-annotation android.annotation.SystemApi\\(" +
79 "client=android.annotation.SystemApi.Client.MODULE_LIBRARIES" +
Anton Hansson2feb3f12020-11-13 11:44:32 +000080 "\\)"
Anton Hansson81969c22020-02-03 20:45:56 +000081
Jiyong Park7fb4b182019-12-20 14:35:43 +090082droidstubs {
Anton Hansson76d3db42020-04-09 14:16:37 +010083 name: "system-api-stubs-docs-non-updatable",
Anton Hansson9dce8322022-01-24 14:14:33 +000084 defaults: [
85 "android-non-updatable-stubs-defaults",
86 "module-classpath-stubs-defaults",
87 ],
Anton Hansson76d3db42020-04-09 14:16:37 +010088 args: metalava_framework_docs_args + priv_apps,
89 check_api: {
90 current: {
Anton Hanssonb7cda922023-03-03 15:38:28 +000091 api_file: ":non-updatable-system-current.txt",
92 removed_api_file: ":non-updatable-system-removed.txt",
Anton Hansson76d3db42020-04-09 14:16:37 +010093 },
Anton Hansson37e102e2020-10-05 16:42:40 +010094 last_released: {
95 api_file: ":android-non-updatable.api.system.latest",
96 removed_api_file: ":android-non-updatable-removed.api.system.latest",
Anton Hansson240ee482021-04-14 12:52:00 +010097 baseline_file: ":android-non-updatable-incompatibilities.api.system.latest",
Anton Hansson37e102e2020-10-05 16:42:40 +010098 },
Anton Hansson76d3db42020-04-09 14:16:37 +010099 api_lint: {
100 enabled: true,
Anton Hansson4f90aa52021-06-04 22:23:59 +0100101 new_since: ":android.api.system.latest",
Anton Hanssonb7cda922023-03-03 15:38:28 +0000102 baseline_file: ":non-updatable-system-lint-baseline.txt",
Anton Hansson76d3db42020-04-09 14:16:37 +0100103 },
104 },
Anton Hansson85785fe2021-01-20 20:23:34 +0000105 dists: [
106 {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000107 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +0000108 dir: "apistubs/android/system/api",
109 dest: "android-non-updatable.txt",
110 tag: ".api.txt",
111 },
112 {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000113 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +0000114 dir: "apistubs/android/system/api",
115 dest: "android-non-updatable-removed.txt",
116 tag: ".removed-api.txt",
117 },
118 ],
Anton Hansson76d3db42020-04-09 14:16:37 +0100119}
120
121droidstubs {
Anton Hansson022aac52020-11-05 10:45:13 +0000122 name: "test-api-stubs-docs-non-updatable",
Anton Hansson9dce8322022-01-24 14:14:33 +0000123 defaults: [
124 "android-non-updatable-stubs-defaults",
125 "module-classpath-stubs-defaults",
126 ],
Anton Hansson2feb3f12020-11-13 11:44:32 +0000127 args: metalava_framework_docs_args + test + priv_apps_in_stubs,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900128 check_api: {
129 current: {
Anton Hanssonb7cda922023-03-03 15:38:28 +0000130 api_file: ":non-updatable-test-current.txt",
131 removed_api_file: ":non-updatable-test-removed.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900132 },
133 api_lint: {
134 enabled: true,
Anton Hanssonb7cda922023-03-03 15:38:28 +0000135 baseline_file: ":non-updatable-test-lint-baseline.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900136 },
137 },
Anton Hansson85785fe2021-01-20 20:23:34 +0000138 dists: [
139 {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000140 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +0000141 dir: "apistubs/android/test/api",
142 dest: "android.txt",
143 tag: ".api.txt",
144 },
145 {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000146 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +0000147 dir: "apistubs/android/test/api",
148 dest: "removed.txt",
149 tag: ".removed-api.txt",
150 },
151 {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000152 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +0000153 dir: "apistubs/android/test/api",
154 dest: "android-non-updatable.txt",
155 tag: ".api.txt",
156 },
157 {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000158 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +0000159 dir: "apistubs/android/test/api",
160 dest: "android-non-updatable-removed.txt",
161 tag: ".removed-api.txt",
162 },
163 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900164}
165
Jiyong Parke3095162019-12-20 15:30:28 +0900166droidstubs {
Anton Hansson76d3db42020-04-09 14:16:37 +0100167 name: "module-lib-api-stubs-docs-non-updatable",
Anton Hansson9dce8322022-01-24 14:14:33 +0000168 defaults: [
169 "android-non-updatable-stubs-defaults",
170 "module-classpath-stubs-defaults",
171 ],
Anton Hansson2feb3f12020-11-13 11:44:32 +0000172 args: metalava_framework_docs_args + priv_apps_in_stubs + module_libs,
Anton Hansson76d3db42020-04-09 14:16:37 +0100173 check_api: {
174 current: {
Anton Hanssonb7cda922023-03-03 15:38:28 +0000175 api_file: ":non-updatable-module-lib-current.txt",
176 removed_api_file: ":non-updatable-module-lib-removed.txt",
Anton Hansson76d3db42020-04-09 14:16:37 +0100177 },
Anton Hanssonc3ef1f562020-10-07 14:55:36 +0100178 last_released: {
179 api_file: ":android-non-updatable.api.module-lib.latest",
180 removed_api_file: ":android-non-updatable-removed.api.module-lib.latest",
Junyu Lai2dbb1772022-01-12 17:38:02 +0000181 baseline_file: ":android-non-updatable-incompatibilities.api.module-lib.latest",
Anton Hanssonc3ef1f562020-10-07 14:55:36 +0100182 },
Anton Hansson76d3db42020-04-09 14:16:37 +0100183 api_lint: {
184 enabled: true,
Anton Hansson4f90aa52021-06-04 22:23:59 +0100185 new_since: ":android.api.module-lib.latest",
Anton Hanssonb7cda922023-03-03 15:38:28 +0000186 baseline_file: ":non-updatable-module-lib-lint-baseline.txt",
Anton Hansson76d3db42020-04-09 14:16:37 +0100187 },
188 },
Anton Hansson85785fe2021-01-20 20:23:34 +0000189 dists: [
190 {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000191 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +0000192 dir: "apistubs/android/module-lib/api",
193 dest: "android-non-updatable.txt",
194 tag: ".api.txt",
195 },
196 {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000197 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +0000198 dir: "apistubs/android/module-lib/api",
199 dest: "android-non-updatable-removed.txt",
200 tag: ".removed-api.txt",
201 },
202 ],
Anton Hansson76d3db42020-04-09 14:16:37 +0100203}
Anton Hansson81969c22020-02-03 20:45:56 +0000204
Jiyong Parke3095162019-12-20 15:30:28 +0900205/////////////////////////////////////////////////////////////////////
Jiyong Park7fb4b182019-12-20 14:35:43 +0900206// android_*_stubs_current modules are the stubs libraries compiled
Anton Hansson2feb3f12020-11-13 11:44:32 +0000207// from stub sources
Jiyong Park7fb4b182019-12-20 14:35:43 +0900208/////////////////////////////////////////////////////////////////////
209
210java_defaults {
Anton Hanssonc43a66b2022-03-03 15:14:04 +0000211 name: "android.jar_defaults",
212 sdk_version: "none",
213 system_modules: "none",
214 java_version: "1.8",
215 compile_dex: true,
Anton Hanssonc43a66b2022-03-03 15:14:04 +0000216 visibility: ["//visibility:public"],
217}
218
219java_defaults {
Jihoon Kang491c7082023-06-15 18:37:01 +0000220 name: "android-non-updatable_defaults",
Anton Hanssonfbd32f32020-04-09 14:16:37 +0100221 sdk_version: "none",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900222 system_modules: "none",
223 java_version: "1.8",
224 compile_dex: true,
Jihoon Kang491c7082023-06-15 18:37:01 +0000225}
226
227java_defaults {
228 name: "android-non-updatable_from_source_defaults",
229 libs: ["stub-annotations"],
230 static_libs: ["framework-res-package-jar"], // Export package of framework-res
Anton Hanssona4108912021-04-09 13:40:11 +0100231 dist: {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000232 targets: ["sdk"],
Anton Hanssona4108912021-04-09 13:40:11 +0100233 tag: ".jar",
234 dest: "android-non-updatable.jar",
Anton Hansson240ee482021-04-14 12:52:00 +0100235 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900236}
237
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100238java_library {
Anton Hanssona4748cd2021-04-09 10:16:19 +0100239 name: "android-non-updatable.stubs",
Jihoon Kang491c7082023-06-15 18:37:01 +0000240 defaults: ["android-non-updatable_defaults"],
241 static_libs: [
242 "android-non-updatable.stubs.from-source",
243 ],
244 product_variables: {
245 build_from_text_stub: {
246 static_libs: [
247 "android-non-updatable.stubs.from-text",
248 ],
249 exclude_static_libs: [
250 "android-non-updatable.stubs.from-source",
251 ],
252 },
253 },
254}
255
256java_library {
257 name: "android-non-updatable.stubs.system",
258 defaults: ["android-non-updatable_defaults"],
259 static_libs: [
260 "android-non-updatable.stubs.system.from-source",
261 ],
262 product_variables: {
263 build_from_text_stub: {
264 static_libs: [
265 "android-non-updatable.stubs.system.from-text",
266 ],
267 exclude_static_libs: [
268 "android-non-updatable.stubs.system.from-source",
269 ],
270 },
271 },
272}
273
274java_library {
275 name: "android-non-updatable.stubs.module_lib",
276 defaults: ["android-non-updatable_defaults"],
277 static_libs: [
278 "android-non-updatable.stubs.module_lib.from-source",
279 ],
280 product_variables: {
281 build_from_text_stub: {
282 static_libs: [
283 "android-non-updatable.stubs.module_lib.from-text",
284 ],
285 exclude_static_libs: [
286 "android-non-updatable.stubs.module_lib.from-source",
287 ],
288 },
289 },
290}
291
292java_library {
293 name: "android-non-updatable.stubs.test",
294 defaults: ["android-non-updatable_defaults"],
295 static_libs: [
296 "android-non-updatable.stubs.test.from-source",
297 ],
298 product_variables: {
299 build_from_text_stub: {
300 static_libs: [
301 "android-non-updatable.stubs.test.from-text",
302 ],
303 exclude_static_libs: [
304 "android-non-updatable.stubs.test.from-source",
305 ],
306 },
307 },
308}
309
310java_library {
311 name: "android-non-updatable.stubs.from-source",
312 defaults: [
313 "android-non-updatable_defaults",
314 "android-non-updatable_from_source_defaults",
315 ],
Anton Hanssona4748cd2021-04-09 10:16:19 +0100316 srcs: [":api-stubs-docs-non-updatable"],
Anton Hanssonc6e9d2f2022-01-25 15:53:43 +0000317 libs: ["all-modules-public-stubs"],
Anton Hanssona4108912021-04-09 13:40:11 +0100318 dist: {
319 dir: "apistubs/android/public",
320 },
Anton Hanssona4748cd2021-04-09 10:16:19 +0100321}
322
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100323java_library {
Jihoon Kang491c7082023-06-15 18:37:01 +0000324 name: "android-non-updatable.stubs.system.from-source",
325 defaults: [
326 "android-non-updatable_defaults",
327 "android-non-updatable_from_source_defaults",
328 ],
Anton Hansson240ee482021-04-14 12:52:00 +0100329 srcs: [":system-api-stubs-docs-non-updatable"],
Anton Hanssonc6e9d2f2022-01-25 15:53:43 +0000330 libs: ["all-modules-system-stubs"],
Anton Hanssona4108912021-04-09 13:40:11 +0100331 dist: {
332 dir: "apistubs/android/system",
333 },
Anton Hanssona4748cd2021-04-09 10:16:19 +0100334}
335
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100336java_library {
Jihoon Kang491c7082023-06-15 18:37:01 +0000337 name: "android-non-updatable.stubs.module_lib.from-source",
338 defaults: [
339 "android-non-updatable_defaults",
340 "android-non-updatable_from_source_defaults",
341 ],
Anton Hanssona4748cd2021-04-09 10:16:19 +0100342 srcs: [":module-lib-api-stubs-docs-non-updatable"],
343 libs: [
markchiencd813a32021-11-11 00:42:55 +0800344 "sdk_module-lib_current_framework-tethering",
paulhu2a8c2c32022-02-08 21:23:06 +0800345 "sdk_module-lib_current_framework-connectivity-t",
Roopa Sattiraju86058b62022-01-20 10:05:19 -0800346 "sdk_public_current_framework-bluetooth",
347 // NOTE: The below can be removed once the prebuilt stub contains bluetooth.
Anton Hanssona4748cd2021-04-09 10:16:19 +0100348 "sdk_system_current_android",
349 // NOTE: The below can be removed once the prebuilt stub contains IKE.
350 "sdk_system_current_android.net.ipsec.ike",
351 ],
Anton Hanssona4108912021-04-09 13:40:11 +0100352 dist: {
353 dir: "apistubs/android/module-lib",
354 },
Anton Hanssona4748cd2021-04-09 10:16:19 +0100355}
356
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100357java_library {
Jihoon Kang491c7082023-06-15 18:37:01 +0000358 name: "android-non-updatable.stubs.test.from-source",
359 defaults: [
360 "android-non-updatable_defaults",
361 "android-non-updatable_from_source_defaults",
362 ],
Anton Hanssona4748cd2021-04-09 10:16:19 +0100363 srcs: [":test-api-stubs-docs-non-updatable"],
Anton Hanssonc6e9d2f2022-01-25 15:53:43 +0000364 libs: ["all-modules-system-stubs"],
Anton Hanssona4108912021-04-09 13:40:11 +0100365 dist: {
366 dir: "apistubs/android/test",
367 },
Anton Hanssona4748cd2021-04-09 10:16:19 +0100368}
369
370java_defaults {
Jihoon Kang491c7082023-06-15 18:37:01 +0000371 name: "android-non-updatable_from_text_defaults",
Jihoon Kang0c101db2023-03-14 07:03:46 +0000372 static_libs: ["framework-res-package-jar"],
373 libs: ["stub-annotations"],
374}
375
376java_api_library {
377 name: "android-non-updatable.stubs.from-text",
378 api_surface: "public",
379 api_files: [
380 ":non-updatable-current.txt",
381 ],
Jihoon Kang491c7082023-06-15 18:37:01 +0000382 defaults: ["android-non-updatable_from_text_defaults"],
Jihoon Kang12cddb32023-06-29 21:35:24 +0000383 full_api_surface_stub: "android_stubs_current.from-text",
Jihoon Kang0c101db2023-03-14 07:03:46 +0000384}
385
386java_api_library {
387 name: "android-non-updatable.stubs.system.from-text",
388 api_surface: "system",
389 api_files: [
390 ":non-updatable-current.txt",
391 ":non-updatable-system-current.txt",
392 ],
Jihoon Kang491c7082023-06-15 18:37:01 +0000393 defaults: ["android-non-updatable_from_text_defaults"],
Jihoon Kang12cddb32023-06-29 21:35:24 +0000394 full_api_surface_stub: "android_system_stubs_current.from-text",
Jihoon Kang0c101db2023-03-14 07:03:46 +0000395}
396
397java_api_library {
398 name: "android-non-updatable.stubs.test.from-text",
399 api_surface: "test",
400 api_files: [
401 ":non-updatable-current.txt",
402 ":non-updatable-system-current.txt",
403 ":non-updatable-test-current.txt",
404 ],
Jihoon Kang491c7082023-06-15 18:37:01 +0000405 defaults: ["android-non-updatable_from_text_defaults"],
Jihoon Kang12cddb32023-06-29 21:35:24 +0000406 full_api_surface_stub: "android_test_stubs_current.from-text",
Jihoon Kang0c101db2023-03-14 07:03:46 +0000407}
408
409java_api_library {
410 name: "android-non-updatable.stubs.module_lib.from-text",
411 api_surface: "module_lib",
412 api_files: [
413 ":non-updatable-current.txt",
414 ":non-updatable-system-current.txt",
415 ":non-updatable-module-lib-current.txt",
416 ],
Jihoon Kang491c7082023-06-15 18:37:01 +0000417 defaults: ["android-non-updatable_from_text_defaults"],
Jihoon Kang12cddb32023-06-29 21:35:24 +0000418 full_api_surface_stub: "android_module_lib_stubs_current_full.from-text",
Jihoon Kang0c101db2023-03-14 07:03:46 +0000419}
420
421java_defaults {
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000422 name: "android_stubs_dists_default",
423 dist: {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000424 targets: ["sdk"],
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000425 tag: ".jar",
426 dest: "android.jar",
427 },
Anton Hansson86925682021-04-14 14:54:43 +0100428 defaults_visibility: ["//frameworks/base/services"],
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000429}
430
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100431java_library {
Jihoon Kang1453baa2023-05-27 05:32:30 +0000432 name: "android_stubs_current.from-source",
Anton Hanssonc6e9d2f2022-01-25 15:53:43 +0000433 static_libs: [
434 "all-modules-public-stubs",
Anton Hanssona4748cd2021-04-09 10:16:19 +0100435 "android-non-updatable.stubs",
Anton Hanssonbf63f942020-05-20 12:06:23 +0100436 "private-stub-annotations-jar",
Anton Hansson76d3db42020-04-09 14:16:37 +0100437 ],
Anton Hansson65057af2021-04-14 18:52:08 +0100438 defaults: ["android.jar_defaults"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900439}
440
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100441java_library {
Jihoon Kang1453baa2023-05-27 05:32:30 +0000442 name: "android_system_stubs_current.from-source",
Anton Hanssonc6e9d2f2022-01-25 15:53:43 +0000443 static_libs: [
444 "all-modules-system-stubs",
Anton Hanssona4748cd2021-04-09 10:16:19 +0100445 "android-non-updatable.stubs.system",
Anton Hanssonbf63f942020-05-20 12:06:23 +0100446 "private-stub-annotations-jar",
Anton Hansson76d3db42020-04-09 14:16:37 +0100447 ],
Anton Hanssonc3002e52020-11-18 18:23:55 +0000448 defaults: [
Anton Hansson65057af2021-04-14 18:52:08 +0100449 "android.jar_defaults",
Anton Hanssonc3002e52020-11-18 18:23:55 +0000450 "android_stubs_dists_default",
451 ],
452 dist: {
453 dir: "apistubs/android/system",
454 },
455 dists: [
456 {
457 // Legacy dist path
Anton Hanssondd8ef672022-01-04 08:53:19 +0000458 targets: ["sdk"],
Anton Hanssonc3002e52020-11-18 18:23:55 +0000459 tag: ".jar",
460 dest: "android_system.jar",
461 },
462 ],
Anton Hansson76d3db42020-04-09 14:16:37 +0100463}
464
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100465java_library {
Jihoon Kang1453baa2023-05-27 05:32:30 +0000466 name: "android_test_stubs_current.from-source",
Anton Hanssonc6e9d2f2022-01-25 15:53:43 +0000467 static_libs: [
Nikita Ioffe5593fbb2022-12-01 14:52:34 +0000468 // Updatable modules do not have test APIs, but we want to include their SystemApis, like we
469 // include the SystemApi of framework-non-updatable-sources.
470 "all-updatable-modules-system-stubs",
471 // Non-updatable modules on the other hand can have test APIs, so include their test-stubs.
472 "all-non-updatable-modules-test-stubs",
Anton Hanssona4748cd2021-04-09 10:16:19 +0100473 "android-non-updatable.stubs.test",
Anton Hansson7ce31c12020-10-15 18:38:49 +0100474 "private-stub-annotations-jar",
475 ],
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000476 defaults: [
Anton Hansson65057af2021-04-14 18:52:08 +0100477 "android.jar_defaults",
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000478 "android_stubs_dists_default",
479 ],
480 dist: {
481 dir: "apistubs/android/test",
482 },
Jiyong Parke3095162019-12-20 15:30:28 +0900483}
484
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100485java_library {
Mark Whiteb03c1fc2023-08-12 01:31:26 +0000486 name: "android_test_frameworks_core_stubs_current.from-source",
487 static_libs: [
488 "all-updatable-modules-system-stubs",
489 "android-non-updatable.stubs.test",
Mark Whiteb03c1fc2023-08-12 01:31:26 +0000490 ],
491 defaults: [
492 "android.jar_defaults",
493 "android_stubs_dists_default",
494 ],
495 dist: {
496 dir: "apistubs/android/test-core",
497 },
498}
499
500java_library {
Jihoon Kang1453baa2023-05-27 05:32:30 +0000501 name: "android_module_lib_stubs_current.from-source",
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000502 defaults: [
Anton Hansson65057af2021-04-14 18:52:08 +0100503 "android.jar_defaults",
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000504 "android_stubs_dists_default",
505 ],
Anton Hanssona4748cd2021-04-09 10:16:19 +0100506 static_libs: [
507 "android-non-updatable.stubs.module_lib",
Victor Chang6b107a92021-06-17 23:49:42 +0100508 "art.module.public.api.stubs.module_lib",
Giulio Fiscella68a04112021-11-30 16:32:44 +0000509 "i18n.module.public.api.stubs",
Anton Hanssonb7d532e2021-02-05 11:40:25 +0000510 ],
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000511 dist: {
512 dir: "apistubs/android/module-lib",
513 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900514}
515
Andrei Oneafaa271a2021-03-17 13:32:51 +0000516java_library {
Jihoon Kang1453baa2023-05-27 05:32:30 +0000517 name: "android_system_server_stubs_current.from-source",
Anton Hansson21fb1082023-03-03 16:22:42 +0000518 defaults: [
519 "android.jar_defaults",
520 "android_stubs_dists_default",
521 ],
Andrei Oneafaa271a2021-03-17 13:32:51 +0000522 srcs: [":services-non-updatable-stubs"],
523 installable: false,
524 static_libs: [
Jihoon Kang1453baa2023-05-27 05:32:30 +0000525 "android_module_lib_stubs_current.from-source",
Andrei Oneafaa271a2021-03-17 13:32:51 +0000526 ],
Andrei Oneafaa271a2021-03-17 13:32:51 +0000527 dist: {
528 dir: "apistubs/android/system-server",
529 },
530}
531
Colin Crosscf87a572022-10-20 14:06:53 -0700532java_library {
533 name: "android_stubs_private_jar",
534 defaults: ["android.jar_defaults"],
535 visibility: [
536 "//visibility:override",
537 "//visibility:private",
538 ],
539 static_libs: [
540 "stable.core.platform.api.stubs",
541 "core-lambda-stubs-for-system-modules",
542 "core-generated-annotation-stubs",
543 "framework",
544 "ext",
545 "framework-res-package-jar",
546 // The order of this matters, it has to be last to provide a
547 // package-private androidx.annotation.RecentlyNonNull without
548 // overriding the public android.annotation.Nullable in framework.jar
549 // with its own package-private android.annotation.Nullable.
550 "private-stub-annotations-jar",
551 ],
552}
553
554java_genrule {
555 name: "android_stubs_private_hjar",
Colin Crosscf87a572022-10-20 14:06:53 -0700556 srcs: [":android_stubs_private_jar{.hjar}"],
557 out: ["android_stubs_private.jar"],
558 cmd: "cp $(in) $(out)",
559}
560
561java_library {
562 name: "android_stubs_private",
563 defaults: ["android_stubs_dists_default"],
Colin Crosscf87a572022-10-20 14:06:53 -0700564 sdk_version: "none",
565 system_modules: "none",
566 static_libs: ["android_stubs_private_hjar"],
567 dist: {
568 dir: "apistubs/android/private",
569 },
570}
571
572java_genrule {
573 name: "android_stubs_private_framework_aidl",
Colin Crosscf87a572022-10-20 14:06:53 -0700574 tools: ["sdkparcelables"],
575 srcs: [":android_stubs_private"],
576 out: ["framework.aidl"],
577 cmd: "rm -f $(genDir)/framework.aidl.merged && " +
578 "for i in $(in); do " +
579 " rm -f $(genDir)/framework.aidl.tmp && " +
580 " $(location sdkparcelables) $$i $(genDir)/framework.aidl.tmp && " +
581 " cat $(genDir)/framework.aidl.tmp >> $(genDir)/framework.aidl.merged; " +
582 "done && " +
583 "sort -u $(genDir)/framework.aidl.merged > $(out)",
584 dist: {
585 targets: ["sdk"],
586 dir: "apistubs/android/private",
587 },
588}
589
Jihoon Kang1f406452023-08-16 19:06:38 +0000590//
591// Java API defaults and libraries for single tree build
592//
593
594java_defaults {
595 name: "stub-annotation-defaults",
596 libs: [
597 "stub-annotations",
598 ],
599 static_libs: [
600 // stub annotations do not contribute to the API surfaces but are statically
601 // linked in the stubs for API surfaces (see frameworks/base/StubLibraries.bp).
602 // This is because annotation processors insist on loading the classes for any
603 // annotations found, thus should exist inside android.jar.
604 "private-stub-annotations-jar",
605 ],
606}
607
608// Listing of API domains contribution and dependencies per API surfaces
609java_defaults {
610 name: "android_test_stubs_current_contributions",
611 api_surface: "test",
612 api_contributions: [
613 "test-api-stubs-docs-non-updatable.api.contribution",
614 "framework-virtualization.stubs.source.test.api.contribution",
Mark White9ee18662023-08-07 11:18:09 +0000615 "framework-location.stubs.source.test.api.contribution",
Jihoon Kang1f406452023-08-16 19:06:38 +0000616 ],
617}
618
619java_defaults {
620 name: "android_test_frameworks_core_stubs_current_contributions",
621 api_surface: "test",
622 api_contributions: [
623 "test-api-stubs-docs-non-updatable.api.contribution",
624 ],
625}
626
627java_defaults {
628 name: "android_module_lib_stubs_current_contributions",
629 api_surface: "module-lib",
630 api_contributions: [
631 "api-stubs-docs-non-updatable.api.contribution",
632 "system-api-stubs-docs-non-updatable.api.contribution",
633 "module-lib-api-stubs-docs-non-updatable.api.contribution",
634 "art.module.public.api.stubs.source.api.contribution",
635 "art.module.public.api.stubs.source.system.api.contribution",
636 "art.module.public.api.stubs.source.module_lib.api.contribution",
637 "i18n.module.public.api.stubs.source.api.contribution",
638 "i18n.module.public.api.stubs.source.system.api.contribution",
639 "i18n.module.public.api.stubs.source.module_lib.api.contribution",
640 ],
641}
642
643// Java API library definitions per API surface
644java_api_library {
645 name: "android_stubs_current.from-text",
646 api_surface: "public",
647 defaults: [
648 // This module is dynamically created at frameworks/base/api/api.go
649 // instead of being written out, in order to minimize edits in the codebase
650 // when there is a change in the list of modules.
651 // that contributes to an api surface.
652 "android_stubs_current_contributions",
653 "stub-annotation-defaults",
654 ],
655 api_contributions: [
656 "api-stubs-docs-non-updatable.api.contribution",
657 ],
658 visibility: ["//visibility:public"],
659}
660
661java_api_library {
662 name: "android_system_stubs_current.from-text",
663 api_surface: "system",
664 defaults: [
665 "android_stubs_current_contributions",
666 "android_system_stubs_current_contributions",
667 "stub-annotation-defaults",
668 ],
669 api_contributions: [
670 "api-stubs-docs-non-updatable.api.contribution",
671 "system-api-stubs-docs-non-updatable.api.contribution",
672 ],
673 visibility: ["//visibility:public"],
674}
675
676java_api_library {
677 name: "android_test_stubs_current.from-text",
678 api_surface: "test",
679 defaults: [
680 "android_stubs_current_contributions",
681 "android_system_stubs_current_contributions",
682 "android_test_stubs_current_contributions",
683 "stub-annotation-defaults",
684 ],
685 api_contributions: [
686 "api-stubs-docs-non-updatable.api.contribution",
687 "system-api-stubs-docs-non-updatable.api.contribution",
688 ],
689 visibility: ["//visibility:public"],
690}
691
692java_api_library {
693 name: "android_test_frameworks_core_stubs_current.from-text",
694 api_surface: "test",
695 defaults: [
696 "android_stubs_current_contributions",
697 "android_system_stubs_current_contributions",
698 "android_test_frameworks_core_stubs_current_contributions",
699 "stub-annotation-defaults",
700 ],
701 api_contributions: [
702 "api-stubs-docs-non-updatable.api.contribution",
703 "system-api-stubs-docs-non-updatable.api.contribution",
704 ],
705}
706
707java_api_library {
708 name: "android_module_lib_stubs_current_full.from-text",
709 api_surface: "module-lib",
710 defaults: [
711 "android_stubs_current_contributions",
712 "android_system_stubs_current_contributions",
713 "android_module_lib_stubs_current_contributions_full",
714 ],
715 libs: [
716 "stub-annotations",
717 ],
718 api_contributions: [
719 "api-stubs-docs-non-updatable.api.contribution",
720 "system-api-stubs-docs-non-updatable.api.contribution",
721 "module-lib-api-stubs-docs-non-updatable.api.contribution",
722 ],
723 visibility: ["//visibility:public"],
724}
725
726java_api_library {
727 name: "android_module_lib_stubs_current.from-text",
728 api_surface: "module-lib",
729 defaults: [
730 "android_module_lib_stubs_current_contributions",
731 ],
732 libs: [
733 "android_module_lib_stubs_current_full.from-text",
734 "stub-annotations",
735 ],
736 visibility: ["//visibility:public"],
737}
738
739java_api_library {
740 name: "android_system_server_stubs_current.from-text",
741 api_surface: "system-server",
742 api_contributions: [
743 "services-non-updatable-stubs.api.contribution",
744 ],
745 libs: [
746 "android_module_lib_stubs_current.from-text",
747 "stub-annotations",
748 ],
749 static_libs: [
750 "android_module_lib_stubs_current.from-text",
751 ],
752 visibility: ["//visibility:public"],
753}
754
Anton Hansson36bc27c2021-09-14 15:45:13 +0100755////////////////////////////////////////////////////////////////////////
756// api-versions.xml generation, for public and system. This API database
757// also contains the android.test.* APIs.
758////////////////////////////////////////////////////////////////////////
759
760java_library {
761 name: "android_stubs_current_with_test_libs",
762 static_libs: [
763 "android_stubs_current",
764 "android.test.base.stubs",
765 "android.test.mock.stubs",
766 "android.test.runner.stubs",
767 ],
768 defaults: ["android.jar_defaults"],
769 visibility: [
770 "//visibility:override",
771 "//visibility:private",
772 ],
773}
774
775java_library {
776 name: "android_system_stubs_current_with_test_libs",
777 static_libs: [
778 "android_system_stubs_current",
779 "android.test.base.stubs.system",
780 "android.test.mock.stubs.system",
781 "android.test.runner.stubs.system",
782 ],
783 defaults: ["android.jar_defaults"],
784 visibility: [
785 "//visibility:override",
786 "//visibility:private",
787 ],
788}
789
Cole Faustdcda3702022-10-04 14:46:35 -0700790java_library {
791 name: "android_module_stubs_current_with_test_libs",
792 static_libs: [
793 "android_module_lib_stubs_current",
794 "android.test.base.stubs",
795 "android.test.mock.stubs",
796 "android.test.runner.stubs",
797 ],
798 defaults: ["android.jar_defaults"],
799 visibility: [
800 "//visibility:override",
801 "//visibility:private",
802 ],
803}
804
805java_library {
806 name: "android_system_server_stubs_current_with_test_libs",
807 static_libs: [
808 "android_system_server_stubs_current",
809 "android.test.base.stubs.system",
810 "android.test.mock.stubs.system",
811 "android.test.runner.stubs.system",
812 ],
813 defaults: ["android.jar_defaults"],
814 visibility: [
815 "//visibility:override",
816 "//visibility:private",
817 ],
818}
819
Anton Hansson36bc27c2021-09-14 15:45:13 +0100820droidstubs {
821 name: "api_versions_public",
822 srcs: [":android_stubs_current_with_test_libs{.jar}"],
823 generate_stubs: false,
824 api_levels_annotations_enabled: true,
825 api_levels_annotations_dirs: [
826 "sdk-dir",
827 "api-versions-jars-dir",
828 ],
Cole Faustdcda3702022-10-04 14:46:35 -0700829 api_levels_sdk_type: "public",
Mårten Kongstad54845332022-09-06 15:50:37 +0200830 extensions_info_file: ":sdk-extensions-info",
Anton Hanssonca6e67a2023-03-03 17:55:09 +0000831 visibility: ["//frameworks/base"],
Anton Hansson36bc27c2021-09-14 15:45:13 +0100832}
833
834droidstubs {
835 name: "api_versions_system",
836 srcs: [":android_system_stubs_current_with_test_libs{.jar}"],
837 generate_stubs: false,
838 api_levels_annotations_enabled: true,
839 api_levels_annotations_dirs: [
840 "sdk-dir",
841 "api-versions-jars-dir",
842 ],
843 api_levels_sdk_type: "system",
Mårten Kongstad54845332022-09-06 15:50:37 +0200844 extensions_info_file: ":sdk-extensions-info",
Anton Hansson36bc27c2021-09-14 15:45:13 +0100845}
846
Cole Faustbf4ce752023-02-08 12:46:06 -0800847// This module can be built with:
848// m out/soong/.intermediates/frameworks/base/api_versions_module_lib/android_common/metalava/api-versions.xml
Cole Faustdcda3702022-10-04 14:46:35 -0700849droidstubs {
850 name: "api_versions_module_lib",
851 srcs: [":android_module_stubs_current_with_test_libs{.jar}"],
852 generate_stubs: false,
853 api_levels_annotations_enabled: true,
Cole Faustbf4ce752023-02-08 12:46:06 -0800854 // this only has the non-updatable portions of the module lib sdk,
855 // which can reference classes from updatable apexes, so remove references to them
856 // from this api_versions file.
857 flags: ["--remove-missing-class-references-in-api-levels"],
Cole Faustdcda3702022-10-04 14:46:35 -0700858 api_levels_annotations_dirs: [
859 "sdk-dir",
860 "api-versions-jars-dir",
861 ],
862 api_levels_sdk_type: "module-lib",
Cole Faust1deced12023-02-15 13:24:18 -0800863 // extensions_info_file is purposefully omitted, because this module should just be
864 // the non-updatable portions of the sdk, and extension sdks are updatable.
Cole Faustdcda3702022-10-04 14:46:35 -0700865}
866
867droidstubs {
868 name: "api_versions_system_server",
869 srcs: [":android_system_server_stubs_current_with_test_libs{.jar}"],
870 generate_stubs: false,
871 api_levels_annotations_enabled: true,
Cole Faustbf4ce752023-02-08 12:46:06 -0800872 // this only has the non-updatable portions of the system server sdk,
873 // which can reference classes from updatable apexes, so remove references to them
874 // from this api_versions file.
875 flags: ["--remove-missing-class-references-in-api-levels"],
Cole Faustdcda3702022-10-04 14:46:35 -0700876 api_levels_annotations_dirs: [
877 "sdk-dir",
878 "api-versions-jars-dir",
879 ],
880 api_levels_sdk_type: "system-server",
Cole Faust1deced12023-02-15 13:24:18 -0800881 // extensions_info_file is purposefully omitted, because this module should just be
882 // the non-updatable portions of the sdk, and extension sdks are updatable.
Cole Faustdcda3702022-10-04 14:46:35 -0700883}
884
Jiyong Park7fb4b182019-12-20 14:35:43 +0900885/////////////////////////////////////////////////////////////////////
886// hwbinder.stubs provides APIs required for building HIDL Java
887// libraries.
888/////////////////////////////////////////////////////////////////////
889
890droidstubs {
891 name: "hwbinder-stubs-docs",
Anton Hansson23f319f2023-03-03 16:04:02 +0000892 srcs: [":hwbinder-stubs-srcs"],
Colin Cross037d7fb2021-03-25 17:01:55 -0700893 libs: ["framework-annotations-lib"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900894 installable: false,
895 sdk_version: "core_platform",
896 annotations_enabled: true,
Anton Hansson48ee95e2020-05-02 17:49:26 +0100897 previous_api: ":android.api.public.latest",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900898 merge_annotations_dirs: [
899 "metalava-manual",
900 ],
Anton Hansson81969c22020-02-03 20:45:56 +0000901 args: priv_apps,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900902}
903
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100904java_library {
Jiyong Park7fb4b182019-12-20 14:35:43 +0900905 name: "hwbinder.stubs",
906 sdk_version: "core_current",
Colin Cross037d7fb2021-03-25 17:01:55 -0700907 libs: ["framework-annotations-lib"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900908 srcs: [
909 ":hwbinder-stubs-docs",
910 ],
Anton Hansson86925682021-04-14 14:54:43 +0100911 visibility: ["//visibility:public"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900912}