blob: c59a8331337172f1a190ab71ec0c2db97cb34eee [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",
Adrian Roos38dd1612023-09-06 14:45:35 +000050 baseline_file: ":non-updatable-lint-baseline.txt",
Anton Hansson76d3db42020-04-09 14:16:37 +010051 },
52 },
Anton Hansson85785fe2021-01-20 20:23:34 +000053 dists: [
54 {
Anton Hanssondd8ef672022-01-04 08:53:19 +000055 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +000056 dir: "apistubs/android/public/api",
57 dest: "android-non-updatable.txt",
58 tag: ".api.txt",
59 },
60 {
Anton Hanssondd8ef672022-01-04 08:53:19 +000061 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +000062 dir: "apistubs/android/public/api",
63 dest: "android-non-updatable-removed.txt",
64 tag: ".removed-api.txt",
65 },
66 ],
Anton Hansson76d3db42020-04-09 14:16:37 +010067}
68
Anton Hansson240ee482021-04-14 12:52:00 +010069priv_apps = " --show-annotation android.annotation.SystemApi\\(" +
70 "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
Anton Hansson2feb3f12020-11-13 11:44:32 +000071 "\\)"
72
Anton Hansson240ee482021-04-14 12:52:00 +010073priv_apps_in_stubs = " --show-for-stub-purposes-annotation android.annotation.SystemApi\\(" +
74 "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
Anton Hansson2feb3f12020-11-13 11:44:32 +000075 "\\)"
76
Adrian Roos38dd1612023-09-06 14:45:35 +000077test = " --show-annotation android.annotation.TestApi" +
78 " --hide UnflaggedApi" // TODO(b/297362755): TestApi lint doesn't ignore existing APIs.
Anton Hansson2feb3f12020-11-13 11:44:32 +000079
Anton Hansson240ee482021-04-14 12:52:00 +010080module_libs = " --show-annotation android.annotation.SystemApi\\(" +
81 "client=android.annotation.SystemApi.Client.MODULE_LIBRARIES" +
Anton Hansson2feb3f12020-11-13 11:44:32 +000082 "\\)"
Anton Hansson81969c22020-02-03 20:45:56 +000083
Jiyong Park7fb4b182019-12-20 14:35:43 +090084droidstubs {
Anton Hansson76d3db42020-04-09 14:16:37 +010085 name: "system-api-stubs-docs-non-updatable",
Anton Hansson9dce8322022-01-24 14:14:33 +000086 defaults: [
87 "android-non-updatable-stubs-defaults",
88 "module-classpath-stubs-defaults",
89 ],
Anton Hansson76d3db42020-04-09 14:16:37 +010090 args: metalava_framework_docs_args + priv_apps,
91 check_api: {
92 current: {
Anton Hanssonb7cda922023-03-03 15:38:28 +000093 api_file: ":non-updatable-system-current.txt",
94 removed_api_file: ":non-updatable-system-removed.txt",
Anton Hansson76d3db42020-04-09 14:16:37 +010095 },
Anton Hansson37e102e2020-10-05 16:42:40 +010096 last_released: {
97 api_file: ":android-non-updatable.api.system.latest",
98 removed_api_file: ":android-non-updatable-removed.api.system.latest",
Anton Hansson240ee482021-04-14 12:52:00 +010099 baseline_file: ":android-non-updatable-incompatibilities.api.system.latest",
Anton Hansson37e102e2020-10-05 16:42:40 +0100100 },
Anton Hansson76d3db42020-04-09 14:16:37 +0100101 api_lint: {
102 enabled: true,
Anton Hansson4f90aa52021-06-04 22:23:59 +0100103 new_since: ":android.api.system.latest",
Anton Hanssonb7cda922023-03-03 15:38:28 +0000104 baseline_file: ":non-updatable-system-lint-baseline.txt",
Anton Hansson76d3db42020-04-09 14:16:37 +0100105 },
106 },
Anton Hansson85785fe2021-01-20 20:23:34 +0000107 dists: [
108 {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000109 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +0000110 dir: "apistubs/android/system/api",
111 dest: "android-non-updatable.txt",
112 tag: ".api.txt",
113 },
114 {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000115 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +0000116 dir: "apistubs/android/system/api",
117 dest: "android-non-updatable-removed.txt",
118 tag: ".removed-api.txt",
119 },
120 ],
Anton Hansson76d3db42020-04-09 14:16:37 +0100121}
122
123droidstubs {
Anton Hansson022aac52020-11-05 10:45:13 +0000124 name: "test-api-stubs-docs-non-updatable",
Anton Hansson9dce8322022-01-24 14:14:33 +0000125 defaults: [
126 "android-non-updatable-stubs-defaults",
127 "module-classpath-stubs-defaults",
128 ],
Anton Hansson2feb3f12020-11-13 11:44:32 +0000129 args: metalava_framework_docs_args + test + priv_apps_in_stubs,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900130 check_api: {
131 current: {
Anton Hanssonb7cda922023-03-03 15:38:28 +0000132 api_file: ":non-updatable-test-current.txt",
133 removed_api_file: ":non-updatable-test-removed.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900134 },
135 api_lint: {
136 enabled: true,
Anton Hanssonb7cda922023-03-03 15:38:28 +0000137 baseline_file: ":non-updatable-test-lint-baseline.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900138 },
139 },
Anton Hansson85785fe2021-01-20 20:23:34 +0000140 dists: [
141 {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000142 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +0000143 dir: "apistubs/android/test/api",
144 dest: "android.txt",
145 tag: ".api.txt",
146 },
147 {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000148 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +0000149 dir: "apistubs/android/test/api",
150 dest: "removed.txt",
151 tag: ".removed-api.txt",
152 },
153 {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000154 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +0000155 dir: "apistubs/android/test/api",
156 dest: "android-non-updatable.txt",
157 tag: ".api.txt",
158 },
159 {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000160 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +0000161 dir: "apistubs/android/test/api",
162 dest: "android-non-updatable-removed.txt",
163 tag: ".removed-api.txt",
164 },
165 ],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900166}
167
Jiyong Parke3095162019-12-20 15:30:28 +0900168droidstubs {
Anton Hansson76d3db42020-04-09 14:16:37 +0100169 name: "module-lib-api-stubs-docs-non-updatable",
Anton Hansson9dce8322022-01-24 14:14:33 +0000170 defaults: [
171 "android-non-updatable-stubs-defaults",
172 "module-classpath-stubs-defaults",
173 ],
Anton Hansson2feb3f12020-11-13 11:44:32 +0000174 args: metalava_framework_docs_args + priv_apps_in_stubs + module_libs,
Anton Hansson76d3db42020-04-09 14:16:37 +0100175 check_api: {
176 current: {
Anton Hanssonb7cda922023-03-03 15:38:28 +0000177 api_file: ":non-updatable-module-lib-current.txt",
178 removed_api_file: ":non-updatable-module-lib-removed.txt",
Anton Hansson76d3db42020-04-09 14:16:37 +0100179 },
Anton Hanssonc3ef1f562020-10-07 14:55:36 +0100180 last_released: {
181 api_file: ":android-non-updatable.api.module-lib.latest",
182 removed_api_file: ":android-non-updatable-removed.api.module-lib.latest",
Junyu Lai2dbb1772022-01-12 17:38:02 +0000183 baseline_file: ":android-non-updatable-incompatibilities.api.module-lib.latest",
Anton Hanssonc3ef1f562020-10-07 14:55:36 +0100184 },
Anton Hansson76d3db42020-04-09 14:16:37 +0100185 api_lint: {
186 enabled: true,
Anton Hansson4f90aa52021-06-04 22:23:59 +0100187 new_since: ":android.api.module-lib.latest",
Anton Hanssonb7cda922023-03-03 15:38:28 +0000188 baseline_file: ":non-updatable-module-lib-lint-baseline.txt",
Anton Hansson76d3db42020-04-09 14:16:37 +0100189 },
190 },
Anton Hansson85785fe2021-01-20 20:23:34 +0000191 dists: [
192 {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000193 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +0000194 dir: "apistubs/android/module-lib/api",
195 dest: "android-non-updatable.txt",
196 tag: ".api.txt",
197 },
198 {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000199 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +0000200 dir: "apistubs/android/module-lib/api",
201 dest: "android-non-updatable-removed.txt",
202 tag: ".removed-api.txt",
203 },
204 ],
Anton Hansson76d3db42020-04-09 14:16:37 +0100205}
Anton Hansson81969c22020-02-03 20:45:56 +0000206
Jiyong Parke3095162019-12-20 15:30:28 +0900207/////////////////////////////////////////////////////////////////////
Jiyong Park7fb4b182019-12-20 14:35:43 +0900208// android_*_stubs_current modules are the stubs libraries compiled
Anton Hansson2feb3f12020-11-13 11:44:32 +0000209// from stub sources
Jiyong Park7fb4b182019-12-20 14:35:43 +0900210/////////////////////////////////////////////////////////////////////
211
212java_defaults {
Anton Hanssonc43a66b2022-03-03 15:14:04 +0000213 name: "android.jar_defaults",
214 sdk_version: "none",
215 system_modules: "none",
216 java_version: "1.8",
217 compile_dex: true,
Anton Hanssonc43a66b2022-03-03 15:14:04 +0000218 visibility: ["//visibility:public"],
219}
220
221java_defaults {
Jihoon Kang491c7082023-06-15 18:37:01 +0000222 name: "android-non-updatable_defaults",
Anton Hanssonfbd32f32020-04-09 14:16:37 +0100223 sdk_version: "none",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900224 system_modules: "none",
225 java_version: "1.8",
226 compile_dex: true,
Jihoon Kang491c7082023-06-15 18:37:01 +0000227}
228
229java_defaults {
230 name: "android-non-updatable_from_source_defaults",
231 libs: ["stub-annotations"],
232 static_libs: ["framework-res-package-jar"], // Export package of framework-res
Anton Hanssona4108912021-04-09 13:40:11 +0100233 dist: {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000234 targets: ["sdk"],
Anton Hanssona4108912021-04-09 13:40:11 +0100235 tag: ".jar",
236 dest: "android-non-updatable.jar",
Anton Hansson240ee482021-04-14 12:52:00 +0100237 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900238}
239
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100240java_library {
Anton Hanssona4748cd2021-04-09 10:16:19 +0100241 name: "android-non-updatable.stubs",
Jihoon Kang491c7082023-06-15 18:37:01 +0000242 defaults: ["android-non-updatable_defaults"],
243 static_libs: [
244 "android-non-updatable.stubs.from-source",
245 ],
246 product_variables: {
247 build_from_text_stub: {
248 static_libs: [
249 "android-non-updatable.stubs.from-text",
250 ],
251 exclude_static_libs: [
252 "android-non-updatable.stubs.from-source",
253 ],
254 },
255 },
256}
257
258java_library {
259 name: "android-non-updatable.stubs.system",
260 defaults: ["android-non-updatable_defaults"],
261 static_libs: [
262 "android-non-updatable.stubs.system.from-source",
263 ],
264 product_variables: {
265 build_from_text_stub: {
266 static_libs: [
267 "android-non-updatable.stubs.system.from-text",
268 ],
269 exclude_static_libs: [
270 "android-non-updatable.stubs.system.from-source",
271 ],
272 },
273 },
274}
275
276java_library {
277 name: "android-non-updatable.stubs.module_lib",
278 defaults: ["android-non-updatable_defaults"],
279 static_libs: [
280 "android-non-updatable.stubs.module_lib.from-source",
281 ],
282 product_variables: {
283 build_from_text_stub: {
284 static_libs: [
285 "android-non-updatable.stubs.module_lib.from-text",
286 ],
287 exclude_static_libs: [
288 "android-non-updatable.stubs.module_lib.from-source",
289 ],
290 },
291 },
292}
293
294java_library {
295 name: "android-non-updatable.stubs.test",
296 defaults: ["android-non-updatable_defaults"],
297 static_libs: [
298 "android-non-updatable.stubs.test.from-source",
299 ],
300 product_variables: {
301 build_from_text_stub: {
302 static_libs: [
303 "android-non-updatable.stubs.test.from-text",
304 ],
305 exclude_static_libs: [
306 "android-non-updatable.stubs.test.from-source",
307 ],
308 },
309 },
310}
311
312java_library {
313 name: "android-non-updatable.stubs.from-source",
314 defaults: [
315 "android-non-updatable_defaults",
316 "android-non-updatable_from_source_defaults",
317 ],
Anton Hanssona4748cd2021-04-09 10:16:19 +0100318 srcs: [":api-stubs-docs-non-updatable"],
Anton Hanssonc6e9d2f2022-01-25 15:53:43 +0000319 libs: ["all-modules-public-stubs"],
Anton Hanssona4108912021-04-09 13:40:11 +0100320 dist: {
321 dir: "apistubs/android/public",
322 },
Anton Hanssona4748cd2021-04-09 10:16:19 +0100323}
324
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100325java_library {
Jihoon Kang491c7082023-06-15 18:37:01 +0000326 name: "android-non-updatable.stubs.system.from-source",
327 defaults: [
328 "android-non-updatable_defaults",
329 "android-non-updatable_from_source_defaults",
330 ],
Anton Hansson240ee482021-04-14 12:52:00 +0100331 srcs: [":system-api-stubs-docs-non-updatable"],
Anton Hanssonc6e9d2f2022-01-25 15:53:43 +0000332 libs: ["all-modules-system-stubs"],
Anton Hanssona4108912021-04-09 13:40:11 +0100333 dist: {
334 dir: "apistubs/android/system",
335 },
Anton Hanssona4748cd2021-04-09 10:16:19 +0100336}
337
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100338java_library {
Jihoon Kang491c7082023-06-15 18:37:01 +0000339 name: "android-non-updatable.stubs.module_lib.from-source",
340 defaults: [
341 "android-non-updatable_defaults",
342 "android-non-updatable_from_source_defaults",
343 ],
Anton Hanssona4748cd2021-04-09 10:16:19 +0100344 srcs: [":module-lib-api-stubs-docs-non-updatable"],
345 libs: [
markchiencd813a32021-11-11 00:42:55 +0800346 "sdk_module-lib_current_framework-tethering",
paulhu2a8c2c32022-02-08 21:23:06 +0800347 "sdk_module-lib_current_framework-connectivity-t",
Roopa Sattiraju86058b62022-01-20 10:05:19 -0800348 "sdk_public_current_framework-bluetooth",
349 // NOTE: The below can be removed once the prebuilt stub contains bluetooth.
Anton Hanssona4748cd2021-04-09 10:16:19 +0100350 "sdk_system_current_android",
351 // NOTE: The below can be removed once the prebuilt stub contains IKE.
352 "sdk_system_current_android.net.ipsec.ike",
353 ],
Anton Hanssona4108912021-04-09 13:40:11 +0100354 dist: {
355 dir: "apistubs/android/module-lib",
356 },
Anton Hanssona4748cd2021-04-09 10:16:19 +0100357}
358
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100359java_library {
Jihoon Kang491c7082023-06-15 18:37:01 +0000360 name: "android-non-updatable.stubs.test.from-source",
361 defaults: [
362 "android-non-updatable_defaults",
363 "android-non-updatable_from_source_defaults",
364 ],
Anton Hanssona4748cd2021-04-09 10:16:19 +0100365 srcs: [":test-api-stubs-docs-non-updatable"],
Anton Hanssonc6e9d2f2022-01-25 15:53:43 +0000366 libs: ["all-modules-system-stubs"],
Anton Hanssona4108912021-04-09 13:40:11 +0100367 dist: {
368 dir: "apistubs/android/test",
369 },
Anton Hanssona4748cd2021-04-09 10:16:19 +0100370}
371
372java_defaults {
Jihoon Kang491c7082023-06-15 18:37:01 +0000373 name: "android-non-updatable_from_text_defaults",
Jihoon Kang0c101db2023-03-14 07:03:46 +0000374 static_libs: ["framework-res-package-jar"],
375 libs: ["stub-annotations"],
376}
377
378java_api_library {
379 name: "android-non-updatable.stubs.from-text",
380 api_surface: "public",
381 api_files: [
382 ":non-updatable-current.txt",
383 ],
Jihoon Kang491c7082023-06-15 18:37:01 +0000384 defaults: ["android-non-updatable_from_text_defaults"],
Jihoon Kang12cddb32023-06-29 21:35:24 +0000385 full_api_surface_stub: "android_stubs_current.from-text",
Jihoon Kang0c101db2023-03-14 07:03:46 +0000386}
387
388java_api_library {
389 name: "android-non-updatable.stubs.system.from-text",
390 api_surface: "system",
391 api_files: [
392 ":non-updatable-current.txt",
393 ":non-updatable-system-current.txt",
394 ],
Jihoon Kang491c7082023-06-15 18:37:01 +0000395 defaults: ["android-non-updatable_from_text_defaults"],
Jihoon Kang12cddb32023-06-29 21:35:24 +0000396 full_api_surface_stub: "android_system_stubs_current.from-text",
Jihoon Kang0c101db2023-03-14 07:03:46 +0000397}
398
399java_api_library {
400 name: "android-non-updatable.stubs.test.from-text",
401 api_surface: "test",
402 api_files: [
403 ":non-updatable-current.txt",
404 ":non-updatable-system-current.txt",
405 ":non-updatable-test-current.txt",
406 ],
Jihoon Kang491c7082023-06-15 18:37:01 +0000407 defaults: ["android-non-updatable_from_text_defaults"],
Jihoon Kang12cddb32023-06-29 21:35:24 +0000408 full_api_surface_stub: "android_test_stubs_current.from-text",
Jihoon Kang0c101db2023-03-14 07:03:46 +0000409}
410
411java_api_library {
412 name: "android-non-updatable.stubs.module_lib.from-text",
413 api_surface: "module_lib",
414 api_files: [
415 ":non-updatable-current.txt",
416 ":non-updatable-system-current.txt",
417 ":non-updatable-module-lib-current.txt",
418 ],
Jihoon Kang491c7082023-06-15 18:37:01 +0000419 defaults: ["android-non-updatable_from_text_defaults"],
Jihoon Kang12cddb32023-06-29 21:35:24 +0000420 full_api_surface_stub: "android_module_lib_stubs_current_full.from-text",
Jihoon Kang0c101db2023-03-14 07:03:46 +0000421}
422
423java_defaults {
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000424 name: "android_stubs_dists_default",
425 dist: {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000426 targets: ["sdk"],
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000427 tag: ".jar",
428 dest: "android.jar",
429 },
Anton Hansson86925682021-04-14 14:54:43 +0100430 defaults_visibility: ["//frameworks/base/services"],
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000431}
432
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100433java_library {
Jihoon Kang1453baa2023-05-27 05:32:30 +0000434 name: "android_stubs_current.from-source",
Anton Hanssonc6e9d2f2022-01-25 15:53:43 +0000435 static_libs: [
436 "all-modules-public-stubs",
Anton Hanssona4748cd2021-04-09 10:16:19 +0100437 "android-non-updatable.stubs",
Anton Hanssonbf63f942020-05-20 12:06:23 +0100438 "private-stub-annotations-jar",
Anton Hansson76d3db42020-04-09 14:16:37 +0100439 ],
Anton Hansson65057af2021-04-14 18:52:08 +0100440 defaults: ["android.jar_defaults"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900441}
442
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100443java_library {
Jihoon Kang1453baa2023-05-27 05:32:30 +0000444 name: "android_system_stubs_current.from-source",
Anton Hanssonc6e9d2f2022-01-25 15:53:43 +0000445 static_libs: [
446 "all-modules-system-stubs",
Anton Hanssona4748cd2021-04-09 10:16:19 +0100447 "android-non-updatable.stubs.system",
Anton Hanssonbf63f942020-05-20 12:06:23 +0100448 "private-stub-annotations-jar",
Anton Hansson76d3db42020-04-09 14:16:37 +0100449 ],
Anton Hanssonc3002e52020-11-18 18:23:55 +0000450 defaults: [
Anton Hansson65057af2021-04-14 18:52:08 +0100451 "android.jar_defaults",
Anton Hanssonc3002e52020-11-18 18:23:55 +0000452 "android_stubs_dists_default",
453 ],
454 dist: {
455 dir: "apistubs/android/system",
456 },
457 dists: [
458 {
459 // Legacy dist path
Anton Hanssondd8ef672022-01-04 08:53:19 +0000460 targets: ["sdk"],
Anton Hanssonc3002e52020-11-18 18:23:55 +0000461 tag: ".jar",
462 dest: "android_system.jar",
463 },
464 ],
Anton Hansson76d3db42020-04-09 14:16:37 +0100465}
466
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100467java_library {
Jihoon Kang1453baa2023-05-27 05:32:30 +0000468 name: "android_test_stubs_current.from-source",
Anton Hanssonc6e9d2f2022-01-25 15:53:43 +0000469 static_libs: [
Nikita Ioffe5593fbb2022-12-01 14:52:34 +0000470 // Updatable modules do not have test APIs, but we want to include their SystemApis, like we
471 // include the SystemApi of framework-non-updatable-sources.
472 "all-updatable-modules-system-stubs",
473 // Non-updatable modules on the other hand can have test APIs, so include their test-stubs.
474 "all-non-updatable-modules-test-stubs",
Anton Hanssona4748cd2021-04-09 10:16:19 +0100475 "android-non-updatable.stubs.test",
Anton Hansson7ce31c12020-10-15 18:38:49 +0100476 "private-stub-annotations-jar",
477 ],
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000478 defaults: [
Anton Hansson65057af2021-04-14 18:52:08 +0100479 "android.jar_defaults",
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000480 "android_stubs_dists_default",
481 ],
482 dist: {
483 dir: "apistubs/android/test",
484 },
Jiyong Parke3095162019-12-20 15:30:28 +0900485}
486
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100487java_library {
Mark Whiteb03c1fc2023-08-12 01:31:26 +0000488 name: "android_test_frameworks_core_stubs_current.from-source",
489 static_libs: [
490 "all-updatable-modules-system-stubs",
491 "android-non-updatable.stubs.test",
Mark Whiteb03c1fc2023-08-12 01:31:26 +0000492 ],
493 defaults: [
494 "android.jar_defaults",
495 "android_stubs_dists_default",
496 ],
497 dist: {
498 dir: "apistubs/android/test-core",
499 },
500}
501
502java_library {
Jihoon Kang1453baa2023-05-27 05:32:30 +0000503 name: "android_module_lib_stubs_current.from-source",
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000504 defaults: [
Anton Hansson65057af2021-04-14 18:52:08 +0100505 "android.jar_defaults",
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000506 "android_stubs_dists_default",
507 ],
Anton Hanssona4748cd2021-04-09 10:16:19 +0100508 static_libs: [
509 "android-non-updatable.stubs.module_lib",
Victor Chang6b107a92021-06-17 23:49:42 +0100510 "art.module.public.api.stubs.module_lib",
Giulio Fiscella68a04112021-11-30 16:32:44 +0000511 "i18n.module.public.api.stubs",
Anton Hanssonb7d532e2021-02-05 11:40:25 +0000512 ],
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000513 dist: {
514 dir: "apistubs/android/module-lib",
515 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900516}
517
Andrei Oneafaa271a2021-03-17 13:32:51 +0000518java_library {
Jihoon Kang1453baa2023-05-27 05:32:30 +0000519 name: "android_system_server_stubs_current.from-source",
Anton Hansson21fb1082023-03-03 16:22:42 +0000520 defaults: [
521 "android.jar_defaults",
522 "android_stubs_dists_default",
523 ],
Andrei Oneafaa271a2021-03-17 13:32:51 +0000524 srcs: [":services-non-updatable-stubs"],
525 installable: false,
526 static_libs: [
Jihoon Kang1453baa2023-05-27 05:32:30 +0000527 "android_module_lib_stubs_current.from-source",
Andrei Oneafaa271a2021-03-17 13:32:51 +0000528 ],
Andrei Oneafaa271a2021-03-17 13:32:51 +0000529 dist: {
530 dir: "apistubs/android/system-server",
531 },
532}
533
Colin Crosscf87a572022-10-20 14:06:53 -0700534java_library {
535 name: "android_stubs_private_jar",
536 defaults: ["android.jar_defaults"],
537 visibility: [
538 "//visibility:override",
539 "//visibility:private",
540 ],
541 static_libs: [
542 "stable.core.platform.api.stubs",
543 "core-lambda-stubs-for-system-modules",
544 "core-generated-annotation-stubs",
545 "framework",
546 "ext",
547 "framework-res-package-jar",
548 // The order of this matters, it has to be last to provide a
549 // package-private androidx.annotation.RecentlyNonNull without
550 // overriding the public android.annotation.Nullable in framework.jar
551 // with its own package-private android.annotation.Nullable.
552 "private-stub-annotations-jar",
553 ],
554}
555
556java_genrule {
557 name: "android_stubs_private_hjar",
Colin Crosscf87a572022-10-20 14:06:53 -0700558 srcs: [":android_stubs_private_jar{.hjar}"],
559 out: ["android_stubs_private.jar"],
560 cmd: "cp $(in) $(out)",
561}
562
563java_library {
564 name: "android_stubs_private",
565 defaults: ["android_stubs_dists_default"],
Colin Crosscf87a572022-10-20 14:06:53 -0700566 sdk_version: "none",
567 system_modules: "none",
568 static_libs: ["android_stubs_private_hjar"],
569 dist: {
570 dir: "apistubs/android/private",
571 },
572}
573
574java_genrule {
575 name: "android_stubs_private_framework_aidl",
Colin Crosscf87a572022-10-20 14:06:53 -0700576 tools: ["sdkparcelables"],
577 srcs: [":android_stubs_private"],
578 out: ["framework.aidl"],
579 cmd: "rm -f $(genDir)/framework.aidl.merged && " +
580 "for i in $(in); do " +
581 " rm -f $(genDir)/framework.aidl.tmp && " +
582 " $(location sdkparcelables) $$i $(genDir)/framework.aidl.tmp && " +
583 " cat $(genDir)/framework.aidl.tmp >> $(genDir)/framework.aidl.merged; " +
584 "done && " +
585 "sort -u $(genDir)/framework.aidl.merged > $(out)",
586 dist: {
587 targets: ["sdk"],
588 dir: "apistubs/android/private",
589 },
590}
591
Jihoon Kang1f406452023-08-16 19:06:38 +0000592//
593// Java API defaults and libraries for single tree build
594//
595
596java_defaults {
597 name: "stub-annotation-defaults",
598 libs: [
599 "stub-annotations",
600 ],
601 static_libs: [
602 // stub annotations do not contribute to the API surfaces but are statically
603 // linked in the stubs for API surfaces (see frameworks/base/StubLibraries.bp).
604 // This is because annotation processors insist on loading the classes for any
605 // annotations found, thus should exist inside android.jar.
606 "private-stub-annotations-jar",
607 ],
608}
609
610// Listing of API domains contribution and dependencies per API surfaces
611java_defaults {
612 name: "android_test_stubs_current_contributions",
613 api_surface: "test",
614 api_contributions: [
615 "test-api-stubs-docs-non-updatable.api.contribution",
616 "framework-virtualization.stubs.source.test.api.contribution",
Mark White9ee18662023-08-07 11:18:09 +0000617 "framework-location.stubs.source.test.api.contribution",
Jihoon Kang1f406452023-08-16 19:06:38 +0000618 ],
619}
620
621java_defaults {
622 name: "android_test_frameworks_core_stubs_current_contributions",
623 api_surface: "test",
624 api_contributions: [
625 "test-api-stubs-docs-non-updatable.api.contribution",
626 ],
627}
628
629java_defaults {
630 name: "android_module_lib_stubs_current_contributions",
631 api_surface: "module-lib",
632 api_contributions: [
633 "api-stubs-docs-non-updatable.api.contribution",
634 "system-api-stubs-docs-non-updatable.api.contribution",
635 "module-lib-api-stubs-docs-non-updatable.api.contribution",
636 "art.module.public.api.stubs.source.api.contribution",
637 "art.module.public.api.stubs.source.system.api.contribution",
638 "art.module.public.api.stubs.source.module_lib.api.contribution",
639 "i18n.module.public.api.stubs.source.api.contribution",
640 "i18n.module.public.api.stubs.source.system.api.contribution",
641 "i18n.module.public.api.stubs.source.module_lib.api.contribution",
642 ],
643}
644
645// Java API library definitions per API surface
646java_api_library {
647 name: "android_stubs_current.from-text",
648 api_surface: "public",
649 defaults: [
650 // This module is dynamically created at frameworks/base/api/api.go
651 // instead of being written out, in order to minimize edits in the codebase
652 // when there is a change in the list of modules.
653 // that contributes to an api surface.
654 "android_stubs_current_contributions",
655 "stub-annotation-defaults",
656 ],
657 api_contributions: [
658 "api-stubs-docs-non-updatable.api.contribution",
659 ],
660 visibility: ["//visibility:public"],
661}
662
663java_api_library {
664 name: "android_system_stubs_current.from-text",
665 api_surface: "system",
666 defaults: [
667 "android_stubs_current_contributions",
668 "android_system_stubs_current_contributions",
669 "stub-annotation-defaults",
670 ],
671 api_contributions: [
672 "api-stubs-docs-non-updatable.api.contribution",
673 "system-api-stubs-docs-non-updatable.api.contribution",
674 ],
675 visibility: ["//visibility:public"],
676}
677
678java_api_library {
679 name: "android_test_stubs_current.from-text",
680 api_surface: "test",
681 defaults: [
682 "android_stubs_current_contributions",
683 "android_system_stubs_current_contributions",
684 "android_test_stubs_current_contributions",
685 "stub-annotation-defaults",
686 ],
687 api_contributions: [
688 "api-stubs-docs-non-updatable.api.contribution",
689 "system-api-stubs-docs-non-updatable.api.contribution",
690 ],
691 visibility: ["//visibility:public"],
692}
693
694java_api_library {
695 name: "android_test_frameworks_core_stubs_current.from-text",
696 api_surface: "test",
697 defaults: [
698 "android_stubs_current_contributions",
699 "android_system_stubs_current_contributions",
700 "android_test_frameworks_core_stubs_current_contributions",
701 "stub-annotation-defaults",
702 ],
703 api_contributions: [
704 "api-stubs-docs-non-updatable.api.contribution",
705 "system-api-stubs-docs-non-updatable.api.contribution",
706 ],
707}
708
709java_api_library {
710 name: "android_module_lib_stubs_current_full.from-text",
711 api_surface: "module-lib",
712 defaults: [
713 "android_stubs_current_contributions",
714 "android_system_stubs_current_contributions",
715 "android_module_lib_stubs_current_contributions_full",
716 ],
717 libs: [
718 "stub-annotations",
719 ],
720 api_contributions: [
721 "api-stubs-docs-non-updatable.api.contribution",
722 "system-api-stubs-docs-non-updatable.api.contribution",
723 "module-lib-api-stubs-docs-non-updatable.api.contribution",
724 ],
725 visibility: ["//visibility:public"],
726}
727
728java_api_library {
729 name: "android_module_lib_stubs_current.from-text",
730 api_surface: "module-lib",
731 defaults: [
732 "android_module_lib_stubs_current_contributions",
733 ],
734 libs: [
735 "android_module_lib_stubs_current_full.from-text",
736 "stub-annotations",
737 ],
738 visibility: ["//visibility:public"],
739}
740
741java_api_library {
742 name: "android_system_server_stubs_current.from-text",
743 api_surface: "system-server",
744 api_contributions: [
745 "services-non-updatable-stubs.api.contribution",
746 ],
747 libs: [
748 "android_module_lib_stubs_current.from-text",
749 "stub-annotations",
750 ],
751 static_libs: [
752 "android_module_lib_stubs_current.from-text",
753 ],
754 visibility: ["//visibility:public"],
755}
756
Anton Hansson36bc27c2021-09-14 15:45:13 +0100757////////////////////////////////////////////////////////////////////////
758// api-versions.xml generation, for public and system. This API database
759// also contains the android.test.* APIs.
760////////////////////////////////////////////////////////////////////////
761
762java_library {
763 name: "android_stubs_current_with_test_libs",
764 static_libs: [
765 "android_stubs_current",
766 "android.test.base.stubs",
767 "android.test.mock.stubs",
768 "android.test.runner.stubs",
769 ],
770 defaults: ["android.jar_defaults"],
771 visibility: [
772 "//visibility:override",
773 "//visibility:private",
774 ],
775}
776
777java_library {
778 name: "android_system_stubs_current_with_test_libs",
779 static_libs: [
780 "android_system_stubs_current",
781 "android.test.base.stubs.system",
782 "android.test.mock.stubs.system",
783 "android.test.runner.stubs.system",
784 ],
785 defaults: ["android.jar_defaults"],
786 visibility: [
787 "//visibility:override",
788 "//visibility:private",
789 ],
790}
791
Cole Faustdcda3702022-10-04 14:46:35 -0700792java_library {
793 name: "android_module_stubs_current_with_test_libs",
794 static_libs: [
795 "android_module_lib_stubs_current",
796 "android.test.base.stubs",
797 "android.test.mock.stubs",
798 "android.test.runner.stubs",
799 ],
800 defaults: ["android.jar_defaults"],
801 visibility: [
802 "//visibility:override",
803 "//visibility:private",
804 ],
805}
806
807java_library {
808 name: "android_system_server_stubs_current_with_test_libs",
809 static_libs: [
810 "android_system_server_stubs_current",
811 "android.test.base.stubs.system",
812 "android.test.mock.stubs.system",
813 "android.test.runner.stubs.system",
814 ],
815 defaults: ["android.jar_defaults"],
816 visibility: [
817 "//visibility:override",
818 "//visibility:private",
819 ],
820}
821
Anton Hansson36bc27c2021-09-14 15:45:13 +0100822droidstubs {
823 name: "api_versions_public",
824 srcs: [":android_stubs_current_with_test_libs{.jar}"],
825 generate_stubs: false,
826 api_levels_annotations_enabled: true,
827 api_levels_annotations_dirs: [
828 "sdk-dir",
829 "api-versions-jars-dir",
830 ],
Cole Faustdcda3702022-10-04 14:46:35 -0700831 api_levels_sdk_type: "public",
Mårten Kongstad54845332022-09-06 15:50:37 +0200832 extensions_info_file: ":sdk-extensions-info",
Anton Hanssonca6e67a2023-03-03 17:55:09 +0000833 visibility: ["//frameworks/base"],
Anton Hansson36bc27c2021-09-14 15:45:13 +0100834}
835
836droidstubs {
837 name: "api_versions_system",
838 srcs: [":android_system_stubs_current_with_test_libs{.jar}"],
839 generate_stubs: false,
840 api_levels_annotations_enabled: true,
841 api_levels_annotations_dirs: [
842 "sdk-dir",
843 "api-versions-jars-dir",
844 ],
845 api_levels_sdk_type: "system",
Mårten Kongstad54845332022-09-06 15:50:37 +0200846 extensions_info_file: ":sdk-extensions-info",
Anton Hansson36bc27c2021-09-14 15:45:13 +0100847}
848
Cole Faustbf4ce752023-02-08 12:46:06 -0800849// This module can be built with:
850// m out/soong/.intermediates/frameworks/base/api_versions_module_lib/android_common/metalava/api-versions.xml
Cole Faustdcda3702022-10-04 14:46:35 -0700851droidstubs {
852 name: "api_versions_module_lib",
853 srcs: [":android_module_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 module lib 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: "module-lib",
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
869droidstubs {
870 name: "api_versions_system_server",
871 srcs: [":android_system_server_stubs_current_with_test_libs{.jar}"],
872 generate_stubs: false,
873 api_levels_annotations_enabled: true,
Cole Faustbf4ce752023-02-08 12:46:06 -0800874 // this only has the non-updatable portions of the system server sdk,
875 // which can reference classes from updatable apexes, so remove references to them
876 // from this api_versions file.
877 flags: ["--remove-missing-class-references-in-api-levels"],
Cole Faustdcda3702022-10-04 14:46:35 -0700878 api_levels_annotations_dirs: [
879 "sdk-dir",
880 "api-versions-jars-dir",
881 ],
882 api_levels_sdk_type: "system-server",
Cole Faust1deced12023-02-15 13:24:18 -0800883 // extensions_info_file is purposefully omitted, because this module should just be
884 // the non-updatable portions of the sdk, and extension sdks are updatable.
Cole Faustdcda3702022-10-04 14:46:35 -0700885}
886
Jiyong Park7fb4b182019-12-20 14:35:43 +0900887/////////////////////////////////////////////////////////////////////
888// hwbinder.stubs provides APIs required for building HIDL Java
889// libraries.
890/////////////////////////////////////////////////////////////////////
891
892droidstubs {
893 name: "hwbinder-stubs-docs",
Anton Hansson23f319f2023-03-03 16:04:02 +0000894 srcs: [":hwbinder-stubs-srcs"],
Colin Cross037d7fb2021-03-25 17:01:55 -0700895 libs: ["framework-annotations-lib"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900896 installable: false,
897 sdk_version: "core_platform",
898 annotations_enabled: true,
Anton Hansson48ee95e2020-05-02 17:49:26 +0100899 previous_api: ":android.api.public.latest",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900900 merge_annotations_dirs: [
901 "metalava-manual",
902 ],
Anton Hansson81969c22020-02-03 20:45:56 +0000903 args: priv_apps,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900904}
905
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100906java_library {
Jiyong Park7fb4b182019-12-20 14:35:43 +0900907 name: "hwbinder.stubs",
908 sdk_version: "core_current",
Colin Cross037d7fb2021-03-25 17:01:55 -0700909 libs: ["framework-annotations-lib"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900910 srcs: [
911 ":hwbinder-stubs-docs",
912 ],
Anton Hansson86925682021-04-14 14:54:43 +0100913 visibility: ["//visibility:public"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900914}