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
476
477
478
479
480
481
|
// Copyright (C) 2021 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.
//
// Definitions for building the Android core libraries, i.e. ART, I18n and
// Conscrypt.
//
// These are here as the definitions are used by the build itself and include
// parts from all three of those modules.
//
// A stubs target containing the parts of the public SDK API provided by the
// core libraries.
//
// Don't use this directly, use "sdk_version: core_current".
package {
default_applicable_licenses: ["Android-Apache-2.0"],
}
dist_targets = [
"sdk",
"win_sdk",
]
java_defaults {
name: "core.current.stubs.defaults",
visibility: ["//visibility:public"],
sdk_version: "none",
system_modules: "none",
is_stubs_module: true,
}
soong_config_module_type {
name: "core_current_stubs_soong_config_defaults",
module_type: "java_defaults",
config_namespace: "ANDROID",
bool_variables: [
"release_hidden_api_exportable_stubs",
],
properties: [
"dist.targets",
"dist.dest",
],
}
core_current_stubs_soong_config_defaults {
name: "core_current_stubs_everything_soong_config_defaults",
soong_config_variables: {
release_hidden_api_exportable_stubs: {
conditions_default: {
dist: {
targets: dist_targets,
dest: "core.current.stubs.jar",
},
},
},
},
}
core_current_stubs_soong_config_defaults {
name: "core_current_stubs_exportable_soong_config_defaults",
soong_config_variables: {
release_hidden_api_exportable_stubs: {
dist: {
targets: dist_targets,
dest: "core.current.stubs.jar",
},
},
},
}
java_library {
name: "core.current.stubs",
defaults: [
"core.current.stubs.defaults",
"core_current_stubs_everything_soong_config_defaults",
],
static_libs: [
"art.module.public.api.stubs",
"conscrypt.module.public.api.stubs",
"i18n.module.public.api.stubs",
],
}
// Used for bootstrapping ART system modules
java_api_library {
name: "core.current.stubs.from-text",
defaults: [
"core.current.stubs.defaults",
],
api_surface: "core",
api_contributions: [
"art.module.public.api.stubs.source.api.contribution",
"conscrypt.module.public.api.stubs.source.api.contribution",
"i18n.module.public.api.stubs.source.api.contribution",
],
libs: [
"stub-annotations",
],
enable_validation: false,
stubs_type: "everything",
}
java_library {
name: "core.current.stubs.exportable",
defaults: [
"core.current.stubs.defaults",
"core_current_stubs_exportable_soong_config_defaults",
],
static_libs: [
"art.module.public.api.stubs.exportable",
"conscrypt.module.public.api.stubs.exportable",
"i18n.module.public.api.stubs.exportable",
],
}
// Distributed with the SDK for turning into system modules to compile apps
// against.
//
// Also, produces dist files that are used by the
// prebuilts/sdk/update_prebuilts.py script to update the prebuilts/sdk
// directory.
java_library {
name: "core-current-stubs-for-system-modules-exportable",
visibility: ["//development/sdk"],
static_libs: [
"core.current.stubs.exportable",
// This one is not on device but it's needed when javac compiles code
// containing lambdas.
"core-lambda-stubs-for-system-modules",
],
sdk_version: "none",
system_modules: "none",
dists: [
{
// Legacy dist location for the public file.
dest: "core-for-system-modules.jar",
targets: dist_targets,
},
{
dest: "system-modules/public/core-for-system-modules.jar",
targets: dist_targets,
},
],
}
java_library {
name: "core-current-stubs-for-system-modules",
visibility: ["//development/sdk"],
static_libs: [
"core.current.stubs",
// This one is not on device but it's needed when javac compiles code
// containing lambdas.
"core-lambda-stubs-for-system-modules",
],
sdk_version: "none",
system_modules: "none",
}
// Defaults module to strip out android annotations
java_defaults {
name: "system-modules-no-annotations",
sdk_version: "none",
system_modules: "none",
jarjar_rules: "jarjar-strip-annotations-rules.txt",
}
// Same as core-current-stubs-for-system-modules, but android annotations are
// stripped.
java_library {
name: "core-current-stubs-for-system-modules-no-annotations",
visibility: ["//development/sdk"],
defaults: [
"system-modules-no-annotations",
],
static_libs: [
"core-current-stubs-for-system-modules",
],
dists: [
{
// Legacy dist location for the public file.
dest: "core-for-system-modules-no-annotations.jar",
targets: dist_targets,
},
{
dest: "system-modules/public/core-for-system-modules-no-annotations.jar",
targets: dist_targets,
},
],
}
// Used when compiling higher-level code against core.current.stubs.
java_system_modules {
name: "core-public-stubs-system-modules",
visibility: ["//visibility:public"],
libs: [
"core-current-stubs-for-system-modules-no-annotations",
],
}
java_defaults {
name: "core.module_lib.stubs.defaults",
visibility: ["//visibility:private"],
sdk_version: "none",
system_modules: "none",
}
// A stubs target containing the parts of the public SDK & @SystemApi(MODULE_LIBRARIES) API
// provided by the core libraries.
//
// Don't use this directly, use "sdk_version: module_current".
java_library {
name: "core.module_lib.stubs",
defaults: [
"core.module_lib.stubs.defaults",
],
static_libs: [
"art.module.public.api.stubs.module_lib",
// Replace the following with the module-lib correspondence when Conscrypt or i18N module
// provides @SystemApi(MODULE_LIBRARIES). Currently, assume that only ART module provides
// @SystemApi(MODULE_LIBRARIES).
"conscrypt.module.public.api.stubs",
"i18n.module.public.api.stubs",
],
}
// Produces a dist file that is used by the
// prebuilts/sdk/update_prebuilts.py script to update the prebuilts/sdk
// directory.
java_library {
name: "core-module-lib-stubs-for-system-modules",
visibility: ["//visibility:private"],
static_libs: [
"core.module_lib.stubs",
// This one is not on device but it's needed when javac compiles code
// containing lambdas.
"core-lambda-stubs-for-system-modules",
],
sdk_version: "none",
system_modules: "none",
dist: {
dest: "system-modules/module-lib/core-for-system-modules.jar",
targets: dist_targets,
},
}
// Same as core-module-lib-stubs-for-system-modules, but android annotations are
// stripped. This is used by the Java toolchain, while the annotated stub is to
// be used by Kotlin one.
java_library {
name: "core-module-lib-stubs-for-system-modules-no-annotations",
visibility: ["//visibility:private"],
defaults: [
"system-modules-no-annotations",
],
static_libs: [
"core-module-lib-stubs-for-system-modules",
],
dist: {
dest: "system-modules/module-lib/core-for-system-modules-no-annotations.jar",
targets: dist_targets,
},
}
// Used when compiling higher-level code with sdk_version "module_current"
java_system_modules {
name: "core-module-lib-stubs-system-modules",
libs: [
"core-module-lib-stubs-for-system-modules-no-annotations",
],
visibility: ["//visibility:public"],
}
// Ideally this should be a restricted allowlist but there are hundreds of modules that depend on
// this.
// TODO(http://b/134561230) - limit the number of dependents on this.
core_platform_visibility = ["//visibility:public"]
// Libraries containing the core platform API stubs for the core libraries.
//
// Although this stubs library is primarily used by the Java compiler / build to indicate
// the core platform API surface area, compile_dex: true is used so that the Core Platform
// API annotations are available to the dex tools that enable enforcement of runtime
// accessibility. b/119068555
java_library {
name: "legacy.core.platform.api.stubs",
visibility: core_platform_visibility,
defaults: [
"core.platform.api.stubs.defaults",
],
static_libs: [
"art.module.public.api.stubs.module_lib",
"conscrypt.module.platform.api.stubs",
"legacy.i18n.module.platform.api.stubs",
],
}
java_library {
name: "legacy.core.platform.api.stubs.exportable",
visibility: core_platform_visibility,
defaults: [
"core.platform.api.stubs.defaults",
],
static_libs: [
"art.module.public.api.stubs.exportable.module_lib",
"conscrypt.module.platform.api.stubs.exportable",
"legacy.i18n.module.platform.api.stubs.exportable",
],
}
java_defaults {
name: "android_core_platform_stubs_current_contributions",
api_surface: "core_platform",
api_contributions: [
"art.module.public.api.stubs.source.api.contribution",
"art.module.public.api.stubs.source.system.api.contribution",
"art.module.public.api.stubs.source.module_lib.api.contribution",
"conscrypt.module.platform.api.stubs.source.api.contribution",
"i18n.module.public.api.stubs.source.api.contribution",
],
}
java_defaults {
name: "core.platform.api.stubs.defaults",
hostdex: true,
compile_dex: true,
sdk_version: "none",
system_modules: "none",
patch_module: "java.base",
is_stubs_module: true,
}
// Same as legacy.core.platform.api.stubs, but android annotations are
// stripped. This is used by the Java toolchain, while the annotated stub is to
// be used by Kotlin one.
java_library {
name: "legacy.core.platform.api.no.annotations.stubs",
visibility: core_platform_visibility,
defaults: [
"system-modules-no-annotations",
],
hostdex: true,
compile_dex: true,
static_libs: [
"legacy.core.platform.api.stubs",
],
patch_module: "java.base",
is_stubs_module: true,
}
java_library {
name: "stable.core.platform.api.stubs",
visibility: core_platform_visibility,
defaults: [
"core.platform.api.stubs.defaults",
],
static_libs: [
"art.module.public.api.stubs.module_lib",
// conscrypt only has a stable version, so it is okay to depend on it here:
"conscrypt.module.platform.api.stubs",
"stable.i18n.module.platform.api.stubs",
],
}
// Same as stable.core.platform.api.stubs, but android annotations are
// stripped. This is used by the Java toolchain, while the annotated stub is to
// be used by Kotlin one.
java_library {
name: "stable.core.platform.api.no.annotations.stubs",
visibility: core_platform_visibility,
defaults: [
"system-modules-no-annotations",
],
hostdex: true,
compile_dex: true,
static_libs: [
"stable.core.platform.api.stubs",
],
patch_module: "java.base",
is_stubs_module: true,
}
// Used when compiling higher-level code against *.core.platform.api.stubs.
java_system_modules {
name: "legacy-core-platform-api-stubs-system-modules",
visibility: core_platform_visibility,
libs: [
"legacy.core.platform.api.no.annotations.stubs",
// This one is not on device but it's needed when javac compiles code
// containing lambdas.
"core-lambda-stubs-for-system-modules",
],
}
java_system_modules {
name: "stable-core-platform-api-stubs-system-modules",
visibility: core_platform_visibility,
libs: [
"stable.core.platform.api.no.annotations.stubs",
// This one is not on device but it's needed when javac compiles code
// containing lambdas.
"core-lambda-stubs-for-system-modules",
],
}
// Used when compiling higher-level code against art.module.public.api.stubs.
// This abstraction should come from the inner tree linking against the stubs
// and not from an "sdk", since parts of this abstraction do not belong to an
// official API (e.g. stub-annotations).
//
// This is only intended for use within core libraries and must not be used
// from outside.
java_system_modules {
name: "art-module-public-api-stubs-system-modules",
visibility: [
"//art/build/sdk",
"//external/conscrypt",
"//external/icu/android_icu4j",
"//external/wycheproof",
],
libs: [
"art.module.public.api.stubs",
// This one is not on device but it's needed when javac compiles code
// containing lambdas.
"core-lambda-stubs-for-system-modules",
// Ensure that core libraries that depend on the public API can access
// the UnsupportedAppUsage, CorePlatformApi and IntraCoreApi
// annotations.
"art.module.api.annotations.for.system.modules",
],
}
// Used when compiling higher-level code against art.module.public.api.stubs.module_lib.
//
// This is only intended for use within core libraries and must not be used
// from outside.
java_system_modules {
name: "art-module-lib-api-stubs-system-modules",
visibility: [
"//art/build/sdk",
"//external/conscrypt",
"//external/icu/android_icu4j",
],
libs: [
"art.module.public.api.stubs.module_lib",
],
}
// Used when compiling against art.module.intra.core.api.stubs.
java_system_modules {
name: "art-module-intra-core-api-stubs-system-modules",
visibility: [
"//art/build/sdk",
"//external/bouncycastle",
"//external/conscrypt",
"//external/icu/android_icu4j",
],
libs: [
// The intra core API stubs library.
"art.module.intra.core.api.stubs",
// Additional classes needed by javac but which are not present in the stubs.
"art-module-intra-core-api-stubs-system-modules-lib",
],
}
|