blob: ba11deddac85b51c9720e46b56fe44e152242581 [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",
Jihoon Kang25b6ced2023-09-20 21:48:09 +0000379 api_contributions: [
380 "api-stubs-docs-non-updatable.api.contribution",
Jihoon Kang0c101db2023-03-14 07:03:46 +0000381 ],
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",
Jihoon Kang25b6ced2023-09-20 21:48:09 +0000389 api_contributions: [
390 "api-stubs-docs-non-updatable.api.contribution",
391 "system-api-stubs-docs-non-updatable.api.contribution",
Jihoon Kang0c101db2023-03-14 07:03:46 +0000392 ],
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",
Jihoon Kang25b6ced2023-09-20 21:48:09 +0000400 api_contributions: [
401 "api-stubs-docs-non-updatable.api.contribution",
402 "system-api-stubs-docs-non-updatable.api.contribution",
403 "test-api-stubs-docs-non-updatable.api.contribution",
Jihoon Kang0c101db2023-03-14 07:03:46 +0000404 ],
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",
Jihoon Kang25b6ced2023-09-20 21:48:09 +0000412 api_contributions: [
413 "api-stubs-docs-non-updatable.api.contribution",
414 "system-api-stubs-docs-non-updatable.api.contribution",
415 "module-lib-api-stubs-docs-non-updatable.api.contribution",
Jihoon Kang0c101db2023-03-14 07:03:46 +0000416 ],
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 Kang21f8b0e2023-08-17 18:14:35 +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: [
Jihoon Kang21f8b0e2023-08-17 18:14:35 +0000598 "framework-virtualization.stubs.source.test.api.contribution",
599 ],
600}
601
602java_defaults {
603 name: "android_module_lib_stubs_current_contributions",
604 api_surface: "module-lib",
605 api_contributions: [
606 "api-stubs-docs-non-updatable.api.contribution",
607 "system-api-stubs-docs-non-updatable.api.contribution",
608 "module-lib-api-stubs-docs-non-updatable.api.contribution",
609 "art.module.public.api.stubs.source.api.contribution",
610 "art.module.public.api.stubs.source.system.api.contribution",
611 "art.module.public.api.stubs.source.module_lib.api.contribution",
612 "i18n.module.public.api.stubs.source.api.contribution",
613 "i18n.module.public.api.stubs.source.system.api.contribution",
614 "i18n.module.public.api.stubs.source.module_lib.api.contribution",
615 ],
616}
617
618// Java API library definitions per API surface
619java_api_library {
620 name: "android_stubs_current.from-text",
621 api_surface: "public",
622 defaults: [
623 // This module is dynamically created at frameworks/base/api/api.go
624 // instead of being written out, in order to minimize edits in the codebase
625 // when there is a change in the list of modules.
626 // that contributes to an api surface.
627 "android_stubs_current_contributions",
628 "stub-annotation-defaults",
629 ],
630 api_contributions: [
631 "api-stubs-docs-non-updatable.api.contribution",
632 ],
633 visibility: ["//visibility:public"],
634}
635
636java_api_library {
637 name: "android_system_stubs_current.from-text",
638 api_surface: "system",
639 defaults: [
640 "android_stubs_current_contributions",
641 "android_system_stubs_current_contributions",
642 "stub-annotation-defaults",
643 ],
644 api_contributions: [
645 "api-stubs-docs-non-updatable.api.contribution",
646 "system-api-stubs-docs-non-updatable.api.contribution",
647 ],
648 visibility: ["//visibility:public"],
649}
650
651java_api_library {
652 name: "android_test_stubs_current.from-text",
653 api_surface: "test",
654 defaults: [
655 "android_stubs_current_contributions",
656 "android_system_stubs_current_contributions",
657 "android_test_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",
Jihoon Kang1c5022b2023-09-20 22:02:29 +0000663 "test-api-stubs-docs-non-updatable.api.contribution",
Jihoon Kang21f8b0e2023-08-17 18:14:35 +0000664 ],
665 visibility: ["//visibility:public"],
666}
667
668java_api_library {
669 name: "android_module_lib_stubs_current_full.from-text",
670 api_surface: "module-lib",
671 defaults: [
672 "android_stubs_current_contributions",
673 "android_system_stubs_current_contributions",
674 "android_module_lib_stubs_current_contributions_full",
675 ],
676 libs: [
677 "stub-annotations",
678 ],
679 api_contributions: [
680 "api-stubs-docs-non-updatable.api.contribution",
681 "system-api-stubs-docs-non-updatable.api.contribution",
682 "module-lib-api-stubs-docs-non-updatable.api.contribution",
683 ],
684 visibility: ["//visibility:public"],
685}
686
687java_api_library {
688 name: "android_module_lib_stubs_current.from-text",
689 api_surface: "module-lib",
690 defaults: [
691 "android_module_lib_stubs_current_contributions",
692 ],
693 libs: [
694 "android_module_lib_stubs_current_full.from-text",
695 "stub-annotations",
696 ],
697 visibility: ["//visibility:public"],
698}
699
700java_api_library {
701 name: "android_system_server_stubs_current.from-text",
702 api_surface: "system-server",
703 api_contributions: [
704 "services-non-updatable-stubs.api.contribution",
705 ],
706 libs: [
707 "android_module_lib_stubs_current.from-text",
708 "stub-annotations",
709 ],
710 static_libs: [
711 "android_module_lib_stubs_current.from-text",
712 ],
713 visibility: ["//visibility:public"],
714}
715
Anton Hansson36bc27c2021-09-14 15:45:13 +0100716////////////////////////////////////////////////////////////////////////
717// api-versions.xml generation, for public and system. This API database
718// also contains the android.test.* APIs.
719////////////////////////////////////////////////////////////////////////
720
721java_library {
722 name: "android_stubs_current_with_test_libs",
723 static_libs: [
724 "android_stubs_current",
725 "android.test.base.stubs",
726 "android.test.mock.stubs",
727 "android.test.runner.stubs",
728 ],
729 defaults: ["android.jar_defaults"],
730 visibility: [
731 "//visibility:override",
732 "//visibility:private",
733 ],
734}
735
736java_library {
737 name: "android_system_stubs_current_with_test_libs",
738 static_libs: [
739 "android_system_stubs_current",
740 "android.test.base.stubs.system",
741 "android.test.mock.stubs.system",
742 "android.test.runner.stubs.system",
743 ],
744 defaults: ["android.jar_defaults"],
745 visibility: [
746 "//visibility:override",
747 "//visibility:private",
748 ],
749}
750
Cole Faustdcda3702022-10-04 14:46:35 -0700751java_library {
752 name: "android_module_stubs_current_with_test_libs",
753 static_libs: [
754 "android_module_lib_stubs_current",
755 "android.test.base.stubs",
756 "android.test.mock.stubs",
757 "android.test.runner.stubs",
758 ],
759 defaults: ["android.jar_defaults"],
760 visibility: [
761 "//visibility:override",
762 "//visibility:private",
763 ],
764}
765
766java_library {
767 name: "android_system_server_stubs_current_with_test_libs",
768 static_libs: [
769 "android_system_server_stubs_current",
770 "android.test.base.stubs.system",
771 "android.test.mock.stubs.system",
772 "android.test.runner.stubs.system",
773 ],
774 defaults: ["android.jar_defaults"],
775 visibility: [
776 "//visibility:override",
777 "//visibility:private",
778 ],
779}
780
Anton Hansson36bc27c2021-09-14 15:45:13 +0100781droidstubs {
782 name: "api_versions_public",
783 srcs: [":android_stubs_current_with_test_libs{.jar}"],
784 generate_stubs: false,
785 api_levels_annotations_enabled: true,
786 api_levels_annotations_dirs: [
787 "sdk-dir",
788 "api-versions-jars-dir",
789 ],
Cole Faustdcda3702022-10-04 14:46:35 -0700790 api_levels_sdk_type: "public",
Mårten Kongstad54845332022-09-06 15:50:37 +0200791 extensions_info_file: ":sdk-extensions-info",
Anton Hanssonca6e67a2023-03-03 17:55:09 +0000792 visibility: ["//frameworks/base"],
Anton Hansson36bc27c2021-09-14 15:45:13 +0100793}
794
795droidstubs {
796 name: "api_versions_system",
797 srcs: [":android_system_stubs_current_with_test_libs{.jar}"],
798 generate_stubs: false,
799 api_levels_annotations_enabled: true,
800 api_levels_annotations_dirs: [
801 "sdk-dir",
802 "api-versions-jars-dir",
803 ],
804 api_levels_sdk_type: "system",
Mårten Kongstad54845332022-09-06 15:50:37 +0200805 extensions_info_file: ":sdk-extensions-info",
Anton Hansson36bc27c2021-09-14 15:45:13 +0100806}
807
Cole Faustbf4ce752023-02-08 12:46:06 -0800808// This module can be built with:
809// m out/soong/.intermediates/frameworks/base/api_versions_module_lib/android_common/metalava/api-versions.xml
Cole Faustdcda3702022-10-04 14:46:35 -0700810droidstubs {
811 name: "api_versions_module_lib",
812 srcs: [":android_module_stubs_current_with_test_libs{.jar}"],
813 generate_stubs: false,
814 api_levels_annotations_enabled: true,
Cole Faustbf4ce752023-02-08 12:46:06 -0800815 // this only has the non-updatable portions of the module lib sdk,
816 // which can reference classes from updatable apexes, so remove references to them
817 // from this api_versions file.
818 flags: ["--remove-missing-class-references-in-api-levels"],
Cole Faustdcda3702022-10-04 14:46:35 -0700819 api_levels_annotations_dirs: [
820 "sdk-dir",
821 "api-versions-jars-dir",
822 ],
823 api_levels_sdk_type: "module-lib",
Cole Faust1deced12023-02-15 13:24:18 -0800824 // extensions_info_file is purposefully omitted, because this module should just be
825 // the non-updatable portions of the sdk, and extension sdks are updatable.
Cole Faustdcda3702022-10-04 14:46:35 -0700826}
827
828droidstubs {
829 name: "api_versions_system_server",
830 srcs: [":android_system_server_stubs_current_with_test_libs{.jar}"],
831 generate_stubs: false,
832 api_levels_annotations_enabled: true,
Cole Faustbf4ce752023-02-08 12:46:06 -0800833 // this only has the non-updatable portions of the system server sdk,
834 // which can reference classes from updatable apexes, so remove references to them
835 // from this api_versions file.
836 flags: ["--remove-missing-class-references-in-api-levels"],
Cole Faustdcda3702022-10-04 14:46:35 -0700837 api_levels_annotations_dirs: [
838 "sdk-dir",
839 "api-versions-jars-dir",
840 ],
841 api_levels_sdk_type: "system-server",
Cole Faust1deced12023-02-15 13:24:18 -0800842 // extensions_info_file is purposefully omitted, because this module should just be
843 // the non-updatable portions of the sdk, and extension sdks are updatable.
Cole Faustdcda3702022-10-04 14:46:35 -0700844}
845
Jiyong Park7fb4b182019-12-20 14:35:43 +0900846/////////////////////////////////////////////////////////////////////
847// hwbinder.stubs provides APIs required for building HIDL Java
848// libraries.
849/////////////////////////////////////////////////////////////////////
850
851droidstubs {
852 name: "hwbinder-stubs-docs",
Anton Hansson23f319f2023-03-03 16:04:02 +0000853 srcs: [":hwbinder-stubs-srcs"],
Colin Cross037d7fb2021-03-25 17:01:55 -0700854 libs: ["framework-annotations-lib"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900855 installable: false,
856 sdk_version: "core_platform",
857 annotations_enabled: true,
Anton Hansson48ee95e2020-05-02 17:49:26 +0100858 previous_api: ":android.api.public.latest",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900859 merge_annotations_dirs: [
860 "metalava-manual",
861 ],
Anton Hansson81969c22020-02-03 20:45:56 +0000862 args: priv_apps,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900863}
864
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100865java_library {
Jiyong Park7fb4b182019-12-20 14:35:43 +0900866 name: "hwbinder.stubs",
867 sdk_version: "core_current",
Colin Cross037d7fb2021-03-25 17:01:55 -0700868 libs: ["framework-annotations-lib"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900869 srcs: [
870 ":hwbinder-stubs-docs",
871 ],
Anton Hansson86925682021-04-14 14:54:43 +0100872 visibility: ["//visibility:public"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900873}