forked from aosp-mirror/platform_frameworks_base
-
Notifications
You must be signed in to change notification settings - Fork 1
/
StubLibraries.bp
475 lines (436 loc) · 15.1 KB
/
StubLibraries.bp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
// Copyright (C) 2019 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// How stubs are generated:
//
// raw source files --(metalava)--> stub source files --(javac)--> stub jar files
//
// The metalava conversion is done by droidstub modules *-api-stubs-docs.
// The javac compilation is done by java_library modules android_*_stubs_current.
// The metalava conversion is also responsible for creating API signature files
// and comparing them against the last API signature in api/*-current.txt files
// and also against the latest frozen API signature in prebuilts/sdk/*/*/api/android.txt
// files.
/////////////////////////////////////////////////////////////////////
// Common metalava configs
/////////////////////////////////////////////////////////////////////
packages_to_document = [
"android",
"dalvik",
"java",
"javax",
"junit",
"org.apache.http",
"org.json",
"org.w3c.dom",
"org.xml.sax",
"org.xmlpull",
]
stubs_defaults {
name: "metalava-base-api-stubs-default",
srcs: [
":framework-non-updatable-sources",
"core/java/**/*.logtags",
":opt-telephony-srcs",
":opt-net-voip-srcs",
":art-module-public-api-stubs-source",
":android_icu4j_public_api_files",
],
// TODO(b/147699819): remove below aidl includes.
aidl: {
local_include_dirs: ["telephony/java"],
},
libs: ["framework-internal-utils"],
installable: false,
annotations_enabled: true,
previous_api: ":android.api.public.latest",
merge_annotations_dirs: [
"metalava-manual",
],
api_levels_annotations_enabled: false,
filter_packages: packages_to_document,
}
stubs_defaults {
name: "metalava-full-api-stubs-default",
defaults: ["metalava-base-api-stubs-default"],
srcs: [
":conscrypt.module.public.api{.public.stubs.source}",
":framework-updatable-sources",
],
sdk_version: "core_platform",
}
stubs_defaults {
name: "metalava-non-updatable-api-stubs-default",
defaults: ["metalava-base-api-stubs-default"],
sdk_version: "core_platform",
// There are a few classes from modules used as type arguments that
// need to be resolved by metalava. For now, we can use a previously
// finalized stub library to resolve them. If a new class gets added,
// this may be need to be revisited to use a manually maintained stub
// library with empty classes in order to resolve those references.
libs: ["sdk_system_30_android"],
aidl: {
local_include_dirs: ["apex/media/aidl/stable"],
},
}
/////////////////////////////////////////////////////////////////////
// *-api-stubs-docs modules providing source files for the stub libraries
/////////////////////////////////////////////////////////////////////
// api-stubs-docs, system-api-stubs-docs, and test-api-stubs-docs have APIs
// from the non-updatable part of the platform as well as from the updatable
// modules
droidstubs {
name: "api-stubs-docs",
defaults: ["metalava-full-api-stubs-default"],
removed_dex_api_filename: "removed-dex.txt",
arg_files: [
"core/res/AndroidManifest.xml",
],
args: metalava_framework_docs_args,
check_api: {
current: {
api_file: "api/current.txt",
removed_api_file: "api/removed.txt",
},
last_released: {
api_file: ":android.api.public.latest",
removed_api_file: ":removed.api.public.latest",
baseline_file: ":public-api-incompatibilities-with-last-released",
},
api_lint: {
enabled: true,
new_since: ":android.api.public.latest",
baseline_file: "api/lint-baseline.txt",
},
},
dist: {
targets: ["sdk", "win_sdk"],
dir: "apistubs/android/public/api",
dest: "android.txt",
},
jdiff_enabled: true,
}
droidstubs {
name: "api-stubs-docs-non-updatable",
defaults: ["metalava-non-updatable-api-stubs-default"],
arg_files: ["core/res/AndroidManifest.xml"],
args: metalava_framework_docs_args,
check_api: {
current: {
api_file: "non-updatable-api/current.txt",
removed_api_file: "non-updatable-api/removed.txt",
},
api_lint: {
enabled: true,
new_since: ":android-non-updatable.api.public.latest",
},
},
}
priv_apps = " " +
"--show-annotation android.annotation.SystemApi\\(" +
"client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
"\\) "
module_libs = " " +
" --show-annotation android.annotation.SystemApi\\(" +
"client=android.annotation.SystemApi.Client.MODULE_LIBRARIES" +
"\\) "
droidstubs {
name: "system-api-stubs-docs",
defaults: ["metalava-full-api-stubs-default"],
removed_dex_api_filename: "system-removed-dex.txt",
arg_files: [
"core/res/AndroidManifest.xml",
],
args: metalava_framework_docs_args + priv_apps,
check_api: {
current: {
api_file: "api/system-current.txt",
removed_api_file: "api/system-removed.txt",
},
last_released: {
api_file: ":android.api.system.latest",
removed_api_file: ":removed.api.system.latest",
baseline_file: ":system-api-incompatibilities-with-last-released"
},
api_lint: {
enabled: true,
new_since: ":android.api.system.latest",
baseline_file: "api/system-lint-baseline.txt",
},
},
dist: {
targets: ["sdk", "win_sdk"],
dir: "apistubs/android/system/api",
dest: "android.txt",
},
jdiff_enabled: true,
}
droidstubs {
name: "system-api-stubs-docs-non-updatable",
defaults: ["metalava-non-updatable-api-stubs-default"],
arg_files: ["core/res/AndroidManifest.xml"],
args: metalava_framework_docs_args + priv_apps,
check_api: {
current: {
api_file: "non-updatable-api/system-current.txt",
removed_api_file: "non-updatable-api/system-removed.txt",
},
api_lint: {
enabled: true,
new_since: ":android-non-updatable.api.system.latest",
baseline_file: "non-updatable-api/system-lint-baseline.txt",
},
},
}
droidstubs {
name: "test-api-stubs-docs",
defaults: ["metalava-full-api-stubs-default"],
arg_files: [
"core/res/AndroidManifest.xml",
],
args: metalava_framework_docs_args + " --show-annotation android.annotation.TestApi",
check_api: {
current: {
api_file: "api/test-current.txt",
removed_api_file: "api/test-removed.txt",
},
api_lint: {
enabled: true,
baseline_file: "api/test-lint-baseline.txt",
},
},
dist: {
targets: ["sdk", "win_sdk"],
dir: "apistubs/android/test/api",
dest: "android.txt",
},
}
/////////////////////////////////////////////////////////////////////
// Following droidstubs modules are for extra APIs for modules.
// The framework currently have two more API surfaces for modules:
// @SystemApi(client=MODULE_APPS) and @SystemApi(client=MODULE_LIBRARIES)
/////////////////////////////////////////////////////////////////////
// TODO(b/146727827) remove the *-api module when we can teach metalava
// about the relationship among the API surfaces. Currently, these modules are only to generate
// the API signature files and ensure that the APIs evolve in a backwards compatible manner.
// They however are NOT used for building the API stub.
droidstubs {
name: "module-lib-api",
defaults: ["metalava-full-api-stubs-default"],
arg_files: ["core/res/AndroidManifest.xml"],
args: metalava_framework_docs_args + module_libs,
check_api: {
current: {
api_file: "api/module-lib-current.txt",
removed_api_file: "api/module-lib-removed.txt",
},
last_released: {
api_file: ":android.api.module-lib.latest",
removed_api_file: ":removed.api.module-lib.latest",
baseline_file: ":module-lib-api-incompatibilities-with-last-released"
},
api_lint: {
enabled: true,
new_since: ":android.api.module-lib.latest",
baseline_file: "api/module-lib-lint-baseline.txt",
},
},
dist: {
targets: ["sdk", "win_sdk"],
dir: "apistubs/android/module-lib/api",
dest: "android.txt",
},
}
droidstubs {
name: "module-lib-api-stubs-docs-non-updatable",
defaults: ["metalava-non-updatable-api-stubs-default"],
arg_files: ["core/res/AndroidManifest.xml"],
args: metalava_framework_docs_args + module_libs,
check_api: {
current: {
api_file: "non-updatable-api/module-lib-current.txt",
removed_api_file: "non-updatable-api/module-lib-removed.txt",
},
api_lint: {
enabled: true,
new_since: ":android-non-updatable.api.module-lib.latest",
},
},
}
// The following droidstub module generates source files for the API stub library for
// modules. Note that it not only includes its own APIs but also other APIs that have
// narrower scope (all @SystemApis, not just the ones with 'client=MODULE_LIBRARIES').
droidstubs {
name: "module-lib-api-stubs-docs",
defaults: ["metalava-non-updatable-api-stubs-default"],
arg_files: ["core/res/AndroidManifest.xml"],
args: metalava_framework_docs_args + priv_apps + module_libs,
}
/////////////////////////////////////////////////////////////////////
// android_*_stubs_current modules are the stubs libraries compiled
// from *-api-stubs-docs
/////////////////////////////////////////////////////////////////////
java_defaults {
name: "android_defaults_stubs_current",
libs: [ "stub-annotations" ],
errorprone: {
javacflags: [
"-XepDisableAllChecks",
],
},
java_resources: [":notices-for-framework-stubs"],
sdk_version: "none",
system_modules: "none",
java_version: "1.8",
compile_dex: true,
}
java_library_static {
name: "android_monolith_stubs_current",
srcs: [ ":api-stubs-docs" ],
static_libs: [ "private-stub-annotations-jar" ],
defaults: ["android_defaults_stubs_current"],
}
java_library_static {
name: "android_merged_stubs_current",
srcs: [ ":api-stubs-docs-non-updatable" ],
static_libs: [
"conscrypt.module.public.api.stubs",
"framework-media.stubs",
"framework-mediaprovider.stubs",
"framework-permission.stubs",
"framework-sdkextensions.stubs",
"framework-statsd.stubs",
"framework-tethering.stubs",
"framework-wifi.stubs",
"private-stub-annotations-jar",
],
defaults: ["android_defaults_stubs_current"],
}
java_library_static {
name: "android_stubs_current",
static_libs: ["android_merged_stubs_current"],
defaults: ["android_defaults_stubs_current"],
}
java_library_static {
name: "android_system_monolith_stubs_current",
srcs: [ ":system-api-stubs-docs" ],
static_libs: [ "private-stub-annotations-jar" ],
defaults: ["android_defaults_stubs_current"],
}
java_library_static {
name: "android_system_merged_stubs_current",
srcs: [ ":system-api-stubs-docs-non-updatable" ],
static_libs: [
"conscrypt.module.public.api.stubs",
"framework-media.stubs.system",
"framework-mediaprovider.stubs.system",
"framework-permission.stubs.system",
"framework-sdkextensions.stubs.system",
"framework-statsd.stubs.system",
"framework-tethering.stubs.system",
"framework-wifi.stubs.system",
"private-stub-annotations-jar",
],
defaults: ["android_defaults_stubs_current"],
}
java_library_static {
name: "android_system_stubs_current",
static_libs: ["android_system_merged_stubs_current"],
defaults: ["android_defaults_stubs_current"],
}
java_library_static {
name: "android_test_stubs_current",
srcs: [ ":test-api-stubs-docs" ],
static_libs: [ "private-stub-annotations-jar" ],
defaults: ["android_defaults_stubs_current"],
}
java_library_static {
name: "android_module_lib_stubs_current",
srcs: [ ":module-lib-api-stubs-docs" ],
defaults: ["android_defaults_stubs_current"],
libs: ["sdk_system_29_android"],
}
java_library_static {
name: "android_non_updatable_stubs_current",
srcs: [":api-stubs-docs-non-updatable"],
defaults: ["android_defaults_stubs_current"],
libs: ["sdk_system_29_android"],
}
java_library_static {
name: "android_system_non_updatable_stubs_current",
srcs: [":system-api-stubs-docs-non-updatable"],
defaults: ["android_defaults_stubs_current"],
libs: ["sdk_system_29_android"],
}
/////////////////////////////////////////////////////////////////////
// hwbinder.stubs provides APIs required for building HIDL Java
// libraries.
/////////////////////////////////////////////////////////////////////
droidstubs {
name: "hwbinder-stubs-docs",
srcs: [
"core/java/android/os/HidlSupport.java",
"core/java/android/annotation/IntDef.java",
"core/java/android/annotation/IntRange.java",
"core/java/android/annotation/NonNull.java",
"core/java/android/annotation/SystemApi.java",
"core/java/android/os/HidlMemory.java",
"core/java/android/os/HwBinder.java",
"core/java/android/os/HwBlob.java",
"core/java/android/os/HwParcel.java",
"core/java/android/os/IHwBinder.java",
"core/java/android/os/IHwInterface.java",
"core/java/android/os/DeadObjectException.java",
"core/java/android/os/DeadSystemException.java",
"core/java/android/os/NativeHandle.java",
"core/java/android/os/RemoteException.java",
"core/java/android/util/AndroidException.java",
],
installable: false,
sdk_version: "core_platform",
annotations_enabled: true,
previous_api: ":android.api.public.latest",
merge_annotations_dirs: [
"metalava-manual",
],
args: priv_apps,
}
java_library_static {
name: "hwbinder.stubs",
sdk_version: "core_current",
srcs: [
":hwbinder-stubs-docs",
],
}
/////////////////////////////////////////////////////////////////////
// api/*-current.txt files for use by modules in other directories
// like the CTS test
/////////////////////////////////////////////////////////////////////
filegroup {
name: "frameworks-base-api-current.txt",
srcs: [
"api/current.txt",
],
}
filegroup {
name: "frameworks-base-api-system-current.txt",
srcs: [
"api/system-current.txt",
],
}
filegroup {
name: "frameworks-base-api-system-removed.txt",
srcs: [
"api/system-removed.txt",
],
}