blob: 79efaced998acf396507f1a1a1b289cfe169fed9 [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
Jihoon Kang4683b142023-10-05 23:42:51 +0000439// This module generates a stub jar that is a union of the test and module lib
440// non-updatable api contributions. Modules should not depend on the stub jar
441// generated from this module, as this module is strictly used for hiddenapi only.
442java_api_library {
443 name: "android-non-updatable.stubs.test_module_lib",
444 api_surface: "module_lib",
445 api_contributions: [
446 "api-stubs-docs-non-updatable.api.contribution",
447 "system-api-stubs-docs-non-updatable.api.contribution",
448 "test-api-stubs-docs-non-updatable.api.contribution",
449 "module-lib-api-stubs-docs-non-updatable.api.contribution",
450 ],
451 defaults: ["android-non-updatable_from_text_defaults"],
452 full_api_surface_stub: "android_test_module_lib_stubs_current.from-text",
453
454 // This module is only used for hiddenapi, and other modules should not
455 // depend on this module.
456 visibility: ["//visibility:private"],
457}
458
Jihoon Kang0c101db2023-03-14 07:03:46 +0000459java_defaults {
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000460 name: "android_stubs_dists_default",
461 dist: {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000462 targets: ["sdk"],
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000463 tag: ".jar",
464 dest: "android.jar",
465 },
Anton Hansson86925682021-04-14 14:54:43 +0100466 defaults_visibility: ["//frameworks/base/services"],
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000467}
468
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100469java_library {
Jihoon Kang1453baa2023-05-27 05:32:30 +0000470 name: "android_stubs_current.from-source",
Anton Hanssonc6e9d2f2022-01-25 15:53:43 +0000471 static_libs: [
472 "all-modules-public-stubs",
Anton Hanssona4748cd2021-04-09 10:16:19 +0100473 "android-non-updatable.stubs",
Anton Hanssonbf63f942020-05-20 12:06:23 +0100474 "private-stub-annotations-jar",
Anton Hansson76d3db42020-04-09 14:16:37 +0100475 ],
Anton Hansson65057af2021-04-14 18:52:08 +0100476 defaults: ["android.jar_defaults"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900477}
478
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100479java_library {
Jihoon Kang1453baa2023-05-27 05:32:30 +0000480 name: "android_system_stubs_current.from-source",
Anton Hanssonc6e9d2f2022-01-25 15:53:43 +0000481 static_libs: [
482 "all-modules-system-stubs",
Anton Hanssona4748cd2021-04-09 10:16:19 +0100483 "android-non-updatable.stubs.system",
Anton Hanssonbf63f942020-05-20 12:06:23 +0100484 "private-stub-annotations-jar",
Anton Hansson76d3db42020-04-09 14:16:37 +0100485 ],
Anton Hanssonc3002e52020-11-18 18:23:55 +0000486 defaults: [
Anton Hansson65057af2021-04-14 18:52:08 +0100487 "android.jar_defaults",
Anton Hanssonc3002e52020-11-18 18:23:55 +0000488 "android_stubs_dists_default",
489 ],
490 dist: {
491 dir: "apistubs/android/system",
492 },
493 dists: [
494 {
495 // Legacy dist path
Anton Hanssondd8ef672022-01-04 08:53:19 +0000496 targets: ["sdk"],
Anton Hanssonc3002e52020-11-18 18:23:55 +0000497 tag: ".jar",
498 dest: "android_system.jar",
499 },
500 ],
Anton Hansson76d3db42020-04-09 14:16:37 +0100501}
502
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100503java_library {
Jihoon Kang1453baa2023-05-27 05:32:30 +0000504 name: "android_test_stubs_current.from-source",
Anton Hanssonc6e9d2f2022-01-25 15:53:43 +0000505 static_libs: [
Nikita Ioffe5593fbb2022-12-01 14:52:34 +0000506 // Updatable modules do not have test APIs, but we want to include their SystemApis, like we
507 // include the SystemApi of framework-non-updatable-sources.
508 "all-updatable-modules-system-stubs",
509 // Non-updatable modules on the other hand can have test APIs, so include their test-stubs.
510 "all-non-updatable-modules-test-stubs",
Anton Hanssona4748cd2021-04-09 10:16:19 +0100511 "android-non-updatable.stubs.test",
Anton Hansson7ce31c12020-10-15 18:38:49 +0100512 "private-stub-annotations-jar",
513 ],
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000514 defaults: [
Anton Hansson65057af2021-04-14 18:52:08 +0100515 "android.jar_defaults",
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000516 "android_stubs_dists_default",
517 ],
518 dist: {
519 dir: "apistubs/android/test",
520 },
Jiyong Parke3095162019-12-20 15:30:28 +0900521}
522
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100523java_library {
Jihoon Kang1453baa2023-05-27 05:32:30 +0000524 name: "android_module_lib_stubs_current.from-source",
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000525 defaults: [
Anton Hansson65057af2021-04-14 18:52:08 +0100526 "android.jar_defaults",
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000527 "android_stubs_dists_default",
528 ],
Anton Hanssona4748cd2021-04-09 10:16:19 +0100529 static_libs: [
530 "android-non-updatable.stubs.module_lib",
Victor Chang6b107a92021-06-17 23:49:42 +0100531 "art.module.public.api.stubs.module_lib",
Giulio Fiscella68a04112021-11-30 16:32:44 +0000532 "i18n.module.public.api.stubs",
Anton Hanssonb7d532e2021-02-05 11:40:25 +0000533 ],
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000534 dist: {
535 dir: "apistubs/android/module-lib",
536 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900537}
538
Andrei Oneafaa271a2021-03-17 13:32:51 +0000539java_library {
Jihoon Kang1453baa2023-05-27 05:32:30 +0000540 name: "android_system_server_stubs_current.from-source",
Anton Hansson21fb1082023-03-03 16:22:42 +0000541 defaults: [
542 "android.jar_defaults",
543 "android_stubs_dists_default",
544 ],
Andrei Oneafaa271a2021-03-17 13:32:51 +0000545 srcs: [":services-non-updatable-stubs"],
546 installable: false,
547 static_libs: [
Jihoon Kang1453baa2023-05-27 05:32:30 +0000548 "android_module_lib_stubs_current.from-source",
Andrei Oneafaa271a2021-03-17 13:32:51 +0000549 ],
Andrei Oneafaa271a2021-03-17 13:32:51 +0000550 dist: {
551 dir: "apistubs/android/system-server",
552 },
553}
554
Colin Crosscf87a572022-10-20 14:06:53 -0700555java_library {
556 name: "android_stubs_private_jar",
557 defaults: ["android.jar_defaults"],
558 visibility: [
559 "//visibility:override",
560 "//visibility:private",
561 ],
562 static_libs: [
563 "stable.core.platform.api.stubs",
564 "core-lambda-stubs-for-system-modules",
565 "core-generated-annotation-stubs",
566 "framework",
567 "ext",
568 "framework-res-package-jar",
569 // The order of this matters, it has to be last to provide a
570 // package-private androidx.annotation.RecentlyNonNull without
571 // overriding the public android.annotation.Nullable in framework.jar
572 // with its own package-private android.annotation.Nullable.
573 "private-stub-annotations-jar",
574 ],
575}
576
577java_genrule {
578 name: "android_stubs_private_hjar",
Colin Crosscf87a572022-10-20 14:06:53 -0700579 srcs: [":android_stubs_private_jar{.hjar}"],
580 out: ["android_stubs_private.jar"],
581 cmd: "cp $(in) $(out)",
582}
583
584java_library {
585 name: "android_stubs_private",
586 defaults: ["android_stubs_dists_default"],
Colin Crosscf87a572022-10-20 14:06:53 -0700587 sdk_version: "none",
588 system_modules: "none",
589 static_libs: ["android_stubs_private_hjar"],
590 dist: {
591 dir: "apistubs/android/private",
592 },
593}
594
595java_genrule {
596 name: "android_stubs_private_framework_aidl",
Colin Crosscf87a572022-10-20 14:06:53 -0700597 tools: ["sdkparcelables"],
598 srcs: [":android_stubs_private"],
599 out: ["framework.aidl"],
600 cmd: "rm -f $(genDir)/framework.aidl.merged && " +
601 "for i in $(in); do " +
602 " rm -f $(genDir)/framework.aidl.tmp && " +
603 " $(location sdkparcelables) $$i $(genDir)/framework.aidl.tmp && " +
604 " cat $(genDir)/framework.aidl.tmp >> $(genDir)/framework.aidl.merged; " +
605 "done && " +
606 "sort -u $(genDir)/framework.aidl.merged > $(out)",
607 dist: {
608 targets: ["sdk"],
609 dir: "apistubs/android/private",
610 },
611}
612
Jihoon Kang7b627ed2023-09-21 01:14:17 +0000613//
614// Java API defaults and libraries for single tree build
615//
616
617java_defaults {
618 name: "stub-annotation-defaults",
619 libs: [
620 "stub-annotations",
621 ],
622 static_libs: [
623 // stub annotations do not contribute to the API surfaces but are statically
624 // linked in the stubs for API surfaces (see frameworks/base/StubLibraries.bp).
625 // This is because annotation processors insist on loading the classes for any
626 // annotations found, thus should exist inside android.jar.
627 "private-stub-annotations-jar",
628 ],
629}
630
631// Listing of API domains contribution and dependencies per API surfaces
632java_defaults {
633 name: "android_test_stubs_current_contributions",
634 api_surface: "test",
635 api_contributions: [
Jihoon Kang7b627ed2023-09-21 01:14:17 +0000636 "framework-virtualization.stubs.source.test.api.contribution",
637 ],
638}
639
640java_defaults {
641 name: "android_test_frameworks_core_stubs_current_contributions",
642 api_surface: "test",
643 api_contributions: [
644 "test-api-stubs-docs-non-updatable.api.contribution",
645 ],
646}
647
648java_defaults {
649 name: "android_module_lib_stubs_current_contributions",
650 api_surface: "module-lib",
651 api_contributions: [
652 "api-stubs-docs-non-updatable.api.contribution",
653 "system-api-stubs-docs-non-updatable.api.contribution",
654 "module-lib-api-stubs-docs-non-updatable.api.contribution",
655 "art.module.public.api.stubs.source.api.contribution",
656 "art.module.public.api.stubs.source.system.api.contribution",
657 "art.module.public.api.stubs.source.module_lib.api.contribution",
658 "i18n.module.public.api.stubs.source.api.contribution",
659 "i18n.module.public.api.stubs.source.system.api.contribution",
660 "i18n.module.public.api.stubs.source.module_lib.api.contribution",
661 ],
662}
663
664// Java API library definitions per API surface
665java_api_library {
666 name: "android_stubs_current.from-text",
667 api_surface: "public",
668 defaults: [
669 // This module is dynamically created at frameworks/base/api/api.go
670 // instead of being written out, in order to minimize edits in the codebase
671 // when there is a change in the list of modules.
672 // that contributes to an api surface.
673 "android_stubs_current_contributions",
674 "stub-annotation-defaults",
675 ],
676 api_contributions: [
677 "api-stubs-docs-non-updatable.api.contribution",
678 ],
679 visibility: ["//visibility:public"],
680}
681
682java_api_library {
683 name: "android_system_stubs_current.from-text",
684 api_surface: "system",
685 defaults: [
686 "android_stubs_current_contributions",
687 "android_system_stubs_current_contributions",
688 "stub-annotation-defaults",
689 ],
690 api_contributions: [
691 "api-stubs-docs-non-updatable.api.contribution",
692 "system-api-stubs-docs-non-updatable.api.contribution",
693 ],
694 visibility: ["//visibility:public"],
695}
696
697java_api_library {
698 name: "android_test_stubs_current.from-text",
699 api_surface: "test",
700 defaults: [
701 "android_stubs_current_contributions",
702 "android_system_stubs_current_contributions",
703 "android_test_stubs_current_contributions",
704 "stub-annotation-defaults",
705 ],
706 api_contributions: [
707 "api-stubs-docs-non-updatable.api.contribution",
708 "system-api-stubs-docs-non-updatable.api.contribution",
Jihoon Kang1c5022b2023-09-20 22:02:29 +0000709 "test-api-stubs-docs-non-updatable.api.contribution",
Jihoon Kang7b627ed2023-09-21 01:14:17 +0000710 ],
711 visibility: ["//visibility:public"],
712}
713
714java_api_library {
715 name: "android_test_frameworks_core_stubs_current.from-text",
716 api_surface: "test",
717 defaults: [
718 "android_stubs_current_contributions",
719 "android_system_stubs_current_contributions",
720 "android_test_frameworks_core_stubs_current_contributions",
721 "stub-annotation-defaults",
722 ],
723 api_contributions: [
724 "api-stubs-docs-non-updatable.api.contribution",
725 "system-api-stubs-docs-non-updatable.api.contribution",
726 ],
727}
728
729java_api_library {
730 name: "android_module_lib_stubs_current_full.from-text",
731 api_surface: "module-lib",
732 defaults: [
733 "android_stubs_current_contributions",
734 "android_system_stubs_current_contributions",
735 "android_module_lib_stubs_current_contributions_full",
736 ],
737 libs: [
738 "stub-annotations",
739 ],
740 api_contributions: [
741 "api-stubs-docs-non-updatable.api.contribution",
742 "system-api-stubs-docs-non-updatable.api.contribution",
743 "module-lib-api-stubs-docs-non-updatable.api.contribution",
744 ],
745 visibility: ["//visibility:public"],
746}
747
748java_api_library {
749 name: "android_module_lib_stubs_current.from-text",
750 api_surface: "module-lib",
751 defaults: [
752 "android_module_lib_stubs_current_contributions",
753 ],
754 libs: [
755 "android_module_lib_stubs_current_full.from-text",
756 "stub-annotations",
757 ],
758 visibility: ["//visibility:public"],
759}
760
761java_api_library {
Jihoon Kang4683b142023-10-05 23:42:51 +0000762 name: "android_test_module_lib_stubs_current.from-text",
763 api_surface: "module-lib",
764 defaults: [
765 "android_stubs_current_contributions",
766 "android_system_stubs_current_contributions",
767 "android_test_stubs_current_contributions",
768 "android_module_lib_stubs_current_contributions",
769 ],
770 libs: [
771 "android_module_lib_stubs_current_full.from-text",
772 "stub-annotations",
773 ],
774 api_contributions: [
775 "test-api-stubs-docs-non-updatable.api.contribution",
776 ],
777
778 // This module is only used to build android-non-updatable.stubs.test_module_lib
779 // and other modules should not depend on this module.
780 visibility: [
781 "//visibility:private",
782 ],
783}
784
785java_api_library {
Jihoon Kang7b627ed2023-09-21 01:14:17 +0000786 name: "android_system_server_stubs_current.from-text",
787 api_surface: "system-server",
788 api_contributions: [
789 "services-non-updatable-stubs.api.contribution",
790 ],
791 libs: [
792 "android_module_lib_stubs_current.from-text",
793 "stub-annotations",
794 ],
795 static_libs: [
796 "android_module_lib_stubs_current.from-text",
797 ],
798 visibility: ["//visibility:public"],
799}
800
Anton Hansson36bc27c2021-09-14 15:45:13 +0100801////////////////////////////////////////////////////////////////////////
802// api-versions.xml generation, for public and system. This API database
803// also contains the android.test.* APIs.
804////////////////////////////////////////////////////////////////////////
805
806java_library {
807 name: "android_stubs_current_with_test_libs",
808 static_libs: [
809 "android_stubs_current",
810 "android.test.base.stubs",
811 "android.test.mock.stubs",
812 "android.test.runner.stubs",
813 ],
814 defaults: ["android.jar_defaults"],
815 visibility: [
816 "//visibility:override",
817 "//visibility:private",
818 ],
819}
820
821java_library {
822 name: "android_system_stubs_current_with_test_libs",
823 static_libs: [
824 "android_system_stubs_current",
825 "android.test.base.stubs.system",
826 "android.test.mock.stubs.system",
827 "android.test.runner.stubs.system",
828 ],
829 defaults: ["android.jar_defaults"],
830 visibility: [
831 "//visibility:override",
832 "//visibility:private",
833 ],
834}
835
Cole Faustdcda3702022-10-04 14:46:35 -0700836java_library {
837 name: "android_module_stubs_current_with_test_libs",
838 static_libs: [
839 "android_module_lib_stubs_current",
840 "android.test.base.stubs",
841 "android.test.mock.stubs",
842 "android.test.runner.stubs",
843 ],
844 defaults: ["android.jar_defaults"],
845 visibility: [
846 "//visibility:override",
847 "//visibility:private",
848 ],
849}
850
851java_library {
852 name: "android_system_server_stubs_current_with_test_libs",
853 static_libs: [
854 "android_system_server_stubs_current",
855 "android.test.base.stubs.system",
856 "android.test.mock.stubs.system",
857 "android.test.runner.stubs.system",
858 ],
859 defaults: ["android.jar_defaults"],
860 visibility: [
861 "//visibility:override",
862 "//visibility:private",
863 ],
864}
865
Anton Hansson36bc27c2021-09-14 15:45:13 +0100866droidstubs {
867 name: "api_versions_public",
868 srcs: [":android_stubs_current_with_test_libs{.jar}"],
869 generate_stubs: false,
870 api_levels_annotations_enabled: true,
871 api_levels_annotations_dirs: [
872 "sdk-dir",
873 "api-versions-jars-dir",
874 ],
Cole Faustdcda3702022-10-04 14:46:35 -0700875 api_levels_sdk_type: "public",
Mårten Kongstad54845332022-09-06 15:50:37 +0200876 extensions_info_file: ":sdk-extensions-info",
Anton Hanssonca6e67a2023-03-03 17:55:09 +0000877 visibility: ["//frameworks/base"],
Anton Hansson36bc27c2021-09-14 15:45:13 +0100878}
879
880droidstubs {
881 name: "api_versions_system",
882 srcs: [":android_system_stubs_current_with_test_libs{.jar}"],
883 generate_stubs: false,
884 api_levels_annotations_enabled: true,
885 api_levels_annotations_dirs: [
886 "sdk-dir",
887 "api-versions-jars-dir",
888 ],
889 api_levels_sdk_type: "system",
Mårten Kongstad54845332022-09-06 15:50:37 +0200890 extensions_info_file: ":sdk-extensions-info",
Anton Hansson36bc27c2021-09-14 15:45:13 +0100891}
892
Cole Faustbf4ce752023-02-08 12:46:06 -0800893// This module can be built with:
894// m out/soong/.intermediates/frameworks/base/api_versions_module_lib/android_common/metalava/api-versions.xml
Cole Faustdcda3702022-10-04 14:46:35 -0700895droidstubs {
896 name: "api_versions_module_lib",
897 srcs: [":android_module_stubs_current_with_test_libs{.jar}"],
898 generate_stubs: false,
899 api_levels_annotations_enabled: true,
Cole Faustbf4ce752023-02-08 12:46:06 -0800900 // this only has the non-updatable portions of the module lib sdk,
901 // which can reference classes from updatable apexes, so remove references to them
902 // from this api_versions file.
903 flags: ["--remove-missing-class-references-in-api-levels"],
Cole Faustdcda3702022-10-04 14:46:35 -0700904 api_levels_annotations_dirs: [
905 "sdk-dir",
906 "api-versions-jars-dir",
907 ],
908 api_levels_sdk_type: "module-lib",
Cole Faust1deced12023-02-15 13:24:18 -0800909 // extensions_info_file is purposefully omitted, because this module should just be
910 // the non-updatable portions of the sdk, and extension sdks are updatable.
Cole Faustdcda3702022-10-04 14:46:35 -0700911}
912
913droidstubs {
914 name: "api_versions_system_server",
915 srcs: [":android_system_server_stubs_current_with_test_libs{.jar}"],
916 generate_stubs: false,
917 api_levels_annotations_enabled: true,
Cole Faustbf4ce752023-02-08 12:46:06 -0800918 // this only has the non-updatable portions of the system server sdk,
919 // which can reference classes from updatable apexes, so remove references to them
920 // from this api_versions file.
921 flags: ["--remove-missing-class-references-in-api-levels"],
Cole Faustdcda3702022-10-04 14:46:35 -0700922 api_levels_annotations_dirs: [
923 "sdk-dir",
924 "api-versions-jars-dir",
925 ],
926 api_levels_sdk_type: "system-server",
Cole Faust1deced12023-02-15 13:24:18 -0800927 // extensions_info_file is purposefully omitted, because this module should just be
928 // the non-updatable portions of the sdk, and extension sdks are updatable.
Cole Faustdcda3702022-10-04 14:46:35 -0700929}
930
Jiyong Park7fb4b182019-12-20 14:35:43 +0900931/////////////////////////////////////////////////////////////////////
932// hwbinder.stubs provides APIs required for building HIDL Java
933// libraries.
934/////////////////////////////////////////////////////////////////////
935
936droidstubs {
937 name: "hwbinder-stubs-docs",
Anton Hansson23f319f2023-03-03 16:04:02 +0000938 srcs: [":hwbinder-stubs-srcs"],
Colin Cross037d7fb2021-03-25 17:01:55 -0700939 libs: ["framework-annotations-lib"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900940 installable: false,
941 sdk_version: "core_platform",
942 annotations_enabled: true,
Anton Hansson48ee95e2020-05-02 17:49:26 +0100943 previous_api: ":android.api.public.latest",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900944 merge_annotations_dirs: [
945 "metalava-manual",
946 ],
Anton Hansson81969c22020-02-03 20:45:56 +0000947 args: priv_apps,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900948}
949
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100950java_library {
Jiyong Park7fb4b182019-12-20 14:35:43 +0900951 name: "hwbinder.stubs",
952 sdk_version: "core_current",
Colin Cross037d7fb2021-03-25 17:01:55 -0700953 libs: ["framework-annotations-lib"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900954 srcs: [
955 ":hwbinder-stubs-docs",
956 ],
Anton Hansson86925682021-04-14 14:54:43 +0100957 visibility: ["//visibility:public"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900958}