blob: 2d9c988556ec7c724d91356083f0cb49efb0297d [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: [
Anton Hansson8b49d0e2023-09-28 10:30:16 +0000362 // We cannot depend on all-modules-module-lib-stubs, because the module-lib stubs
363 // depend on this stub. We resolve dependencies on APIs in modules by depending
364 // on a prebuilt of the whole platform (sdk_system_current_android).
365 // That prebuilt does not include module-lib APIs, so use the prebuilt module-lib
366 // stubs for modules that export module-lib stubs that the non-updatable part
367 // depends on.
markchiencd813a32021-11-11 00:42:55 +0800368 "sdk_module-lib_current_framework-tethering",
paulhu2a8c2c32022-02-08 21:23:06 +0800369 "sdk_module-lib_current_framework-connectivity-t",
Anton Hanssona4748cd2021-04-09 10:16:19 +0100370 "sdk_system_current_android",
Anton Hanssona4748cd2021-04-09 10:16:19 +0100371 ],
Anton Hanssona4108912021-04-09 13:40:11 +0100372 dist: {
373 dir: "apistubs/android/module-lib",
374 },
Anton Hanssona4748cd2021-04-09 10:16:19 +0100375}
376
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100377java_library {
Jihoon Kang491c7082023-06-15 18:37:01 +0000378 name: "android-non-updatable.stubs.test.from-source",
379 defaults: [
380 "android-non-updatable_defaults",
381 "android-non-updatable_from_source_defaults",
382 ],
Anton Hanssona4748cd2021-04-09 10:16:19 +0100383 srcs: [":test-api-stubs-docs-non-updatable"],
Anton Hanssonc6e9d2f2022-01-25 15:53:43 +0000384 libs: ["all-modules-system-stubs"],
Anton Hanssona4108912021-04-09 13:40:11 +0100385 dist: {
386 dir: "apistubs/android/test",
387 },
Anton Hanssona4748cd2021-04-09 10:16:19 +0100388}
389
390java_defaults {
Jihoon Kang491c7082023-06-15 18:37:01 +0000391 name: "android-non-updatable_from_text_defaults",
Jihoon Kang0c101db2023-03-14 07:03:46 +0000392 static_libs: ["framework-res-package-jar"],
393 libs: ["stub-annotations"],
394}
395
396java_api_library {
397 name: "android-non-updatable.stubs.from-text",
398 api_surface: "public",
Jihoon Kang25b6ced2023-09-20 21:48:09 +0000399 api_contributions: [
400 "api-stubs-docs-non-updatable.api.contribution",
Jihoon Kang0c101db2023-03-14 07:03:46 +0000401 ],
Jihoon Kang491c7082023-06-15 18:37:01 +0000402 defaults: ["android-non-updatable_from_text_defaults"],
Jihoon Kang12cddb32023-06-29 21:35:24 +0000403 full_api_surface_stub: "android_stubs_current.from-text",
Jihoon Kang0c101db2023-03-14 07:03:46 +0000404}
405
406java_api_library {
407 name: "android-non-updatable.stubs.system.from-text",
408 api_surface: "system",
Jihoon Kang25b6ced2023-09-20 21:48:09 +0000409 api_contributions: [
410 "api-stubs-docs-non-updatable.api.contribution",
411 "system-api-stubs-docs-non-updatable.api.contribution",
Jihoon Kang0c101db2023-03-14 07:03:46 +0000412 ],
Jihoon Kang491c7082023-06-15 18:37:01 +0000413 defaults: ["android-non-updatable_from_text_defaults"],
Jihoon Kang12cddb32023-06-29 21:35:24 +0000414 full_api_surface_stub: "android_system_stubs_current.from-text",
Jihoon Kang0c101db2023-03-14 07:03:46 +0000415}
416
417java_api_library {
418 name: "android-non-updatable.stubs.test.from-text",
419 api_surface: "test",
Jihoon Kang25b6ced2023-09-20 21:48:09 +0000420 api_contributions: [
421 "api-stubs-docs-non-updatable.api.contribution",
422 "system-api-stubs-docs-non-updatable.api.contribution",
423 "test-api-stubs-docs-non-updatable.api.contribution",
Jihoon Kang0c101db2023-03-14 07:03:46 +0000424 ],
Jihoon Kang491c7082023-06-15 18:37:01 +0000425 defaults: ["android-non-updatable_from_text_defaults"],
Jihoon Kang12cddb32023-06-29 21:35:24 +0000426 full_api_surface_stub: "android_test_stubs_current.from-text",
Jihoon Kang0c101db2023-03-14 07:03:46 +0000427}
428
429java_api_library {
430 name: "android-non-updatable.stubs.module_lib.from-text",
431 api_surface: "module_lib",
Jihoon Kang25b6ced2023-09-20 21:48:09 +0000432 api_contributions: [
433 "api-stubs-docs-non-updatable.api.contribution",
434 "system-api-stubs-docs-non-updatable.api.contribution",
435 "module-lib-api-stubs-docs-non-updatable.api.contribution",
Jihoon Kang0c101db2023-03-14 07:03:46 +0000436 ],
Jihoon Kang491c7082023-06-15 18:37:01 +0000437 defaults: ["android-non-updatable_from_text_defaults"],
Jihoon Kang12cddb32023-06-29 21:35:24 +0000438 full_api_surface_stub: "android_module_lib_stubs_current_full.from-text",
Jihoon Kang0c101db2023-03-14 07:03:46 +0000439}
440
441java_defaults {
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000442 name: "android_stubs_dists_default",
443 dist: {
Anton Hanssondd8ef672022-01-04 08:53:19 +0000444 targets: ["sdk"],
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000445 tag: ".jar",
446 dest: "android.jar",
447 },
Anton Hansson86925682021-04-14 14:54:43 +0100448 defaults_visibility: ["//frameworks/base/services"],
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000449}
450
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100451java_library {
Jihoon Kang1453baa2023-05-27 05:32:30 +0000452 name: "android_stubs_current.from-source",
Anton Hanssonc6e9d2f2022-01-25 15:53:43 +0000453 static_libs: [
454 "all-modules-public-stubs",
Anton Hanssona4748cd2021-04-09 10:16:19 +0100455 "android-non-updatable.stubs",
Anton Hanssonbf63f942020-05-20 12:06:23 +0100456 "private-stub-annotations-jar",
Anton Hansson76d3db42020-04-09 14:16:37 +0100457 ],
Anton Hansson65057af2021-04-14 18:52:08 +0100458 defaults: ["android.jar_defaults"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900459}
460
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100461java_library {
Jihoon Kang1453baa2023-05-27 05:32:30 +0000462 name: "android_system_stubs_current.from-source",
Anton Hanssonc6e9d2f2022-01-25 15:53:43 +0000463 static_libs: [
464 "all-modules-system-stubs",
Anton Hanssona4748cd2021-04-09 10:16:19 +0100465 "android-non-updatable.stubs.system",
Anton Hanssonbf63f942020-05-20 12:06:23 +0100466 "private-stub-annotations-jar",
Anton Hansson76d3db42020-04-09 14:16:37 +0100467 ],
Anton Hanssonc3002e52020-11-18 18:23:55 +0000468 defaults: [
Anton Hansson65057af2021-04-14 18:52:08 +0100469 "android.jar_defaults",
Anton Hanssonc3002e52020-11-18 18:23:55 +0000470 "android_stubs_dists_default",
471 ],
472 dist: {
473 dir: "apistubs/android/system",
474 },
475 dists: [
476 {
477 // Legacy dist path
Anton Hanssondd8ef672022-01-04 08:53:19 +0000478 targets: ["sdk"],
Anton Hanssonc3002e52020-11-18 18:23:55 +0000479 tag: ".jar",
480 dest: "android_system.jar",
481 },
482 ],
Anton Hansson76d3db42020-04-09 14:16:37 +0100483}
484
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100485java_library {
Jihoon Kang1453baa2023-05-27 05:32:30 +0000486 name: "android_test_stubs_current.from-source",
Anton Hanssonc6e9d2f2022-01-25 15:53:43 +0000487 static_libs: [
Nikita Ioffe5593fbb2022-12-01 14:52:34 +0000488 // Updatable modules do not have test APIs, but we want to include their SystemApis, like we
489 // include the SystemApi of framework-non-updatable-sources.
490 "all-updatable-modules-system-stubs",
491 // Non-updatable modules on the other hand can have test APIs, so include their test-stubs.
492 "all-non-updatable-modules-test-stubs",
Anton Hanssona4748cd2021-04-09 10:16:19 +0100493 "android-non-updatable.stubs.test",
Anton Hansson7ce31c12020-10-15 18:38:49 +0100494 "private-stub-annotations-jar",
495 ],
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000496 defaults: [
Anton Hansson65057af2021-04-14 18:52:08 +0100497 "android.jar_defaults",
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000498 "android_stubs_dists_default",
499 ],
500 dist: {
501 dir: "apistubs/android/test",
502 },
Jiyong Parke3095162019-12-20 15:30:28 +0900503}
504
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100505java_library {
Mark Whiteb03c1fc2023-08-12 01:31:26 +0000506 name: "android_test_frameworks_core_stubs_current.from-source",
507 static_libs: [
508 "all-updatable-modules-system-stubs",
509 "android-non-updatable.stubs.test",
Mark Whiteb03c1fc2023-08-12 01:31:26 +0000510 ],
511 defaults: [
512 "android.jar_defaults",
513 "android_stubs_dists_default",
514 ],
515 dist: {
516 dir: "apistubs/android/test-core",
517 },
518}
519
520java_library {
Jihoon Kang1453baa2023-05-27 05:32:30 +0000521 name: "android_module_lib_stubs_current.from-source",
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000522 defaults: [
Anton Hansson65057af2021-04-14 18:52:08 +0100523 "android.jar_defaults",
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000524 "android_stubs_dists_default",
525 ],
Anton Hanssona4748cd2021-04-09 10:16:19 +0100526 static_libs: [
527 "android-non-updatable.stubs.module_lib",
Victor Chang6b107a92021-06-17 23:49:42 +0100528 "art.module.public.api.stubs.module_lib",
Giulio Fiscella68a04112021-11-30 16:32:44 +0000529 "i18n.module.public.api.stubs",
Anton Hanssonb7d532e2021-02-05 11:40:25 +0000530 ],
Anton Hansson53cf0ba2020-08-18 12:35:31 +0000531 dist: {
532 dir: "apistubs/android/module-lib",
533 },
Jiyong Park7fb4b182019-12-20 14:35:43 +0900534}
535
Andrei Oneafaa271a2021-03-17 13:32:51 +0000536java_library {
Jihoon Kang1453baa2023-05-27 05:32:30 +0000537 name: "android_system_server_stubs_current.from-source",
Anton Hansson21fb1082023-03-03 16:22:42 +0000538 defaults: [
539 "android.jar_defaults",
540 "android_stubs_dists_default",
541 ],
Andrei Oneafaa271a2021-03-17 13:32:51 +0000542 srcs: [":services-non-updatable-stubs"],
543 installable: false,
544 static_libs: [
Jihoon Kang1453baa2023-05-27 05:32:30 +0000545 "android_module_lib_stubs_current.from-source",
Andrei Oneafaa271a2021-03-17 13:32:51 +0000546 ],
Andrei Oneafaa271a2021-03-17 13:32:51 +0000547 dist: {
548 dir: "apistubs/android/system-server",
549 },
550}
551
Colin Crosscf87a572022-10-20 14:06:53 -0700552java_library {
553 name: "android_stubs_private_jar",
554 defaults: ["android.jar_defaults"],
555 visibility: [
556 "//visibility:override",
557 "//visibility:private",
558 ],
559 static_libs: [
560 "stable.core.platform.api.stubs",
561 "core-lambda-stubs-for-system-modules",
562 "core-generated-annotation-stubs",
563 "framework",
564 "ext",
565 "framework-res-package-jar",
566 // The order of this matters, it has to be last to provide a
567 // package-private androidx.annotation.RecentlyNonNull without
568 // overriding the public android.annotation.Nullable in framework.jar
569 // with its own package-private android.annotation.Nullable.
570 "private-stub-annotations-jar",
571 ],
572}
573
574java_genrule {
575 name: "android_stubs_private_hjar",
Colin Crosscf87a572022-10-20 14:06:53 -0700576 srcs: [":android_stubs_private_jar{.hjar}"],
577 out: ["android_stubs_private.jar"],
578 cmd: "cp $(in) $(out)",
579}
580
581java_library {
582 name: "android_stubs_private",
583 defaults: ["android_stubs_dists_default"],
Colin Crosscf87a572022-10-20 14:06:53 -0700584 sdk_version: "none",
585 system_modules: "none",
586 static_libs: ["android_stubs_private_hjar"],
587 dist: {
588 dir: "apistubs/android/private",
589 },
590}
591
592java_genrule {
593 name: "android_stubs_private_framework_aidl",
Colin Crosscf87a572022-10-20 14:06:53 -0700594 tools: ["sdkparcelables"],
595 srcs: [":android_stubs_private"],
596 out: ["framework.aidl"],
597 cmd: "rm -f $(genDir)/framework.aidl.merged && " +
598 "for i in $(in); do " +
599 " rm -f $(genDir)/framework.aidl.tmp && " +
600 " $(location sdkparcelables) $$i $(genDir)/framework.aidl.tmp && " +
601 " cat $(genDir)/framework.aidl.tmp >> $(genDir)/framework.aidl.merged; " +
602 "done && " +
603 "sort -u $(genDir)/framework.aidl.merged > $(out)",
604 dist: {
605 targets: ["sdk"],
606 dir: "apistubs/android/private",
607 },
608}
609
Jihoon Kang1f406452023-08-16 19:06:38 +0000610//
611// Java API defaults and libraries for single tree build
612//
613
614java_defaults {
615 name: "stub-annotation-defaults",
616 libs: [
617 "stub-annotations",
618 ],
619 static_libs: [
620 // stub annotations do not contribute to the API surfaces but are statically
621 // linked in the stubs for API surfaces (see frameworks/base/StubLibraries.bp).
622 // This is because annotation processors insist on loading the classes for any
623 // annotations found, thus should exist inside android.jar.
624 "private-stub-annotations-jar",
625 ],
626}
627
628// Listing of API domains contribution and dependencies per API surfaces
629java_defaults {
630 name: "android_test_stubs_current_contributions",
631 api_surface: "test",
632 api_contributions: [
Jihoon Kang1f406452023-08-16 19:06:38 +0000633 "framework-virtualization.stubs.source.test.api.contribution",
Mark White9ee18662023-08-07 11:18:09 +0000634 "framework-location.stubs.source.test.api.contribution",
Jihoon Kang1f406452023-08-16 19:06:38 +0000635 ],
636}
637
638java_defaults {
639 name: "android_test_frameworks_core_stubs_current_contributions",
640 api_surface: "test",
641 api_contributions: [
642 "test-api-stubs-docs-non-updatable.api.contribution",
643 ],
644}
645
646java_defaults {
647 name: "android_module_lib_stubs_current_contributions",
648 api_surface: "module-lib",
649 api_contributions: [
650 "api-stubs-docs-non-updatable.api.contribution",
651 "system-api-stubs-docs-non-updatable.api.contribution",
652 "module-lib-api-stubs-docs-non-updatable.api.contribution",
653 "art.module.public.api.stubs.source.api.contribution",
654 "art.module.public.api.stubs.source.system.api.contribution",
655 "art.module.public.api.stubs.source.module_lib.api.contribution",
656 "i18n.module.public.api.stubs.source.api.contribution",
657 "i18n.module.public.api.stubs.source.system.api.contribution",
658 "i18n.module.public.api.stubs.source.module_lib.api.contribution",
659 ],
660}
661
662// Java API library definitions per API surface
663java_api_library {
664 name: "android_stubs_current.from-text",
665 api_surface: "public",
666 defaults: [
667 // This module is dynamically created at frameworks/base/api/api.go
668 // instead of being written out, in order to minimize edits in the codebase
669 // when there is a change in the list of modules.
670 // that contributes to an api surface.
671 "android_stubs_current_contributions",
672 "stub-annotation-defaults",
673 ],
674 api_contributions: [
675 "api-stubs-docs-non-updatable.api.contribution",
676 ],
677 visibility: ["//visibility:public"],
678}
679
680java_api_library {
681 name: "android_system_stubs_current.from-text",
682 api_surface: "system",
683 defaults: [
684 "android_stubs_current_contributions",
685 "android_system_stubs_current_contributions",
686 "stub-annotation-defaults",
687 ],
688 api_contributions: [
689 "api-stubs-docs-non-updatable.api.contribution",
690 "system-api-stubs-docs-non-updatable.api.contribution",
691 ],
692 visibility: ["//visibility:public"],
693}
694
695java_api_library {
696 name: "android_test_stubs_current.from-text",
697 api_surface: "test",
698 defaults: [
699 "android_stubs_current_contributions",
700 "android_system_stubs_current_contributions",
701 "android_test_stubs_current_contributions",
702 "stub-annotation-defaults",
703 ],
704 api_contributions: [
705 "api-stubs-docs-non-updatable.api.contribution",
706 "system-api-stubs-docs-non-updatable.api.contribution",
Jihoon Kang1c5022b2023-09-20 22:02:29 +0000707 "test-api-stubs-docs-non-updatable.api.contribution",
Jihoon Kang1f406452023-08-16 19:06:38 +0000708 ],
709 visibility: ["//visibility:public"],
710}
711
712java_api_library {
713 name: "android_test_frameworks_core_stubs_current.from-text",
714 api_surface: "test",
715 defaults: [
716 "android_stubs_current_contributions",
717 "android_system_stubs_current_contributions",
718 "android_test_frameworks_core_stubs_current_contributions",
719 "stub-annotation-defaults",
720 ],
721 api_contributions: [
722 "api-stubs-docs-non-updatable.api.contribution",
723 "system-api-stubs-docs-non-updatable.api.contribution",
724 ],
725}
726
727java_api_library {
728 name: "android_module_lib_stubs_current_full.from-text",
729 api_surface: "module-lib",
730 defaults: [
731 "android_stubs_current_contributions",
732 "android_system_stubs_current_contributions",
733 "android_module_lib_stubs_current_contributions_full",
734 ],
735 libs: [
736 "stub-annotations",
737 ],
738 api_contributions: [
739 "api-stubs-docs-non-updatable.api.contribution",
740 "system-api-stubs-docs-non-updatable.api.contribution",
741 "module-lib-api-stubs-docs-non-updatable.api.contribution",
742 ],
743 visibility: ["//visibility:public"],
744}
745
746java_api_library {
747 name: "android_module_lib_stubs_current.from-text",
748 api_surface: "module-lib",
749 defaults: [
750 "android_module_lib_stubs_current_contributions",
751 ],
752 libs: [
753 "android_module_lib_stubs_current_full.from-text",
754 "stub-annotations",
755 ],
756 visibility: ["//visibility:public"],
757}
758
759java_api_library {
760 name: "android_system_server_stubs_current.from-text",
761 api_surface: "system-server",
762 api_contributions: [
763 "services-non-updatable-stubs.api.contribution",
764 ],
765 libs: [
766 "android_module_lib_stubs_current.from-text",
767 "stub-annotations",
768 ],
769 static_libs: [
770 "android_module_lib_stubs_current.from-text",
771 ],
772 visibility: ["//visibility:public"],
773}
774
Anton Hansson36bc27c2021-09-14 15:45:13 +0100775////////////////////////////////////////////////////////////////////////
776// api-versions.xml generation, for public and system. This API database
777// also contains the android.test.* APIs.
778////////////////////////////////////////////////////////////////////////
779
780java_library {
781 name: "android_stubs_current_with_test_libs",
782 static_libs: [
783 "android_stubs_current",
784 "android.test.base.stubs",
785 "android.test.mock.stubs",
786 "android.test.runner.stubs",
787 ],
788 defaults: ["android.jar_defaults"],
789 visibility: [
790 "//visibility:override",
791 "//visibility:private",
792 ],
793}
794
795java_library {
796 name: "android_system_stubs_current_with_test_libs",
797 static_libs: [
798 "android_system_stubs_current",
799 "android.test.base.stubs.system",
800 "android.test.mock.stubs.system",
801 "android.test.runner.stubs.system",
802 ],
803 defaults: ["android.jar_defaults"],
804 visibility: [
805 "//visibility:override",
806 "//visibility:private",
807 ],
808}
809
Cole Faustdcda3702022-10-04 14:46:35 -0700810java_library {
811 name: "android_module_stubs_current_with_test_libs",
812 static_libs: [
813 "android_module_lib_stubs_current",
814 "android.test.base.stubs",
815 "android.test.mock.stubs",
816 "android.test.runner.stubs",
817 ],
818 defaults: ["android.jar_defaults"],
819 visibility: [
820 "//visibility:override",
821 "//visibility:private",
822 ],
823}
824
825java_library {
826 name: "android_system_server_stubs_current_with_test_libs",
827 static_libs: [
828 "android_system_server_stubs_current",
829 "android.test.base.stubs.system",
830 "android.test.mock.stubs.system",
831 "android.test.runner.stubs.system",
832 ],
833 defaults: ["android.jar_defaults"],
834 visibility: [
835 "//visibility:override",
836 "//visibility:private",
837 ],
838}
839
Anton Hansson36bc27c2021-09-14 15:45:13 +0100840droidstubs {
841 name: "api_versions_public",
842 srcs: [":android_stubs_current_with_test_libs{.jar}"],
843 generate_stubs: false,
844 api_levels_annotations_enabled: true,
845 api_levels_annotations_dirs: [
846 "sdk-dir",
847 "api-versions-jars-dir",
848 ],
Cole Faustdcda3702022-10-04 14:46:35 -0700849 api_levels_sdk_type: "public",
Mårten Kongstad54845332022-09-06 15:50:37 +0200850 extensions_info_file: ":sdk-extensions-info",
Anton Hanssonca6e67a2023-03-03 17:55:09 +0000851 visibility: ["//frameworks/base"],
Anton Hansson36bc27c2021-09-14 15:45:13 +0100852}
853
854droidstubs {
855 name: "api_versions_system",
856 srcs: [":android_system_stubs_current_with_test_libs{.jar}"],
857 generate_stubs: false,
858 api_levels_annotations_enabled: true,
859 api_levels_annotations_dirs: [
860 "sdk-dir",
861 "api-versions-jars-dir",
862 ],
863 api_levels_sdk_type: "system",
Mårten Kongstad54845332022-09-06 15:50:37 +0200864 extensions_info_file: ":sdk-extensions-info",
Anton Hansson36bc27c2021-09-14 15:45:13 +0100865}
866
Cole Faustbf4ce752023-02-08 12:46:06 -0800867// This module can be built with:
868// m out/soong/.intermediates/frameworks/base/api_versions_module_lib/android_common/metalava/api-versions.xml
Cole Faustdcda3702022-10-04 14:46:35 -0700869droidstubs {
870 name: "api_versions_module_lib",
871 srcs: [":android_module_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 module lib 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: "module-lib",
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
887droidstubs {
888 name: "api_versions_system_server",
889 srcs: [":android_system_server_stubs_current_with_test_libs{.jar}"],
890 generate_stubs: false,
891 api_levels_annotations_enabled: true,
Cole Faustbf4ce752023-02-08 12:46:06 -0800892 // this only has the non-updatable portions of the system server sdk,
893 // which can reference classes from updatable apexes, so remove references to them
894 // from this api_versions file.
895 flags: ["--remove-missing-class-references-in-api-levels"],
Cole Faustdcda3702022-10-04 14:46:35 -0700896 api_levels_annotations_dirs: [
897 "sdk-dir",
898 "api-versions-jars-dir",
899 ],
900 api_levels_sdk_type: "system-server",
Cole Faust1deced12023-02-15 13:24:18 -0800901 // extensions_info_file is purposefully omitted, because this module should just be
902 // the non-updatable portions of the sdk, and extension sdks are updatable.
Cole Faustdcda3702022-10-04 14:46:35 -0700903}
904
Jiyong Park7fb4b182019-12-20 14:35:43 +0900905/////////////////////////////////////////////////////////////////////
906// hwbinder.stubs provides APIs required for building HIDL Java
907// libraries.
908/////////////////////////////////////////////////////////////////////
909
910droidstubs {
911 name: "hwbinder-stubs-docs",
Anton Hansson23f319f2023-03-03 16:04:02 +0000912 srcs: [":hwbinder-stubs-srcs"],
Colin Cross037d7fb2021-03-25 17:01:55 -0700913 libs: ["framework-annotations-lib"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900914 installable: false,
915 sdk_version: "core_platform",
916 annotations_enabled: true,
Anton Hansson48ee95e2020-05-02 17:49:26 +0100917 previous_api: ":android.api.public.latest",
Jiyong Park7fb4b182019-12-20 14:35:43 +0900918 merge_annotations_dirs: [
919 "metalava-manual",
920 ],
Anton Hansson81969c22020-02-03 20:45:56 +0000921 args: priv_apps,
Jiyong Park7fb4b182019-12-20 14:35:43 +0900922}
923
Anton Hanssonbbdd64b2021-04-26 18:47:39 +0100924java_library {
Jiyong Park7fb4b182019-12-20 14:35:43 +0900925 name: "hwbinder.stubs",
926 sdk_version: "core_current",
Colin Cross037d7fb2021-03-25 17:01:55 -0700927 libs: ["framework-annotations-lib"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900928 srcs: [
929 ":hwbinder-stubs-docs",
930 ],
Anton Hansson86925682021-04-14 14:54:43 +0100931 visibility: ["//visibility:public"],
Jiyong Park7fb4b182019-12-20 14:35:43 +0900932}