blob: e5e0ad377b033f01f9399d292a32569bcbc33612 [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 Kammer01544b92023-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 ],
Adrian Roos7da1d252023-09-20 10:03:31 +000039 args: metalava_framework_docs_args,
Anton Hansson76d3db42020-04-09 14:16:37 +010040 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",
Adrian Roos38dd1612023-09-06 14:45:35 +000053 baseline_file: ":non-updatable-lint-baseline.txt",
Anton Hansson76d3db42020-04-09 14:16:37 +010054 },
55 },
Anton Hansson85785fe2021-01-20 20:23:34 +000056 dists: [
57 {
Anton Hanssondd8ef672022-01-04 08:53:19 +000058 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +000059 dir: "apistubs/android/public/api",
60 dest: "android-non-updatable.txt",
61 tag: ".api.txt",
62 },
63 {
Anton Hanssondd8ef672022-01-04 08:53:19 +000064 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +000065 dir: "apistubs/android/public/api",
66 dest: "android-non-updatable-removed.txt",
67 tag: ".removed-api.txt",
68 },
69 ],
Jihoon Kang866b9b7a2023-09-20 22:28:05 +000070 api_surface: "public",
Anton Hansson76d3db42020-04-09 14:16:37 +010071}
72
Anton Hansson240ee482021-04-14 12:52:00 +010073priv_apps = " --show-annotation android.annotation.SystemApi\\(" +
74 "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
Anton Hansson2feb3f12020-11-13 11:44:32 +000075 "\\)"
76
Anton Hansson240ee482021-04-14 12:52:00 +010077priv_apps_in_stubs = " --show-for-stub-purposes-annotation android.annotation.SystemApi\\(" +
78 "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
Anton Hansson2feb3f12020-11-13 11:44:32 +000079 "\\)"
80
Adrian Roos7da1d252023-09-20 10:03:31 +000081test = " --show-annotation android.annotation.TestApi"
Anton Hansson2feb3f12020-11-13 11:44:32 +000082
Anton Hansson240ee482021-04-14 12:52:00 +010083module_libs = " --show-annotation android.annotation.SystemApi\\(" +
84 "client=android.annotation.SystemApi.Client.MODULE_LIBRARIES" +
Anton Hansson2feb3f12020-11-13 11:44:32 +000085 "\\)"
Anton Hansson81969c22020-02-03 20:45:56 +000086
Jiyong Park7fb4b182019-12-20 14:35:43 +090087droidstubs {
Anton Hansson76d3db42020-04-09 14:16:37 +010088 name: "system-api-stubs-docs-non-updatable",
Mårten Kongstad162ae2a2023-09-25 14:09:11 +020089 srcs: [
90 ":framework-minus-apex-aconfig-srcjars",
91 ],
Anton Hansson9dce8322022-01-24 14:14:33 +000092 defaults: [
93 "android-non-updatable-stubs-defaults",
94 "module-classpath-stubs-defaults",
95 ],
Anton Hansson76d3db42020-04-09 14:16:37 +010096 args: metalava_framework_docs_args + priv_apps,
97 check_api: {
98 current: {
Anton Hanssonb7cda922023-03-03 15:38:28 +000099 api_file: ":non-updatable-system-current.txt",
100 removed_api_file: ":non-updatable-system-removed.txt",
Anton Hansson76d3db42020-04-09 14:16:37 +0100101 },
Anton Hansson37e102e2020-10-05 16:42:40 +0100102 last_released: {
103 api_file: ":android-non-updatable.api.system.latest",
104 removed_api_file: ":android-non-updatable-removed.api.system.latest",
Anton Hansson240ee482021-04-14 12:52:00 +0100105 baseline_file: ":android-non-updatable-incompatibilities.api.system.latest",
Anton Hansson37e102e2020-10-05 16:42:40 +0100106 },
Anton Hansson76d3db42020-04-09 14:16:37 +0100107 api_lint: {
108 enabled: true,
Anton Hansson4f90aa52021-06-04 22:23:59 +0100109 new_since: ":android.api.system.latest",
Anton Hanssonb7cda922023-03-03 15:38:28 +0000110 baseline_file: ":non-updatable-system-lint-baseline.txt",
Anton Hansson76d3db42020-04-09 14:16:37 +0100111 },
112 },
Anton Hansson85785fe2021-01-20 20:23:34 +0000113 dists: [
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.txt",
118 tag: ".api.txt",
119 },
120 {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000121 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +0000122 dir: "apistubs/android/system/api",
123 dest: "android-non-updatable-removed.txt",
124 tag: ".removed-api.txt",
125 },
126 ],
Jihoon Kang866b9b7a2023-09-20 22:28:05 +0000127 api_surface: "system",
Anton Hansson76d3db42020-04-09 14:16:37 +0100128}
129
130droidstubs {
Anton Hansson022aac52020-11-05 10:45:13 +0000131 name: "test-api-stubs-docs-non-updatable",
Mårten Kongstad162ae2a2023-09-25 14:09:11 +0200132 srcs: [
133 ":framework-minus-apex-aconfig-srcjars",
134 ],
Anton Hansson9dce8322022-01-24 14:14:33 +0000135 defaults: [
136 "android-non-updatable-stubs-defaults",
137 "module-classpath-stubs-defaults",
138 ],
Anton Hansson2feb3f12020-11-13 11:44:32 +0000139 args: metalava_framework_docs_args + test + priv_apps_in_stubs,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900140 check_api: {
141 current: {
Anton Hanssonb7cda922023-03-03 15:38:28 +0000142 api_file: ":non-updatable-test-current.txt",
143 removed_api_file: ":non-updatable-test-removed.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900144 },
145 api_lint: {
146 enabled: true,
Adrian Roos7da1d252023-09-20 10:03:31 +0000147 new_since: ":android.api.test.latest",
Anton Hanssonb7cda922023-03-03 15:38:28 +0000148 baseline_file: ":non-updatable-test-lint-baseline.txt",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900149 },
150 },
Anton Hansson85785fe2021-01-20 20:23:34 +0000151 dists: [
152 {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000153 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +0000154 dir: "apistubs/android/test/api",
155 dest: "android.txt",
156 tag: ".api.txt",
157 },
158 {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000159 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +0000160 dir: "apistubs/android/test/api",
161 dest: "removed.txt",
162 tag: ".removed-api.txt",
163 },
164 {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000165 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +0000166 dir: "apistubs/android/test/api",
167 dest: "android-non-updatable.txt",
168 tag: ".api.txt",
169 },
170 {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000171 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +0000172 dir: "apistubs/android/test/api",
173 dest: "android-non-updatable-removed.txt",
174 tag: ".removed-api.txt",
175 },
176 ],
Jihoon Kang866b9b7a2023-09-20 22:28:05 +0000177 api_surface: "test",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900178}
179
Jiyong Parke3095162019-12-20 15:30:28 +0900180droidstubs {
Anton Hansson76d3db42020-04-09 14:16:37 +0100181 name: "module-lib-api-stubs-docs-non-updatable",
Mårten Kongstad162ae2a2023-09-25 14:09:11 +0200182 srcs: [
183 ":framework-minus-apex-aconfig-srcjars",
184 ],
Anton Hansson9dce8322022-01-24 14:14:33 +0000185 defaults: [
186 "android-non-updatable-stubs-defaults",
187 "module-classpath-stubs-defaults",
188 ],
Anton Hansson2feb3f12020-11-13 11:44:32 +0000189 args: metalava_framework_docs_args + priv_apps_in_stubs + module_libs,
Anton Hansson76d3db42020-04-09 14:16:37 +0100190 check_api: {
191 current: {
Anton Hanssonb7cda922023-03-03 15:38:28 +0000192 api_file: ":non-updatable-module-lib-current.txt",
193 removed_api_file: ":non-updatable-module-lib-removed.txt",
Anton Hansson76d3db42020-04-09 14:16:37 +0100194 },
Anton Hanssonc3ef1f562020-10-07 14:55:36 +0100195 last_released: {
196 api_file: ":android-non-updatable.api.module-lib.latest",
197 removed_api_file: ":android-non-updatable-removed.api.module-lib.latest",
Junyu Lai2dbb1772022-01-12 17:38:02 +0000198 baseline_file: ":android-non-updatable-incompatibilities.api.module-lib.latest",
Anton Hanssonc3ef1f562020-10-07 14:55:36 +0100199 },
Anton Hansson76d3db42020-04-09 14:16:37 +0100200 api_lint: {
201 enabled: true,
Anton Hansson4f90aa52021-06-04 22:23:59 +0100202 new_since: ":android.api.module-lib.latest",
Anton Hanssonb7cda922023-03-03 15:38:28 +0000203 baseline_file: ":non-updatable-module-lib-lint-baseline.txt",
Anton Hansson76d3db42020-04-09 14:16:37 +0100204 },
205 },
Anton Hansson85785fe2021-01-20 20:23:34 +0000206 dists: [
207 {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000208 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +0000209 dir: "apistubs/android/module-lib/api",
210 dest: "android-non-updatable.txt",
211 tag: ".api.txt",
212 },
213 {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000214 targets: ["sdk"],
Anton Hansson85785fe2021-01-20 20:23:34 +0000215 dir: "apistubs/android/module-lib/api",
216 dest: "android-non-updatable-removed.txt",
217 tag: ".removed-api.txt",
218 },
219 ],
Jihoon Kang866b9b7a2023-09-20 22:28:05 +0000220 api_surface: "module-lib",
Anton Hansson76d3db42020-04-09 14:16:37 +0100221}
Anton Hansson81969c22020-02-03 20:45:56 +0000222
Jiyong Parke3095162019-12-20 15:30:28 +0900223/////////////////////////////////////////////////////////////////////
Jiyong Park7fb4b182019-12-20 14:35:43 +0900224// android_*_stubs_current modules are the stubs libraries compiled
Anton Hansson2feb3f12020-11-13 11:44:32 +0000225// from stub sources
Jiyong Park7fb4b182019-12-20 14:35:43 +0900226/////////////////////////////////////////////////////////////////////
227
228java_defaults {
Anton Hanssonc43a66b2022-03-03 15:14:04 +0000229 name: "android.jar_defaults",
230 sdk_version: "none",
231 system_modules: "none",
232 java_version: "1.8",
233 compile_dex: true,
Anton Hanssonc43a66b2022-03-03 15:14:04 +0000234 visibility: ["//visibility:public"],
235}
236
237java_defaults {
Jihoon Kang491c7082023-06-15 18:37:01 +0000238 name: "android-non-updatable_defaults",
Anton Hanssonfbd32f32020-04-09 14:16:37 +0100239 sdk_version: "none",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900240 system_modules: "none",
241 java_version: "1.8",
242 compile_dex: true,
Jihoon Kang491c7082023-06-15 18:37:01 +0000243}
244
245java_defaults {
246 name: "android-non-updatable_from_source_defaults",
247 libs: ["stub-annotations"],
248 static_libs: ["framework-res-package-jar"], // Export package of framework-res
Anton Hanssona4108912021-04-09 13:40:11 +0100249 dist: {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000250 targets: ["sdk"],
Anton Hanssona4108912021-04-09 13:40:11 +0100251 tag: ".jar",
252 dest: "android-non-updatable.jar",
Anton Hansson240ee482021-04-14 12:52:00 +0100253 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900254}
255
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100256java_library {
Anton Hanssona4748cd2021-04-09 10:16:19 +0100257 name: "android-non-updatable.stubs",
Jihoon Kang491c7082023-06-15 18:37:01 +0000258 defaults: ["android-non-updatable_defaults"],
259 static_libs: [
260 "android-non-updatable.stubs.from-source",
261 ],
262 product_variables: {
263 build_from_text_stub: {
264 static_libs: [
265 "android-non-updatable.stubs.from-text",
266 ],
267 exclude_static_libs: [
268 "android-non-updatable.stubs.from-source",
269 ],
270 },
271 },
272}
273
274java_library {
275 name: "android-non-updatable.stubs.system",
276 defaults: ["android-non-updatable_defaults"],
277 static_libs: [
278 "android-non-updatable.stubs.system.from-source",
279 ],
280 product_variables: {
281 build_from_text_stub: {
282 static_libs: [
283 "android-non-updatable.stubs.system.from-text",
284 ],
285 exclude_static_libs: [
286 "android-non-updatable.stubs.system.from-source",
287 ],
288 },
289 },
290}
291
292java_library {
293 name: "android-non-updatable.stubs.module_lib",
294 defaults: ["android-non-updatable_defaults"],
295 static_libs: [
296 "android-non-updatable.stubs.module_lib.from-source",
297 ],
298 product_variables: {
299 build_from_text_stub: {
300 static_libs: [
301 "android-non-updatable.stubs.module_lib.from-text",
302 ],
303 exclude_static_libs: [
304 "android-non-updatable.stubs.module_lib.from-source",
305 ],
306 },
307 },
308}
309
310java_library {
311 name: "android-non-updatable.stubs.test",
312 defaults: ["android-non-updatable_defaults"],
313 static_libs: [
314 "android-non-updatable.stubs.test.from-source",
315 ],
316 product_variables: {
317 build_from_text_stub: {
318 static_libs: [
319 "android-non-updatable.stubs.test.from-text",
320 ],
321 exclude_static_libs: [
322 "android-non-updatable.stubs.test.from-source",
323 ],
324 },
325 },
326}
327
328java_library {
329 name: "android-non-updatable.stubs.from-source",
330 defaults: [
331 "android-non-updatable_defaults",
332 "android-non-updatable_from_source_defaults",
333 ],
Anton Hanssona4748cd2021-04-09 10:16:19 +0100334 srcs: [":api-stubs-docs-non-updatable"],
Anton Hanssonc6e9d2f2022-01-25 15:53:43 +0000335 libs: ["all-modules-public-stubs"],
Anton Hanssona4108912021-04-09 13:40:11 +0100336 dist: {
337 dir: "apistubs/android/public",
338 },
Anton Hanssona4748cd2021-04-09 10:16:19 +0100339}
340
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100341java_library {
Jihoon Kang491c7082023-06-15 18:37:01 +0000342 name: "android-non-updatable.stubs.system.from-source",
343 defaults: [
344 "android-non-updatable_defaults",
345 "android-non-updatable_from_source_defaults",
346 ],
Anton Hansson240ee482021-04-14 12:52:00 +0100347 srcs: [":system-api-stubs-docs-non-updatable"],
Anton Hanssonc6e9d2f2022-01-25 15:53:43 +0000348 libs: ["all-modules-system-stubs"],
Anton Hanssona4108912021-04-09 13:40:11 +0100349 dist: {
350 dir: "apistubs/android/system",
351 },
Anton Hanssona4748cd2021-04-09 10:16:19 +0100352}
353
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100354java_library {
Jihoon Kang491c7082023-06-15 18:37:01 +0000355 name: "android-non-updatable.stubs.module_lib.from-source",
356 defaults: [
357 "android-non-updatable_defaults",
358 "android-non-updatable_from_source_defaults",
359 ],
Anton Hanssona4748cd2021-04-09 10:16:19 +0100360 srcs: [":module-lib-api-stubs-docs-non-updatable"],
361 libs: [
markchiencd813a32021-11-11 00:42:55 +0800362 "sdk_module-lib_current_framework-tethering",
paulhu2a8c2c32022-02-08 21:23:06 +0800363 "sdk_module-lib_current_framework-connectivity-t",
Roopa Sattiraju86058b62022-01-20 10:05:19 -0800364 "sdk_public_current_framework-bluetooth",
365 // NOTE: The below can be removed once the prebuilt stub contains bluetooth.
Anton Hanssona4748cd2021-04-09 10:16:19 +0100366 "sdk_system_current_android",
367 // NOTE: The below can be removed once the prebuilt stub contains IKE.
368 "sdk_system_current_android.net.ipsec.ike",
369 ],
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 {
Mark Whiteb03c1fc2023-08-12 01:31:26 +0000504 name: "android_test_frameworks_core_stubs_current.from-source",
505 static_libs: [
506 "all-updatable-modules-system-stubs",
507 "android-non-updatable.stubs.test",
Mark Whiteb03c1fc2023-08-12 01:31:26 +0000508 ],
509 defaults: [
510 "android.jar_defaults",
511 "android_stubs_dists_default",
512 ],
513 dist: {
514 dir: "apistubs/android/test-core",
515 },
516}
517
518java_library {
Jihoon Kang1453baa2023-05-27 05:32:30 +0000519 name: "android_module_lib_stubs_current.from-source",
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000520 defaults: [
Anton Hansson65057af2021-04-14 18:52:08 +0100521 "android.jar_defaults",
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000522 "android_stubs_dists_default",
523 ],
Anton Hanssona4748cd2021-04-09 10:16:19 +0100524 static_libs: [
525 "android-non-updatable.stubs.module_lib",
Victor Chang6b107a92021-06-17 23:49:42 +0100526 "art.module.public.api.stubs.module_lib",
Giulio Fiscella68a04112021-11-30 16:32:44 +0000527 "i18n.module.public.api.stubs",
Anton Hanssonb7d532e2021-02-05 11:40:25 +0000528 ],
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000529 dist: {
530 dir: "apistubs/android/module-lib",
531 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900532}
533
Andrei Oneafaa271a2021-03-17 13:32:51 +0000534java_library {
Jihoon Kang1453baa2023-05-27 05:32:30 +0000535 name: "android_system_server_stubs_current.from-source",
Anton Hansson21fb1082023-03-03 16:22:42 +0000536 defaults: [
537 "android.jar_defaults",
538 "android_stubs_dists_default",
539 ],
Andrei Oneafaa271a2021-03-17 13:32:51 +0000540 srcs: [":services-non-updatable-stubs"],
541 installable: false,
542 static_libs: [
Jihoon Kang1453baa2023-05-27 05:32:30 +0000543 "android_module_lib_stubs_current.from-source",
Andrei Oneafaa271a2021-03-17 13:32:51 +0000544 ],
Andrei Oneafaa271a2021-03-17 13:32:51 +0000545 dist: {
546 dir: "apistubs/android/system-server",
547 },
548}
549
Colin Crosscf87a572022-10-20 14:06:53 -0700550java_library {
551 name: "android_stubs_private_jar",
552 defaults: ["android.jar_defaults"],
553 visibility: [
554 "//visibility:override",
555 "//visibility:private",
556 ],
557 static_libs: [
558 "stable.core.platform.api.stubs",
559 "core-lambda-stubs-for-system-modules",
560 "core-generated-annotation-stubs",
561 "framework",
562 "ext",
563 "framework-res-package-jar",
564 // The order of this matters, it has to be last to provide a
565 // package-private androidx.annotation.RecentlyNonNull without
566 // overriding the public android.annotation.Nullable in framework.jar
567 // with its own package-private android.annotation.Nullable.
568 "private-stub-annotations-jar",
569 ],
570}
571
572java_genrule {
573 name: "android_stubs_private_hjar",
Colin Crosscf87a572022-10-20 14:06:53 -0700574 srcs: [":android_stubs_private_jar{.hjar}"],
575 out: ["android_stubs_private.jar"],
576 cmd: "cp $(in) $(out)",
577}
578
579java_library {
580 name: "android_stubs_private",
581 defaults: ["android_stubs_dists_default"],
Colin Crosscf87a572022-10-20 14:06:53 -0700582 sdk_version: "none",
583 system_modules: "none",
584 static_libs: ["android_stubs_private_hjar"],
585 dist: {
586 dir: "apistubs/android/private",
587 },
588}
589
590java_genrule {
591 name: "android_stubs_private_framework_aidl",
Colin Crosscf87a572022-10-20 14:06:53 -0700592 tools: ["sdkparcelables"],
593 srcs: [":android_stubs_private"],
594 out: ["framework.aidl"],
595 cmd: "rm -f $(genDir)/framework.aidl.merged && " +
596 "for i in $(in); do " +
597 " rm -f $(genDir)/framework.aidl.tmp && " +
598 " $(location sdkparcelables) $$i $(genDir)/framework.aidl.tmp && " +
599 " cat $(genDir)/framework.aidl.tmp >> $(genDir)/framework.aidl.merged; " +
600 "done && " +
601 "sort -u $(genDir)/framework.aidl.merged > $(out)",
602 dist: {
603 targets: ["sdk"],
604 dir: "apistubs/android/private",
605 },
606}
607
Jihoon Kang1f406452023-08-16 19:06:38 +0000608//
609// Java API defaults and libraries for single tree build
610//
611
612java_defaults {
613 name: "stub-annotation-defaults",
614 libs: [
615 "stub-annotations",
616 ],
617 static_libs: [
618 // stub annotations do not contribute to the API surfaces but are statically
619 // linked in the stubs for API surfaces (see frameworks/base/StubLibraries.bp).
620 // This is because annotation processors insist on loading the classes for any
621 // annotations found, thus should exist inside android.jar.
622 "private-stub-annotations-jar",
623 ],
624}
625
626// Listing of API domains contribution and dependencies per API surfaces
627java_defaults {
628 name: "android_test_stubs_current_contributions",
629 api_surface: "test",
630 api_contributions: [
Jihoon Kang1f406452023-08-16 19:06:38 +0000631 "framework-virtualization.stubs.source.test.api.contribution",
Mark White9ee18662023-08-07 11:18:09 +0000632 "framework-location.stubs.source.test.api.contribution",
Jihoon Kang1f406452023-08-16 19:06:38 +0000633 ],
634}
635
636java_defaults {
637 name: "android_test_frameworks_core_stubs_current_contributions",
638 api_surface: "test",
639 api_contributions: [
640 "test-api-stubs-docs-non-updatable.api.contribution",
641 ],
642}
643
644java_defaults {
645 name: "android_module_lib_stubs_current_contributions",
646 api_surface: "module-lib",
647 api_contributions: [
648 "api-stubs-docs-non-updatable.api.contribution",
649 "system-api-stubs-docs-non-updatable.api.contribution",
650 "module-lib-api-stubs-docs-non-updatable.api.contribution",
651 "art.module.public.api.stubs.source.api.contribution",
652 "art.module.public.api.stubs.source.system.api.contribution",
653 "art.module.public.api.stubs.source.module_lib.api.contribution",
654 "i18n.module.public.api.stubs.source.api.contribution",
655 "i18n.module.public.api.stubs.source.system.api.contribution",
656 "i18n.module.public.api.stubs.source.module_lib.api.contribution",
657 ],
658}
659
660// Java API library definitions per API surface
661java_api_library {
662 name: "android_stubs_current.from-text",
663 api_surface: "public",
664 defaults: [
665 // This module is dynamically created at frameworks/base/api/api.go
666 // instead of being written out, in order to minimize edits in the codebase
667 // when there is a change in the list of modules.
668 // that contributes to an api surface.
669 "android_stubs_current_contributions",
670 "stub-annotation-defaults",
671 ],
672 api_contributions: [
673 "api-stubs-docs-non-updatable.api.contribution",
674 ],
675 visibility: ["//visibility:public"],
676}
677
678java_api_library {
679 name: "android_system_stubs_current.from-text",
680 api_surface: "system",
681 defaults: [
682 "android_stubs_current_contributions",
683 "android_system_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",
689 ],
690 visibility: ["//visibility:public"],
691}
692
693java_api_library {
694 name: "android_test_stubs_current.from-text",
695 api_surface: "test",
696 defaults: [
697 "android_stubs_current_contributions",
698 "android_system_stubs_current_contributions",
699 "android_test_stubs_current_contributions",
700 "stub-annotation-defaults",
701 ],
702 api_contributions: [
703 "api-stubs-docs-non-updatable.api.contribution",
704 "system-api-stubs-docs-non-updatable.api.contribution",
Jihoon Kang1c5022b2023-09-20 22:02:29 +0000705 "test-api-stubs-docs-non-updatable.api.contribution",
Jihoon Kang1f406452023-08-16 19:06:38 +0000706 ],
707 visibility: ["//visibility:public"],
708}
709
710java_api_library {
711 name: "android_test_frameworks_core_stubs_current.from-text",
712 api_surface: "test",
713 defaults: [
714 "android_stubs_current_contributions",
715 "android_system_stubs_current_contributions",
716 "android_test_frameworks_core_stubs_current_contributions",
717 "stub-annotation-defaults",
718 ],
719 api_contributions: [
720 "api-stubs-docs-non-updatable.api.contribution",
721 "system-api-stubs-docs-non-updatable.api.contribution",
722 ],
723}
724
725java_api_library {
726 name: "android_module_lib_stubs_current_full.from-text",
727 api_surface: "module-lib",
728 defaults: [
729 "android_stubs_current_contributions",
730 "android_system_stubs_current_contributions",
731 "android_module_lib_stubs_current_contributions_full",
732 ],
733 libs: [
734 "stub-annotations",
735 ],
736 api_contributions: [
737 "api-stubs-docs-non-updatable.api.contribution",
738 "system-api-stubs-docs-non-updatable.api.contribution",
739 "module-lib-api-stubs-docs-non-updatable.api.contribution",
740 ],
741 visibility: ["//visibility:public"],
742}
743
744java_api_library {
745 name: "android_module_lib_stubs_current.from-text",
746 api_surface: "module-lib",
747 defaults: [
748 "android_module_lib_stubs_current_contributions",
749 ],
750 libs: [
751 "android_module_lib_stubs_current_full.from-text",
752 "stub-annotations",
753 ],
754 visibility: ["//visibility:public"],
755}
756
757java_api_library {
758 name: "android_system_server_stubs_current.from-text",
759 api_surface: "system-server",
760 api_contributions: [
761 "services-non-updatable-stubs.api.contribution",
762 ],
763 libs: [
764 "android_module_lib_stubs_current.from-text",
765 "stub-annotations",
766 ],
767 static_libs: [
768 "android_module_lib_stubs_current.from-text",
769 ],
770 visibility: ["//visibility:public"],
771}
772
Anton Hansson36bc27c2021-09-14 15:45:13 +0100773////////////////////////////////////////////////////////////////////////
774// api-versions.xml generation, for public and system. This API database
775// also contains the android.test.* APIs.
776////////////////////////////////////////////////////////////////////////
777
778java_library {
779 name: "android_stubs_current_with_test_libs",
780 static_libs: [
781 "android_stubs_current",
782 "android.test.base.stubs",
783 "android.test.mock.stubs",
784 "android.test.runner.stubs",
785 ],
786 defaults: ["android.jar_defaults"],
787 visibility: [
788 "//visibility:override",
789 "//visibility:private",
790 ],
791}
792
793java_library {
794 name: "android_system_stubs_current_with_test_libs",
795 static_libs: [
796 "android_system_stubs_current",
797 "android.test.base.stubs.system",
798 "android.test.mock.stubs.system",
799 "android.test.runner.stubs.system",
800 ],
801 defaults: ["android.jar_defaults"],
802 visibility: [
803 "//visibility:override",
804 "//visibility:private",
805 ],
806}
807
Cole Faustdcda3702022-10-04 14:46:35 -0700808java_library {
809 name: "android_module_stubs_current_with_test_libs",
810 static_libs: [
811 "android_module_lib_stubs_current",
812 "android.test.base.stubs",
813 "android.test.mock.stubs",
814 "android.test.runner.stubs",
815 ],
816 defaults: ["android.jar_defaults"],
817 visibility: [
818 "//visibility:override",
819 "//visibility:private",
820 ],
821}
822
823java_library {
824 name: "android_system_server_stubs_current_with_test_libs",
825 static_libs: [
826 "android_system_server_stubs_current",
827 "android.test.base.stubs.system",
828 "android.test.mock.stubs.system",
829 "android.test.runner.stubs.system",
830 ],
831 defaults: ["android.jar_defaults"],
832 visibility: [
833 "//visibility:override",
834 "//visibility:private",
835 ],
836}
837
Anton Hansson36bc27c2021-09-14 15:45:13 +0100838droidstubs {
839 name: "api_versions_public",
840 srcs: [":android_stubs_current_with_test_libs{.jar}"],
841 generate_stubs: false,
842 api_levels_annotations_enabled: true,
843 api_levels_annotations_dirs: [
844 "sdk-dir",
845 "api-versions-jars-dir",
846 ],
Cole Faustdcda3702022-10-04 14:46:35 -0700847 api_levels_sdk_type: "public",
Mårten Kongstad54845332022-09-06 15:50:37 +0200848 extensions_info_file: ":sdk-extensions-info",
Anton Hanssonca6e67a2023-03-03 17:55:09 +0000849 visibility: ["//frameworks/base"],
Anton Hansson36bc27c2021-09-14 15:45:13 +0100850}
851
852droidstubs {
853 name: "api_versions_system",
854 srcs: [":android_system_stubs_current_with_test_libs{.jar}"],
855 generate_stubs: false,
856 api_levels_annotations_enabled: true,
857 api_levels_annotations_dirs: [
858 "sdk-dir",
859 "api-versions-jars-dir",
860 ],
861 api_levels_sdk_type: "system",
Mårten Kongstad54845332022-09-06 15:50:37 +0200862 extensions_info_file: ":sdk-extensions-info",
Anton Hansson36bc27c2021-09-14 15:45:13 +0100863}
864
Cole Faustbf4ce752023-02-08 12:46:06 -0800865// This module can be built with:
866// m out/soong/.intermediates/frameworks/base/api_versions_module_lib/android_common/metalava/api-versions.xml
Cole Faustdcda3702022-10-04 14:46:35 -0700867droidstubs {
868 name: "api_versions_module_lib",
869 srcs: [":android_module_stubs_current_with_test_libs{.jar}"],
870 generate_stubs: false,
871 api_levels_annotations_enabled: true,
Cole Faustbf4ce752023-02-08 12:46:06 -0800872 // this only has the non-updatable portions of the module lib sdk,
873 // which can reference classes from updatable apexes, so remove references to them
874 // from this api_versions file.
875 flags: ["--remove-missing-class-references-in-api-levels"],
Cole Faustdcda3702022-10-04 14:46:35 -0700876 api_levels_annotations_dirs: [
877 "sdk-dir",
878 "api-versions-jars-dir",
879 ],
880 api_levels_sdk_type: "module-lib",
Cole Faust1deced12023-02-15 13:24:18 -0800881 // extensions_info_file is purposefully omitted, because this module should just be
882 // the non-updatable portions of the sdk, and extension sdks are updatable.
Cole Faustdcda3702022-10-04 14:46:35 -0700883}
884
885droidstubs {
886 name: "api_versions_system_server",
887 srcs: [":android_system_server_stubs_current_with_test_libs{.jar}"],
888 generate_stubs: false,
889 api_levels_annotations_enabled: true,
Cole Faustbf4ce752023-02-08 12:46:06 -0800890 // this only has the non-updatable portions of the system server sdk,
891 // which can reference classes from updatable apexes, so remove references to them
892 // from this api_versions file.
893 flags: ["--remove-missing-class-references-in-api-levels"],
Cole Faustdcda3702022-10-04 14:46:35 -0700894 api_levels_annotations_dirs: [
895 "sdk-dir",
896 "api-versions-jars-dir",
897 ],
898 api_levels_sdk_type: "system-server",
Cole Faust1deced12023-02-15 13:24:18 -0800899 // extensions_info_file is purposefully omitted, because this module should just be
900 // the non-updatable portions of the sdk, and extension sdks are updatable.
Cole Faustdcda3702022-10-04 14:46:35 -0700901}
902
Jiyong Park7fb4b182019-12-20 14:35:43 +0900903/////////////////////////////////////////////////////////////////////
904// hwbinder.stubs provides APIs required for building HIDL Java
905// libraries.
906/////////////////////////////////////////////////////////////////////
907
908droidstubs {
909 name: "hwbinder-stubs-docs",
Anton Hansson23f319f2023-03-03 16:04:02 +0000910 srcs: [":hwbinder-stubs-srcs"],
Colin Cross037d7fb2021-03-25 17:01:55 -0700911 libs: ["framework-annotations-lib"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900912 installable: false,
913 sdk_version: "core_platform",
914 annotations_enabled: true,
Anton Hansson48ee95e2020-05-02 17:49:26 +0100915 previous_api: ":android.api.public.latest",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900916 merge_annotations_dirs: [
917 "metalava-manual",
918 ],
Anton Hansson81969c22020-02-03 20:45:56 +0000919 args: priv_apps,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900920}
921
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100922java_library {
Jiyong Park7fb4b182019-12-20 14:35:43 +0900923 name: "hwbinder.stubs",
924 sdk_version: "core_current",
Colin Cross037d7fb2021-03-25 17:01:55 -0700925 libs: ["framework-annotations-lib"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900926 srcs: [
927 ":hwbinder-stubs-docs",
928 ],
Anton Hansson86925682021-04-14 14:54:43 +0100929 visibility: ["//visibility:public"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900930}