blob: 857077d60a5db081b0677555ef09c6c87e669628 [file] [log] [blame]
Jiyong Park7fb4b182019-12-20 14:35:43 +09001// Copyright (C) 2019 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15// How stubs are generated:
16//
17// raw source files --(metalava)--> stub source files --(javac)--> stub jar files
18//
Anton Hansson2feb3f12020-11-13 11:44:32 +000019// - The metalava conversion is done by droidstub modules
20// - The javac compilation is done by java_library modules
21//
Jiyong Park7fb4b182019-12-20 14:35:43 +090022// The metalava conversion is also responsible for creating API signature files
Anton Hansson2feb3f12020-11-13 11:44:32 +000023// and comparing them against the checked in API signature, and also checking compatibility
24// with the latest frozen API signature.
Jiyong Park7fb4b182019-12-20 14:35:43 +090025
26/////////////////////////////////////////////////////////////////////
Anton Hansson51861e72020-11-13 09:55:29 +000027// These modules provide source files for the stub libraries
Jiyong Park7fb4b182019-12-20 14:35:43 +090028/////////////////////////////////////////////////////////////////////
29
Anton Hansson76d3db42020-04-09 14:16:37 +010030droidstubs {
31 name: "api-stubs-docs-non-updatable",
Liz Kammer56896172023-09-20 15:15:43 +000032 srcs: [
33 ":framework-minus-apex-aconfig-srcjars",
34 ],
Anton Hansson9dce8322022-01-24 14:14:33 +000035 defaults: [
36 "android-non-updatable-stubs-defaults",
37 "module-classpath-stubs-defaults",
38 ],
Anton Hansson76d3db42020-04-09 14:16:37 +010039 args: metalava_framework_docs_args,
40 check_api: {
41 current: {
Anton Hanssonb7cda922023-03-03 15:38:28 +000042 api_file: ":non-updatable-current.txt",
43 removed_api_file: ":non-updatable-removed.txt",
Anton Hansson76d3db42020-04-09 14:16:37 +010044 },
Anton Hansson37e102e2020-10-05 16:42:40 +010045 last_released: {
46 api_file: ":android-non-updatable.api.public.latest",
47 removed_api_file: ":android-non-updatable-removed.api.public.latest",
Anton Hansson7f3393d2021-04-12 11:56:53 +010048 baseline_file: ":android-non-updatable-incompatibilities.api.public.latest",
Anton Hansson37e102e2020-10-05 16:42:40 +010049 },
Anton Hansson76d3db42020-04-09 14:16:37 +010050 api_lint: {
51 enabled: true,
Anton Hansson4f90aa52021-06-04 22:23:59 +010052 new_since: ":android.api.public.latest",
Anton Hansson76d3db42020-04-09 14:16:37 +010053 },
54 },
Anton Hansson85785fe2021-01-20 20:23:34 +000055 dists: [
56 {
Anton Hanssondd8ef672022-01-04 08:53:19 +000057 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +000058 dir: "apistubs/android/public/api",
59 dest: "android-non-updatable.txt",
60 tag: ".api.txt",
61 },
62 {
Anton Hanssondd8ef672022-01-04 08:53:19 +000063 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +000064 dir: "apistubs/android/public/api",
65 dest: "android-non-updatable-removed.txt",
66 tag: ".removed-api.txt",
67 },
68 ],
Jihoon Kang866b9b7a2023-09-20 22:28:05 +000069 api_surface: "public",
Anton Hansson76d3db42020-04-09 14:16:37 +010070}
71
Anton Hansson240ee482021-04-14 12:52:00 +010072priv_apps = " --show-annotation android.annotation.SystemApi\\(" +
73 "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
Anton Hansson2feb3f12020-11-13 11:44:32 +000074 "\\)"
75
Anton Hansson240ee482021-04-14 12:52:00 +010076priv_apps_in_stubs = " --show-for-stub-purposes-annotation android.annotation.SystemApi\\(" +
77 "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
Anton Hansson2feb3f12020-11-13 11:44:32 +000078 "\\)"
79
80test = " --show-annotation android.annotation.TestApi"
81
Anton Hansson240ee482021-04-14 12:52:00 +010082module_libs = " --show-annotation android.annotation.SystemApi\\(" +
83 "client=android.annotation.SystemApi.Client.MODULE_LIBRARIES" +
Anton Hansson2feb3f12020-11-13 11:44:32 +000084 "\\)"
Anton Hansson81969c22020-02-03 20:45:56 +000085
Jiyong Park7fb4b182019-12-20 14:35:43 +090086droidstubs {
Anton Hansson76d3db42020-04-09 14:16:37 +010087 name: "system-api-stubs-docs-non-updatable",
Mårten Kongstad85f6bee2023-09-25 14:09:11 +020088 srcs: [
89 ":framework-minus-apex-aconfig-srcjars",
90 ],
Anton Hansson9dce8322022-01-24 14:14:33 +000091 defaults: [
92 "android-non-updatable-stubs-defaults",
93 "module-classpath-stubs-defaults",
94 ],
Anton Hansson76d3db42020-04-09 14:16:37 +010095 args: metalava_framework_docs_args + priv_apps,
96 check_api: {
97 current: {
Anton Hanssonb7cda922023-03-03 15:38:28 +000098 api_file: ":non-updatable-system-current.txt",
99 removed_api_file: ":non-updatable-system-removed.txt",
Anton Hansson76d3db42020-04-09 14:16:37 +0100100 },
Anton Hansson37e102e2020-10-05 16:42:40 +0100101 last_released: {
102 api_file: ":android-non-updatable.api.system.latest",
103 removed_api_file: ":android-non-updatable-removed.api.system.latest",
Anton Hansson240ee482021-04-14 12:52:00 +0100104 baseline_file: ":android-non-updatable-incompatibilities.api.system.latest",
Anton Hansson37e102e2020-10-05 16:42:40 +0100105 },
Anton Hansson76d3db42020-04-09 14:16:37 +0100106 api_lint: {
107 enabled: true,
Anton Hansson4f90aa52021-06-04 22:23:59 +0100108 new_since: ":android.api.system.latest",
Anton Hanssonb7cda922023-03-03 15:38:28 +0000109 baseline_file: ":non-updatable-system-lint-baseline.txt",
Anton Hansson76d3db42020-04-09 14:16:37 +0100110 },
111 },
Anton Hansson85785fe2021-01-20 20:23:34 +0000112 dists: [
113 {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000114 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +0000115 dir: "apistubs/android/system/api",
116 dest: "android-non-updatable.txt",
117 tag: ".api.txt",
118 },
119 {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000120 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +0000121 dir: "apistubs/android/system/api",
122 dest: "android-non-updatable-removed.txt",
123 tag: ".removed-api.txt",
124 },
125 ],
Jihoon Kang866b9b7a2023-09-20 22:28:05 +0000126 api_surface: "system",
Anton Hansson76d3db42020-04-09 14:16:37 +0100127}
128
129droidstubs {
Anton Hansson022aac52020-11-05 10:45:13 +0000130 name: "test-api-stubs-docs-non-updatable",
Mårten Kongstad85f6bee2023-09-25 14:09:11 +0200131 srcs: [
132 ":framework-minus-apex-aconfig-srcjars",
133 ],
Anton Hansson9dce8322022-01-24 14:14:33 +0000134 defaults: [
135 "android-non-updatable-stubs-defaults",
136 "module-classpath-stubs-defaults",
137 ],
Anton Hansson2feb3f12020-11-13 11:44:32 +0000138 args: metalava_framework_docs_args + test + priv_apps_in_stubs,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900139 check_api: {
140 current: {
Anton Hanssonb7cda922023-03-03 15:38:28 +0000141 api_file: ":non-updatable-test-current.txt",
142 removed_api_file: ":non-updatable-test-removed.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900143 },
144 api_lint: {
145 enabled: true,
Anton Hanssonb7cda922023-03-03 15:38:28 +0000146 baseline_file: ":non-updatable-test-lint-baseline.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900147 },
148 },
Anton Hansson85785fe2021-01-20 20:23:34 +0000149 dists: [
150 {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000151 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +0000152 dir: "apistubs/android/test/api",
153 dest: "android.txt",
154 tag: ".api.txt",
155 },
156 {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000157 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +0000158 dir: "apistubs/android/test/api",
159 dest: "removed.txt",
160 tag: ".removed-api.txt",
161 },
162 {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000163 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +0000164 dir: "apistubs/android/test/api",
165 dest: "android-non-updatable.txt",
166 tag: ".api.txt",
167 },
168 {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000169 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +0000170 dir: "apistubs/android/test/api",
171 dest: "android-non-updatable-removed.txt",
172 tag: ".removed-api.txt",
173 },
174 ],
Jihoon Kang866b9b7a2023-09-20 22:28:05 +0000175 api_surface: "test",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900176}
177
Jiyong Parke3095162019-12-20 15:30:28 +0900178droidstubs {
Anton Hansson76d3db42020-04-09 14:16:37 +0100179 name: "module-lib-api-stubs-docs-non-updatable",
Mårten Kongstad85f6bee2023-09-25 14:09:11 +0200180 srcs: [
181 ":framework-minus-apex-aconfig-srcjars",
182 ],
Anton Hansson9dce8322022-01-24 14:14:33 +0000183 defaults: [
184 "android-non-updatable-stubs-defaults",
185 "module-classpath-stubs-defaults",
186 ],
Anton Hansson2feb3f12020-11-13 11:44:32 +0000187 args: metalava_framework_docs_args + priv_apps_in_stubs + module_libs,
Anton Hansson76d3db42020-04-09 14:16:37 +0100188 check_api: {
189 current: {
Anton Hanssonb7cda922023-03-03 15:38:28 +0000190 api_file: ":non-updatable-module-lib-current.txt",
191 removed_api_file: ":non-updatable-module-lib-removed.txt",
Anton Hansson76d3db42020-04-09 14:16:37 +0100192 },
Anton Hanssonc3ef1f562020-10-07 14:55:36 +0100193 last_released: {
194 api_file: ":android-non-updatable.api.module-lib.latest",
195 removed_api_file: ":android-non-updatable-removed.api.module-lib.latest",
Junyu Lai2dbb1772022-01-12 17:38:02 +0000196 baseline_file: ":android-non-updatable-incompatibilities.api.module-lib.latest",
Anton Hanssonc3ef1f562020-10-07 14:55:36 +0100197 },
Anton Hansson76d3db42020-04-09 14:16:37 +0100198 api_lint: {
199 enabled: true,
Anton Hansson4f90aa52021-06-04 22:23:59 +0100200 new_since: ":android.api.module-lib.latest",
Anton Hanssonb7cda922023-03-03 15:38:28 +0000201 baseline_file: ":non-updatable-module-lib-lint-baseline.txt",
Anton Hansson76d3db42020-04-09 14:16:37 +0100202 },
203 },
Anton Hansson85785fe2021-01-20 20:23:34 +0000204 dists: [
205 {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000206 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +0000207 dir: "apistubs/android/module-lib/api",
208 dest: "android-non-updatable.txt",
209 tag: ".api.txt",
210 },
211 {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000212 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +0000213 dir: "apistubs/android/module-lib/api",
214 dest: "android-non-updatable-removed.txt",
215 tag: ".removed-api.txt",
216 },
217 ],
Jihoon Kang866b9b7a2023-09-20 22:28:05 +0000218 api_surface: "module-lib",
Anton Hansson76d3db42020-04-09 14:16:37 +0100219}
Anton Hansson81969c22020-02-03 20:45:56 +0000220
Jiyong Parke3095162019-12-20 15:30:28 +0900221/////////////////////////////////////////////////////////////////////
Jiyong Park7fb4b182019-12-20 14:35:43 +0900222// android_*_stubs_current modules are the stubs libraries compiled
Anton Hansson2feb3f12020-11-13 11:44:32 +0000223// from stub sources
Jiyong Park7fb4b182019-12-20 14:35:43 +0900224/////////////////////////////////////////////////////////////////////
225
226java_defaults {
Anton Hanssonc43a66b2022-03-03 15:14:04 +0000227 name: "android.jar_defaults",
228 sdk_version: "none",
229 system_modules: "none",
230 java_version: "1.8",
231 compile_dex: true,
Anton Hanssonc43a66b2022-03-03 15:14:04 +0000232 visibility: ["//visibility:public"],
233}
234
235java_defaults {
Jihoon Kang491c7082023-06-15 18:37:01 +0000236 name: "android-non-updatable_defaults",
Anton Hanssonfbd32f32020-04-09 14:16:37 +0100237 sdk_version: "none",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900238 system_modules: "none",
239 java_version: "1.8",
240 compile_dex: true,
Jihoon Kang491c7082023-06-15 18:37:01 +0000241}
242
243java_defaults {
244 name: "android-non-updatable_from_source_defaults",
245 libs: ["stub-annotations"],
246 static_libs: ["framework-res-package-jar"], // Export package of framework-res
Anton Hanssona4108912021-04-09 13:40:11 +0100247 dist: {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000248 targets: ["sdk"],
Anton Hanssona4108912021-04-09 13:40:11 +0100249 tag: ".jar",
250 dest: "android-non-updatable.jar",
Anton Hansson240ee482021-04-14 12:52:00 +0100251 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900252}
253
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100254java_library {
Anton Hanssona4748cd2021-04-09 10:16:19 +0100255 name: "android-non-updatable.stubs",
Jihoon Kang491c7082023-06-15 18:37:01 +0000256 defaults: ["android-non-updatable_defaults"],
257 static_libs: [
258 "android-non-updatable.stubs.from-source",
259 ],
260 product_variables: {
261 build_from_text_stub: {
262 static_libs: [
263 "android-non-updatable.stubs.from-text",
264 ],
265 exclude_static_libs: [
266 "android-non-updatable.stubs.from-source",
267 ],
268 },
269 },
270}
271
272java_library {
273 name: "android-non-updatable.stubs.system",
274 defaults: ["android-non-updatable_defaults"],
275 static_libs: [
276 "android-non-updatable.stubs.system.from-source",
277 ],
278 product_variables: {
279 build_from_text_stub: {
280 static_libs: [
281 "android-non-updatable.stubs.system.from-text",
282 ],
283 exclude_static_libs: [
284 "android-non-updatable.stubs.system.from-source",
285 ],
286 },
287 },
288}
289
290java_library {
291 name: "android-non-updatable.stubs.module_lib",
292 defaults: ["android-non-updatable_defaults"],
293 static_libs: [
294 "android-non-updatable.stubs.module_lib.from-source",
295 ],
296 product_variables: {
297 build_from_text_stub: {
298 static_libs: [
299 "android-non-updatable.stubs.module_lib.from-text",
300 ],
301 exclude_static_libs: [
302 "android-non-updatable.stubs.module_lib.from-source",
303 ],
304 },
305 },
306}
307
308java_library {
309 name: "android-non-updatable.stubs.test",
310 defaults: ["android-non-updatable_defaults"],
311 static_libs: [
312 "android-non-updatable.stubs.test.from-source",
313 ],
314 product_variables: {
315 build_from_text_stub: {
316 static_libs: [
317 "android-non-updatable.stubs.test.from-text",
318 ],
319 exclude_static_libs: [
320 "android-non-updatable.stubs.test.from-source",
321 ],
322 },
323 },
324}
325
326java_library {
327 name: "android-non-updatable.stubs.from-source",
328 defaults: [
329 "android-non-updatable_defaults",
330 "android-non-updatable_from_source_defaults",
331 ],
Anton Hanssona4748cd2021-04-09 10:16:19 +0100332 srcs: [":api-stubs-docs-non-updatable"],
Anton Hanssonc6e9d2f2022-01-25 15:53:43 +0000333 libs: ["all-modules-public-stubs"],
Anton Hanssona4108912021-04-09 13:40:11 +0100334 dist: {
335 dir: "apistubs/android/public",
336 },
Anton Hanssona4748cd2021-04-09 10:16:19 +0100337}
338
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100339java_library {
Jihoon Kang491c7082023-06-15 18:37:01 +0000340 name: "android-non-updatable.stubs.system.from-source",
341 defaults: [
342 "android-non-updatable_defaults",
343 "android-non-updatable_from_source_defaults",
344 ],
Anton Hansson240ee482021-04-14 12:52:00 +0100345 srcs: [":system-api-stubs-docs-non-updatable"],
Anton Hanssonc6e9d2f2022-01-25 15:53:43 +0000346 libs: ["all-modules-system-stubs"],
Anton Hanssona4108912021-04-09 13:40:11 +0100347 dist: {
348 dir: "apistubs/android/system",
349 },
Anton Hanssona4748cd2021-04-09 10:16:19 +0100350}
351
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100352java_library {
Jihoon Kang491c7082023-06-15 18:37:01 +0000353 name: "android-non-updatable.stubs.module_lib.from-source",
354 defaults: [
355 "android-non-updatable_defaults",
356 "android-non-updatable_from_source_defaults",
357 ],
Anton Hanssona4748cd2021-04-09 10:16:19 +0100358 srcs: [":module-lib-api-stubs-docs-non-updatable"],
359 libs: [
Anton Hansson8b49d0e2023-09-28 10:30:16 +0000360 // We cannot depend on all-modules-module-lib-stubs, because the module-lib stubs
361 // depend on this stub. We resolve dependencies on APIs in modules by depending
362 // on a prebuilt of the whole platform (sdk_system_current_android).
363 // That prebuilt does not include module-lib APIs, so use the prebuilt module-lib
364 // stubs for modules that export module-lib stubs that the non-updatable part
365 // depends on.
markchiencd813a32021-11-11 00:42:55 +0800366 "sdk_module-lib_current_framework-tethering",
paulhu2a8c2c32022-02-08 21:23:06 +0800367 "sdk_module-lib_current_framework-connectivity-t",
Anton Hanssona4748cd2021-04-09 10:16:19 +0100368 "sdk_system_current_android",
Anton Hanssona4748cd2021-04-09 10:16:19 +0100369 ],
Anton Hanssona4108912021-04-09 13:40:11 +0100370 dist: {
371 dir: "apistubs/android/module-lib",
372 },
Anton Hanssona4748cd2021-04-09 10:16:19 +0100373}
374
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100375java_library {
Jihoon Kang491c7082023-06-15 18:37:01 +0000376 name: "android-non-updatable.stubs.test.from-source",
377 defaults: [
378 "android-non-updatable_defaults",
379 "android-non-updatable_from_source_defaults",
380 ],
Anton Hanssona4748cd2021-04-09 10:16:19 +0100381 srcs: [":test-api-stubs-docs-non-updatable"],
Anton Hanssonc6e9d2f2022-01-25 15:53:43 +0000382 libs: ["all-modules-system-stubs"],
Anton Hanssona4108912021-04-09 13:40:11 +0100383 dist: {
384 dir: "apistubs/android/test",
385 },
Anton Hanssona4748cd2021-04-09 10:16:19 +0100386}
387
388java_defaults {
Jihoon Kang491c7082023-06-15 18:37:01 +0000389 name: "android-non-updatable_from_text_defaults",
Jihoon Kang0c101db2023-03-14 07:03:46 +0000390 static_libs: ["framework-res-package-jar"],
391 libs: ["stub-annotations"],
392}
393
394java_api_library {
395 name: "android-non-updatable.stubs.from-text",
396 api_surface: "public",
Jihoon Kang25b6ced2023-09-20 21:48:09 +0000397 api_contributions: [
398 "api-stubs-docs-non-updatable.api.contribution",
Jihoon Kang0c101db2023-03-14 07:03:46 +0000399 ],
Jihoon Kang491c7082023-06-15 18:37:01 +0000400 defaults: ["android-non-updatable_from_text_defaults"],
Jihoon Kang12cddb32023-06-29 21:35:24 +0000401 full_api_surface_stub: "android_stubs_current.from-text",
Jihoon Kang0c101db2023-03-14 07:03:46 +0000402}
403
404java_api_library {
405 name: "android-non-updatable.stubs.system.from-text",
406 api_surface: "system",
Jihoon Kang25b6ced2023-09-20 21:48:09 +0000407 api_contributions: [
408 "api-stubs-docs-non-updatable.api.contribution",
409 "system-api-stubs-docs-non-updatable.api.contribution",
Jihoon Kang0c101db2023-03-14 07:03:46 +0000410 ],
Jihoon Kang491c7082023-06-15 18:37:01 +0000411 defaults: ["android-non-updatable_from_text_defaults"],
Jihoon Kang12cddb32023-06-29 21:35:24 +0000412 full_api_surface_stub: "android_system_stubs_current.from-text",
Jihoon Kang0c101db2023-03-14 07:03:46 +0000413}
414
415java_api_library {
416 name: "android-non-updatable.stubs.test.from-text",
417 api_surface: "test",
Jihoon Kang25b6ced2023-09-20 21:48:09 +0000418 api_contributions: [
419 "api-stubs-docs-non-updatable.api.contribution",
420 "system-api-stubs-docs-non-updatable.api.contribution",
421 "test-api-stubs-docs-non-updatable.api.contribution",
Jihoon Kang0c101db2023-03-14 07:03:46 +0000422 ],
Jihoon Kang491c7082023-06-15 18:37:01 +0000423 defaults: ["android-non-updatable_from_text_defaults"],
Jihoon Kang12cddb32023-06-29 21:35:24 +0000424 full_api_surface_stub: "android_test_stubs_current.from-text",
Jihoon Kang0c101db2023-03-14 07:03:46 +0000425}
426
427java_api_library {
428 name: "android-non-updatable.stubs.module_lib.from-text",
429 api_surface: "module_lib",
Jihoon Kang25b6ced2023-09-20 21:48:09 +0000430 api_contributions: [
431 "api-stubs-docs-non-updatable.api.contribution",
432 "system-api-stubs-docs-non-updatable.api.contribution",
433 "module-lib-api-stubs-docs-non-updatable.api.contribution",
Jihoon Kang0c101db2023-03-14 07:03:46 +0000434 ],
Jihoon Kang491c7082023-06-15 18:37:01 +0000435 defaults: ["android-non-updatable_from_text_defaults"],
Jihoon Kang12cddb32023-06-29 21:35:24 +0000436 full_api_surface_stub: "android_module_lib_stubs_current_full.from-text",
Jihoon Kang0c101db2023-03-14 07:03:46 +0000437}
438
439java_defaults {
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000440 name: "android_stubs_dists_default",
441 dist: {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000442 targets: ["sdk"],
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000443 tag: ".jar",
444 dest: "android.jar",
445 },
Anton Hansson86925682021-04-14 14:54:43 +0100446 defaults_visibility: ["//frameworks/base/services"],
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000447}
448
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100449java_library {
Jihoon Kang1453baa2023-05-27 05:32:30 +0000450 name: "android_stubs_current.from-source",
Anton Hanssonc6e9d2f2022-01-25 15:53:43 +0000451 static_libs: [
452 "all-modules-public-stubs",
Anton Hanssona4748cd2021-04-09 10:16:19 +0100453 "android-non-updatable.stubs",
Anton Hanssonbf63f942020-05-20 12:06:23 +0100454 "private-stub-annotations-jar",
Anton Hansson76d3db42020-04-09 14:16:37 +0100455 ],
Anton Hansson65057af2021-04-14 18:52:08 +0100456 defaults: ["android.jar_defaults"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900457}
458
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100459java_library {
Jihoon Kang1453baa2023-05-27 05:32:30 +0000460 name: "android_system_stubs_current.from-source",
Anton Hanssonc6e9d2f2022-01-25 15:53:43 +0000461 static_libs: [
462 "all-modules-system-stubs",
Anton Hanssona4748cd2021-04-09 10:16:19 +0100463 "android-non-updatable.stubs.system",
Anton Hanssonbf63f942020-05-20 12:06:23 +0100464 "private-stub-annotations-jar",
Anton Hansson76d3db42020-04-09 14:16:37 +0100465 ],
Anton Hanssonc3002e52020-11-18 18:23:55 +0000466 defaults: [
Anton Hansson65057af2021-04-14 18:52:08 +0100467 "android.jar_defaults",
Anton Hanssonc3002e52020-11-18 18:23:55 +0000468 "android_stubs_dists_default",
469 ],
470 dist: {
471 dir: "apistubs/android/system",
472 },
473 dists: [
474 {
475 // Legacy dist path
Anton Hanssondd8ef672022-01-04 08:53:19 +0000476 targets: ["sdk"],
Anton Hanssonc3002e52020-11-18 18:23:55 +0000477 tag: ".jar",
478 dest: "android_system.jar",
479 },
480 ],
Anton Hansson76d3db42020-04-09 14:16:37 +0100481}
482
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100483java_library {
Jihoon Kang1453baa2023-05-27 05:32:30 +0000484 name: "android_test_stubs_current.from-source",
Anton Hanssonc6e9d2f2022-01-25 15:53:43 +0000485 static_libs: [
Nikita Ioffe5593fbb2022-12-01 14:52:34 +0000486 // Updatable modules do not have test APIs, but we want to include their SystemApis, like we
487 // include the SystemApi of framework-non-updatable-sources.
488 "all-updatable-modules-system-stubs",
489 // Non-updatable modules on the other hand can have test APIs, so include their test-stubs.
490 "all-non-updatable-modules-test-stubs",
Anton Hanssona4748cd2021-04-09 10:16:19 +0100491 "android-non-updatable.stubs.test",
Anton Hansson7ce31c12020-10-15 18:38:49 +0100492 "private-stub-annotations-jar",
493 ],
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000494 defaults: [
Anton Hansson65057af2021-04-14 18:52:08 +0100495 "android.jar_defaults",
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000496 "android_stubs_dists_default",
497 ],
498 dist: {
499 dir: "apistubs/android/test",
500 },
Jiyong Parke3095162019-12-20 15:30:28 +0900501}
502
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100503java_library {
Jihoon Kang1453baa2023-05-27 05:32:30 +0000504 name: "android_module_lib_stubs_current.from-source",
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000505 defaults: [
Anton Hansson65057af2021-04-14 18:52:08 +0100506 "android.jar_defaults",
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000507 "android_stubs_dists_default",
508 ],
Anton Hanssona4748cd2021-04-09 10:16:19 +0100509 static_libs: [
510 "android-non-updatable.stubs.module_lib",
Victor Chang6b107a92021-06-17 23:49:42 +0100511 "art.module.public.api.stubs.module_lib",
Giulio Fiscella68a04112021-11-30 16:32:44 +0000512 "i18n.module.public.api.stubs",
Anton Hanssonb7d532e2021-02-05 11:40:25 +0000513 ],
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000514 dist: {
515 dir: "apistubs/android/module-lib",
516 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900517}
518
Andrei Oneafaa271a2021-03-17 13:32:51 +0000519java_library {
Jihoon Kang1453baa2023-05-27 05:32:30 +0000520 name: "android_system_server_stubs_current.from-source",
Anton Hansson21fb1082023-03-03 16:22:42 +0000521 defaults: [
522 "android.jar_defaults",
523 "android_stubs_dists_default",
524 ],
Andrei Oneafaa271a2021-03-17 13:32:51 +0000525 srcs: [":services-non-updatable-stubs"],
526 installable: false,
527 static_libs: [
Jihoon Kang1453baa2023-05-27 05:32:30 +0000528 "android_module_lib_stubs_current.from-source",
Andrei Oneafaa271a2021-03-17 13:32:51 +0000529 ],
Andrei Oneafaa271a2021-03-17 13:32:51 +0000530 dist: {
531 dir: "apistubs/android/system-server",
532 },
533}
534
Colin Crosscf87a572022-10-20 14:06:53 -0700535java_library {
536 name: "android_stubs_private_jar",
537 defaults: ["android.jar_defaults"],
538 visibility: [
539 "//visibility:override",
540 "//visibility:private",
541 ],
542 static_libs: [
543 "stable.core.platform.api.stubs",
544 "core-lambda-stubs-for-system-modules",
545 "core-generated-annotation-stubs",
546 "framework",
547 "ext",
548 "framework-res-package-jar",
549 // The order of this matters, it has to be last to provide a
550 // package-private androidx.annotation.RecentlyNonNull without
551 // overriding the public android.annotation.Nullable in framework.jar
552 // with its own package-private android.annotation.Nullable.
553 "private-stub-annotations-jar",
554 ],
555}
556
557java_genrule {
558 name: "android_stubs_private_hjar",
Colin Crosscf87a572022-10-20 14:06:53 -0700559 srcs: [":android_stubs_private_jar{.hjar}"],
560 out: ["android_stubs_private.jar"],
561 cmd: "cp $(in) $(out)",
562}
563
564java_library {
565 name: "android_stubs_private",
566 defaults: ["android_stubs_dists_default"],
Colin Crosscf87a572022-10-20 14:06:53 -0700567 sdk_version: "none",
568 system_modules: "none",
569 static_libs: ["android_stubs_private_hjar"],
570 dist: {
571 dir: "apistubs/android/private",
572 },
573}
574
575java_genrule {
576 name: "android_stubs_private_framework_aidl",
Colin Crosscf87a572022-10-20 14:06:53 -0700577 tools: ["sdkparcelables"],
578 srcs: [":android_stubs_private"],
579 out: ["framework.aidl"],
580 cmd: "rm -f $(genDir)/framework.aidl.merged && " +
581 "for i in $(in); do " +
582 " rm -f $(genDir)/framework.aidl.tmp && " +
583 " $(location sdkparcelables) $$i $(genDir)/framework.aidl.tmp && " +
584 " cat $(genDir)/framework.aidl.tmp >> $(genDir)/framework.aidl.merged; " +
585 "done && " +
586 "sort -u $(genDir)/framework.aidl.merged > $(out)",
587 dist: {
588 targets: ["sdk"],
589 dir: "apistubs/android/private",
590 },
591}
592
Jihoon Kang7b627ed2023-09-21 01:14:17 +0000593//
594// Java API defaults and libraries for single tree build
595//
596
597java_defaults {
598 name: "stub-annotation-defaults",
599 libs: [
600 "stub-annotations",
601 ],
602 static_libs: [
603 // stub annotations do not contribute to the API surfaces but are statically
604 // linked in the stubs for API surfaces (see frameworks/base/StubLibraries.bp).
605 // This is because annotation processors insist on loading the classes for any
606 // annotations found, thus should exist inside android.jar.
607 "private-stub-annotations-jar",
608 ],
609}
610
611// Listing of API domains contribution and dependencies per API surfaces
612java_defaults {
613 name: "android_test_stubs_current_contributions",
614 api_surface: "test",
615 api_contributions: [
Jihoon Kang7b627ed2023-09-21 01:14:17 +0000616 "framework-virtualization.stubs.source.test.api.contribution",
617 ],
618}
619
620java_defaults {
621 name: "android_test_frameworks_core_stubs_current_contributions",
622 api_surface: "test",
623 api_contributions: [
624 "test-api-stubs-docs-non-updatable.api.contribution",
625 ],
626}
627
628java_defaults {
629 name: "android_module_lib_stubs_current_contributions",
630 api_surface: "module-lib",
631 api_contributions: [
632 "api-stubs-docs-non-updatable.api.contribution",
633 "system-api-stubs-docs-non-updatable.api.contribution",
634 "module-lib-api-stubs-docs-non-updatable.api.contribution",
635 "art.module.public.api.stubs.source.api.contribution",
636 "art.module.public.api.stubs.source.system.api.contribution",
637 "art.module.public.api.stubs.source.module_lib.api.contribution",
638 "i18n.module.public.api.stubs.source.api.contribution",
639 "i18n.module.public.api.stubs.source.system.api.contribution",
640 "i18n.module.public.api.stubs.source.module_lib.api.contribution",
641 ],
642}
643
644// Java API library definitions per API surface
645java_api_library {
646 name: "android_stubs_current.from-text",
647 api_surface: "public",
648 defaults: [
649 // This module is dynamically created at frameworks/base/api/api.go
650 // instead of being written out, in order to minimize edits in the codebase
651 // when there is a change in the list of modules.
652 // that contributes to an api surface.
653 "android_stubs_current_contributions",
654 "stub-annotation-defaults",
655 ],
656 api_contributions: [
657 "api-stubs-docs-non-updatable.api.contribution",
658 ],
659 visibility: ["//visibility:public"],
660}
661
662java_api_library {
663 name: "android_system_stubs_current.from-text",
664 api_surface: "system",
665 defaults: [
666 "android_stubs_current_contributions",
667 "android_system_stubs_current_contributions",
668 "stub-annotation-defaults",
669 ],
670 api_contributions: [
671 "api-stubs-docs-non-updatable.api.contribution",
672 "system-api-stubs-docs-non-updatable.api.contribution",
673 ],
674 visibility: ["//visibility:public"],
675}
676
677java_api_library {
678 name: "android_test_stubs_current.from-text",
679 api_surface: "test",
680 defaults: [
681 "android_stubs_current_contributions",
682 "android_system_stubs_current_contributions",
683 "android_test_stubs_current_contributions",
684 "stub-annotation-defaults",
685 ],
686 api_contributions: [
687 "api-stubs-docs-non-updatable.api.contribution",
688 "system-api-stubs-docs-non-updatable.api.contribution",
Jihoon Kang1c5022b2023-09-20 22:02:29 +0000689 "test-api-stubs-docs-non-updatable.api.contribution",
Jihoon Kang7b627ed2023-09-21 01:14:17 +0000690 ],
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}