blob: c1edfd2c292090d6bc5ec05eae1938a1e7f2dfb9 [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 {
Jihoon Kang1453baa2023-05-27 05:32:30 +0000486 name: "android_module_lib_stubs_current.from-source",
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000487 defaults: [
Anton Hansson65057af2021-04-14 18:52:08 +0100488 "android.jar_defaults",
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000489 "android_stubs_dists_default",
490 ],
Anton Hanssona4748cd2021-04-09 10:16:19 +0100491 static_libs: [
492 "android-non-updatable.stubs.module_lib",
Victor Chang6b107a92021-06-17 23:49:42 +0100493 "art.module.public.api.stubs.module_lib",
Giulio Fiscella68a04112021-11-30 16:32:44 +0000494 "i18n.module.public.api.stubs",
Anton Hanssonb7d532e2021-02-05 11:40:25 +0000495 ],
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000496 dist: {
497 dir: "apistubs/android/module-lib",
498 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900499}
500
Andrei Oneafaa271a2021-03-17 13:32:51 +0000501java_library {
Jihoon Kang1453baa2023-05-27 05:32:30 +0000502 name: "android_system_server_stubs_current.from-source",
Anton Hansson21fb1082023-03-03 16:22:42 +0000503 defaults: [
504 "android.jar_defaults",
505 "android_stubs_dists_default",
506 ],
Andrei Oneafaa271a2021-03-17 13:32:51 +0000507 srcs: [":services-non-updatable-stubs"],
508 installable: false,
509 static_libs: [
Jihoon Kang1453baa2023-05-27 05:32:30 +0000510 "android_module_lib_stubs_current.from-source",
Andrei Oneafaa271a2021-03-17 13:32:51 +0000511 ],
Andrei Oneafaa271a2021-03-17 13:32:51 +0000512 dist: {
513 dir: "apistubs/android/system-server",
514 },
515}
516
Colin Crosscf87a572022-10-20 14:06:53 -0700517java_library {
518 name: "android_stubs_private_jar",
519 defaults: ["android.jar_defaults"],
520 visibility: [
521 "//visibility:override",
522 "//visibility:private",
523 ],
524 static_libs: [
525 "stable.core.platform.api.stubs",
526 "core-lambda-stubs-for-system-modules",
527 "core-generated-annotation-stubs",
528 "framework",
529 "ext",
530 "framework-res-package-jar",
531 // The order of this matters, it has to be last to provide a
532 // package-private androidx.annotation.RecentlyNonNull without
533 // overriding the public android.annotation.Nullable in framework.jar
534 // with its own package-private android.annotation.Nullable.
535 "private-stub-annotations-jar",
536 ],
537}
538
539java_genrule {
540 name: "android_stubs_private_hjar",
Colin Crosscf87a572022-10-20 14:06:53 -0700541 srcs: [":android_stubs_private_jar{.hjar}"],
542 out: ["android_stubs_private.jar"],
543 cmd: "cp $(in) $(out)",
544}
545
546java_library {
547 name: "android_stubs_private",
548 defaults: ["android_stubs_dists_default"],
Colin Crosscf87a572022-10-20 14:06:53 -0700549 sdk_version: "none",
550 system_modules: "none",
551 static_libs: ["android_stubs_private_hjar"],
552 dist: {
553 dir: "apistubs/android/private",
554 },
555}
556
557java_genrule {
558 name: "android_stubs_private_framework_aidl",
Colin Crosscf87a572022-10-20 14:06:53 -0700559 tools: ["sdkparcelables"],
560 srcs: [":android_stubs_private"],
561 out: ["framework.aidl"],
562 cmd: "rm -f $(genDir)/framework.aidl.merged && " +
563 "for i in $(in); do " +
564 " rm -f $(genDir)/framework.aidl.tmp && " +
565 " $(location sdkparcelables) $$i $(genDir)/framework.aidl.tmp && " +
566 " cat $(genDir)/framework.aidl.tmp >> $(genDir)/framework.aidl.merged; " +
567 "done && " +
568 "sort -u $(genDir)/framework.aidl.merged > $(out)",
569 dist: {
570 targets: ["sdk"],
571 dir: "apistubs/android/private",
572 },
573}
574
Jihoon Kang7b627ed2023-09-21 01:14:17 +0000575//
576// Java API defaults and libraries for single tree build
577//
578
579java_defaults {
580 name: "stub-annotation-defaults",
581 libs: [
582 "stub-annotations",
583 ],
584 static_libs: [
585 // stub annotations do not contribute to the API surfaces but are statically
586 // linked in the stubs for API surfaces (see frameworks/base/StubLibraries.bp).
587 // This is because annotation processors insist on loading the classes for any
588 // annotations found, thus should exist inside android.jar.
589 "private-stub-annotations-jar",
590 ],
591}
592
593// Listing of API domains contribution and dependencies per API surfaces
594java_defaults {
595 name: "android_test_stubs_current_contributions",
596 api_surface: "test",
597 api_contributions: [
598 "test-api-stubs-docs-non-updatable.api.contribution",
599 "framework-virtualization.stubs.source.test.api.contribution",
600 ],
601}
602
603java_defaults {
604 name: "android_test_frameworks_core_stubs_current_contributions",
605 api_surface: "test",
606 api_contributions: [
607 "test-api-stubs-docs-non-updatable.api.contribution",
608 ],
609}
610
611java_defaults {
612 name: "android_module_lib_stubs_current_contributions",
613 api_surface: "module-lib",
614 api_contributions: [
615 "api-stubs-docs-non-updatable.api.contribution",
616 "system-api-stubs-docs-non-updatable.api.contribution",
617 "module-lib-api-stubs-docs-non-updatable.api.contribution",
618 "art.module.public.api.stubs.source.api.contribution",
619 "art.module.public.api.stubs.source.system.api.contribution",
620 "art.module.public.api.stubs.source.module_lib.api.contribution",
621 "i18n.module.public.api.stubs.source.api.contribution",
622 "i18n.module.public.api.stubs.source.system.api.contribution",
623 "i18n.module.public.api.stubs.source.module_lib.api.contribution",
624 ],
625}
626
627// Java API library definitions per API surface
628java_api_library {
629 name: "android_stubs_current.from-text",
630 api_surface: "public",
631 defaults: [
632 // This module is dynamically created at frameworks/base/api/api.go
633 // instead of being written out, in order to minimize edits in the codebase
634 // when there is a change in the list of modules.
635 // that contributes to an api surface.
636 "android_stubs_current_contributions",
637 "stub-annotation-defaults",
638 ],
639 api_contributions: [
640 "api-stubs-docs-non-updatable.api.contribution",
641 ],
642 visibility: ["//visibility:public"],
643}
644
645java_api_library {
646 name: "android_system_stubs_current.from-text",
647 api_surface: "system",
648 defaults: [
649 "android_stubs_current_contributions",
650 "android_system_stubs_current_contributions",
651 "stub-annotation-defaults",
652 ],
653 api_contributions: [
654 "api-stubs-docs-non-updatable.api.contribution",
655 "system-api-stubs-docs-non-updatable.api.contribution",
656 ],
657 visibility: ["//visibility:public"],
658}
659
660java_api_library {
661 name: "android_test_stubs_current.from-text",
662 api_surface: "test",
663 defaults: [
664 "android_stubs_current_contributions",
665 "android_system_stubs_current_contributions",
666 "android_test_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_frameworks_core_stubs_current.from-text",
678 api_surface: "test",
679 defaults: [
680 "android_stubs_current_contributions",
681 "android_system_stubs_current_contributions",
682 "android_test_frameworks_core_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}
690
691java_api_library {
692 name: "android_module_lib_stubs_current_full.from-text",
693 api_surface: "module-lib",
694 defaults: [
695 "android_stubs_current_contributions",
696 "android_system_stubs_current_contributions",
697 "android_module_lib_stubs_current_contributions_full",
698 ],
699 libs: [
700 "stub-annotations",
701 ],
702 api_contributions: [
703 "api-stubs-docs-non-updatable.api.contribution",
704 "system-api-stubs-docs-non-updatable.api.contribution",
705 "module-lib-api-stubs-docs-non-updatable.api.contribution",
706 ],
707 visibility: ["//visibility:public"],
708}
709
710java_api_library {
711 name: "android_module_lib_stubs_current.from-text",
712 api_surface: "module-lib",
713 defaults: [
714 "android_module_lib_stubs_current_contributions",
715 ],
716 libs: [
717 "android_module_lib_stubs_current_full.from-text",
718 "stub-annotations",
719 ],
720 visibility: ["//visibility:public"],
721}
722
723java_api_library {
724 name: "android_system_server_stubs_current.from-text",
725 api_surface: "system-server",
726 api_contributions: [
727 "services-non-updatable-stubs.api.contribution",
728 ],
729 libs: [
730 "android_module_lib_stubs_current.from-text",
731 "stub-annotations",
732 ],
733 static_libs: [
734 "android_module_lib_stubs_current.from-text",
735 ],
736 visibility: ["//visibility:public"],
737}
738
Anton Hansson36bc27c2021-09-14 15:45:13 +0100739////////////////////////////////////////////////////////////////////////
740// api-versions.xml generation, for public and system. This API database
741// also contains the android.test.* APIs.
742////////////////////////////////////////////////////////////////////////
743
744java_library {
745 name: "android_stubs_current_with_test_libs",
746 static_libs: [
747 "android_stubs_current",
748 "android.test.base.stubs",
749 "android.test.mock.stubs",
750 "android.test.runner.stubs",
751 ],
752 defaults: ["android.jar_defaults"],
753 visibility: [
754 "//visibility:override",
755 "//visibility:private",
756 ],
757}
758
759java_library {
760 name: "android_system_stubs_current_with_test_libs",
761 static_libs: [
762 "android_system_stubs_current",
763 "android.test.base.stubs.system",
764 "android.test.mock.stubs.system",
765 "android.test.runner.stubs.system",
766 ],
767 defaults: ["android.jar_defaults"],
768 visibility: [
769 "//visibility:override",
770 "//visibility:private",
771 ],
772}
773
Cole Faustdcda3702022-10-04 14:46:35 -0700774java_library {
775 name: "android_module_stubs_current_with_test_libs",
776 static_libs: [
777 "android_module_lib_stubs_current",
778 "android.test.base.stubs",
779 "android.test.mock.stubs",
780 "android.test.runner.stubs",
781 ],
782 defaults: ["android.jar_defaults"],
783 visibility: [
784 "//visibility:override",
785 "//visibility:private",
786 ],
787}
788
789java_library {
790 name: "android_system_server_stubs_current_with_test_libs",
791 static_libs: [
792 "android_system_server_stubs_current",
793 "android.test.base.stubs.system",
794 "android.test.mock.stubs.system",
795 "android.test.runner.stubs.system",
796 ],
797 defaults: ["android.jar_defaults"],
798 visibility: [
799 "//visibility:override",
800 "//visibility:private",
801 ],
802}
803
Anton Hansson36bc27c2021-09-14 15:45:13 +0100804droidstubs {
805 name: "api_versions_public",
806 srcs: [":android_stubs_current_with_test_libs{.jar}"],
807 generate_stubs: false,
808 api_levels_annotations_enabled: true,
809 api_levels_annotations_dirs: [
810 "sdk-dir",
811 "api-versions-jars-dir",
812 ],
Cole Faustdcda3702022-10-04 14:46:35 -0700813 api_levels_sdk_type: "public",
Mårten Kongstad54845332022-09-06 15:50:37 +0200814 extensions_info_file: ":sdk-extensions-info",
Anton Hanssonca6e67a2023-03-03 17:55:09 +0000815 visibility: ["//frameworks/base"],
Anton Hansson36bc27c2021-09-14 15:45:13 +0100816}
817
818droidstubs {
819 name: "api_versions_system",
820 srcs: [":android_system_stubs_current_with_test_libs{.jar}"],
821 generate_stubs: false,
822 api_levels_annotations_enabled: true,
823 api_levels_annotations_dirs: [
824 "sdk-dir",
825 "api-versions-jars-dir",
826 ],
827 api_levels_sdk_type: "system",
Mårten Kongstad54845332022-09-06 15:50:37 +0200828 extensions_info_file: ":sdk-extensions-info",
Anton Hansson36bc27c2021-09-14 15:45:13 +0100829}
830
Cole Faustbf4ce752023-02-08 12:46:06 -0800831// This module can be built with:
832// m out/soong/.intermediates/frameworks/base/api_versions_module_lib/android_common/metalava/api-versions.xml
Cole Faustdcda3702022-10-04 14:46:35 -0700833droidstubs {
834 name: "api_versions_module_lib",
835 srcs: [":android_module_stubs_current_with_test_libs{.jar}"],
836 generate_stubs: false,
837 api_levels_annotations_enabled: true,
Cole Faustbf4ce752023-02-08 12:46:06 -0800838 // this only has the non-updatable portions of the module lib sdk,
839 // which can reference classes from updatable apexes, so remove references to them
840 // from this api_versions file.
841 flags: ["--remove-missing-class-references-in-api-levels"],
Cole Faustdcda3702022-10-04 14:46:35 -0700842 api_levels_annotations_dirs: [
843 "sdk-dir",
844 "api-versions-jars-dir",
845 ],
846 api_levels_sdk_type: "module-lib",
Cole Faust1deced12023-02-15 13:24:18 -0800847 // extensions_info_file is purposefully omitted, because this module should just be
848 // the non-updatable portions of the sdk, and extension sdks are updatable.
Cole Faustdcda3702022-10-04 14:46:35 -0700849}
850
851droidstubs {
852 name: "api_versions_system_server",
853 srcs: [":android_system_server_stubs_current_with_test_libs{.jar}"],
854 generate_stubs: false,
855 api_levels_annotations_enabled: true,
Cole Faustbf4ce752023-02-08 12:46:06 -0800856 // this only has the non-updatable portions of the system server sdk,
857 // which can reference classes from updatable apexes, so remove references to them
858 // from this api_versions file.
859 flags: ["--remove-missing-class-references-in-api-levels"],
Cole Faustdcda3702022-10-04 14:46:35 -0700860 api_levels_annotations_dirs: [
861 "sdk-dir",
862 "api-versions-jars-dir",
863 ],
864 api_levels_sdk_type: "system-server",
Cole Faust1deced12023-02-15 13:24:18 -0800865 // extensions_info_file is purposefully omitted, because this module should just be
866 // the non-updatable portions of the sdk, and extension sdks are updatable.
Cole Faustdcda3702022-10-04 14:46:35 -0700867}
868
Jiyong Park7fb4b182019-12-20 14:35:43 +0900869/////////////////////////////////////////////////////////////////////
870// hwbinder.stubs provides APIs required for building HIDL Java
871// libraries.
872/////////////////////////////////////////////////////////////////////
873
874droidstubs {
875 name: "hwbinder-stubs-docs",
Anton Hansson23f319f2023-03-03 16:04:02 +0000876 srcs: [":hwbinder-stubs-srcs"],
Colin Cross037d7fb2021-03-25 17:01:55 -0700877 libs: ["framework-annotations-lib"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900878 installable: false,
879 sdk_version: "core_platform",
880 annotations_enabled: true,
Anton Hansson48ee95e2020-05-02 17:49:26 +0100881 previous_api: ":android.api.public.latest",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900882 merge_annotations_dirs: [
883 "metalava-manual",
884 ],
Anton Hansson81969c22020-02-03 20:45:56 +0000885 args: priv_apps,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900886}
887
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100888java_library {
Jiyong Park7fb4b182019-12-20 14:35:43 +0900889 name: "hwbinder.stubs",
890 sdk_version: "core_current",
Colin Cross037d7fb2021-03-25 17:01:55 -0700891 libs: ["framework-annotations-lib"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900892 srcs: [
893 ":hwbinder-stubs-docs",
894 ],
Anton Hansson86925682021-04-14 14:54:43 +0100895 visibility: ["//visibility:public"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900896}