blob: 8c808e4b906ec909707d0b19a3ce3dc106311383 [file] [log] [blame]
Paul Duffinbb360c32021-07-10 23:31:50 +01001// Copyright (C) 2021 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//
16// Definitions for building the Android core libraries, i.e. ART, I18n and
17// Conscrypt.
18//
19// These are here as the definitions are used by the build itself and include
20// parts from all three of those modules.
21//
22
23// A stubs target containing the parts of the public SDK API provided by the
24// core libraries.
25//
26// Don't use this directly, use "sdk_version: core_current".
Bob Badour36dc7c62021-08-27 13:30:35 -070027package {
28 default_applicable_licenses: ["Android-Apache-2.0"],
29}
30
Paul Duffinbce9f082021-10-28 12:34:41 +010031dist_targets = [
32 "sdk",
33 "win_sdk",
34]
35
Jihoon Kang67b64432023-05-31 22:25:21 +000036java_defaults {
37 name: "core.current.stubs.defaults",
Paul Duffinbb360c32021-07-10 23:31:50 +010038 visibility: ["//visibility:public"],
Jihoon Kang67b64432023-05-31 22:25:21 +000039 sdk_version: "none",
40 system_modules: "none",
Jihoon Kang85bc1932024-07-01 17:04:46 +000041 is_stubs_module: true,
Jihoon Kang67b64432023-05-31 22:25:21 +000042}
43
Jihoon Kanga043a1b2024-03-21 20:54:49 +000044soong_config_module_type {
45 name: "core_current_stubs_soong_config_defaults",
46 module_type: "java_defaults",
47 config_namespace: "ANDROID",
48 bool_variables: [
49 "release_hidden_api_exportable_stubs",
50 ],
51 properties: [
52 "dist.targets",
53 "dist.dest",
54 ],
55}
56
57core_current_stubs_soong_config_defaults {
58 name: "core_current_stubs_everything_soong_config_defaults",
59 soong_config_variables: {
60 release_hidden_api_exportable_stubs: {
61 conditions_default: {
62 dist: {
63 targets: dist_targets,
64 dest: "core.current.stubs.jar",
65 },
66 },
67 },
68 },
69}
70
71core_current_stubs_soong_config_defaults {
72 name: "core_current_stubs_exportable_soong_config_defaults",
73 soong_config_variables: {
74 release_hidden_api_exportable_stubs: {
75 dist: {
76 targets: dist_targets,
77 dest: "core.current.stubs.jar",
78 },
79 },
80 },
81}
82
Jihoon Kang67b64432023-05-31 22:25:21 +000083java_library {
Jihoon Kangb0f4c022024-08-06 00:15:25 +000084 name: "core.current.stubs",
Jihoon Kang67b64432023-05-31 22:25:21 +000085 defaults: [
86 "core.current.stubs.defaults",
Jihoon Kanga043a1b2024-03-21 20:54:49 +000087 "core_current_stubs_everything_soong_config_defaults",
Jihoon Kang67b64432023-05-31 22:25:21 +000088 ],
Paul Duffinbb360c32021-07-10 23:31:50 +010089 static_libs: [
90 "art.module.public.api.stubs",
91 "conscrypt.module.public.api.stubs",
92 "i18n.module.public.api.stubs",
93 ],
Jihoon Kang67b64432023-05-31 22:25:21 +000094}
Paul Duffinbb360c32021-07-10 23:31:50 +010095
Jihoon Kangb0f4c022024-08-06 00:15:25 +000096// Used for bootstrapping ART system modules
Jihoon Kangb281ddc2023-08-17 18:14:35 +000097java_api_library {
98 name: "core.current.stubs.from-text",
Jihoon Kangb0f4c022024-08-06 00:15:25 +000099 defaults: [
100 "core.current.stubs.defaults",
101 ],
Jihoon Kangb281ddc2023-08-17 18:14:35 +0000102 api_surface: "core",
103 api_contributions: [
104 "art.module.public.api.stubs.source.api.contribution",
105 "conscrypt.module.public.api.stubs.source.api.contribution",
106 "i18n.module.public.api.stubs.source.api.contribution",
107 ],
108 libs: [
109 "stub-annotations",
110 ],
Jihoon Kang063ec002023-06-28 01:16:23 +0000111 enable_validation: false,
Jihoon Kang5d701272024-02-15 21:53:49 +0000112 stubs_type: "everything",
Jihoon Kangb281ddc2023-08-17 18:14:35 +0000113}
114
Jihoon Kang67b64432023-05-31 22:25:21 +0000115java_library {
Jihoon Kangb0f4c022024-08-06 00:15:25 +0000116 name: "core.current.stubs.exportable",
Jihoon Kangbd093452023-12-26 19:08:01 +0000117 defaults: [
118 "core.current.stubs.defaults",
Jihoon Kanga043a1b2024-03-21 20:54:49 +0000119 "core_current_stubs_exportable_soong_config_defaults",
Jihoon Kangbd093452023-12-26 19:08:01 +0000120 ],
121 static_libs: [
122 "art.module.public.api.stubs.exportable",
123 "conscrypt.module.public.api.stubs.exportable",
124 "i18n.module.public.api.stubs.exportable",
125 ],
Jihoon Kangbd093452023-12-26 19:08:01 +0000126}
127
Paul Duffinbb360c32021-07-10 23:31:50 +0100128// Distributed with the SDK for turning into system modules to compile apps
129// against.
Paul Duffinbce9f082021-10-28 12:34:41 +0100130//
131// Also, produces dist files that are used by the
132// prebuilts/sdk/update_prebuilts.py script to update the prebuilts/sdk
133// directory.
Paul Duffinbb360c32021-07-10 23:31:50 +0100134java_library {
Jihoon Kang23919182024-11-06 20:47:11 +0000135 name: "core-current-stubs-for-system-modules-exportable",
Paul Duffinbb360c32021-07-10 23:31:50 +0100136 visibility: ["//development/sdk"],
137 static_libs: [
Jihoon Kang23919182024-11-06 20:47:11 +0000138 "core.current.stubs.exportable",
Paul Duffinbb360c32021-07-10 23:31:50 +0100139 // This one is not on device but it's needed when javac compiles code
140 // containing lambdas.
141 "core-lambda-stubs-for-system-modules",
Paul Duffinbb360c32021-07-10 23:31:50 +0100142 ],
143 sdk_version: "none",
144 system_modules: "none",
Paul Duffinbce9f082021-10-28 12:34:41 +0100145 dists: [
146 {
147 // Legacy dist location for the public file.
148 dest: "core-for-system-modules.jar",
149 targets: dist_targets,
150 },
151 {
152 dest: "system-modules/public/core-for-system-modules.jar",
153 targets: dist_targets,
154 },
155 ],
Paul Duffinbb360c32021-07-10 23:31:50 +0100156}
157
Jihoon Kang23919182024-11-06 20:47:11 +0000158java_library {
159 name: "core-current-stubs-for-system-modules",
160 visibility: ["//development/sdk"],
161 static_libs: [
162 "core.current.stubs",
163 // This one is not on device but it's needed when javac compiles code
164 // containing lambdas.
165 "core-lambda-stubs-for-system-modules",
166 ],
167 sdk_version: "none",
168 system_modules: "none",
169}
170
Spandan Dasb0f3d422023-03-29 20:59:47 +0000171// Defaults module to strip out android annotations
172java_defaults {
173 name: "system-modules-no-annotations",
174 sdk_version: "none",
175 system_modules: "none",
176 jarjar_rules: "jarjar-strip-annotations-rules.txt",
177}
178
Sorin Bascabdbae602022-07-26 15:24:15 +0100179// Same as core-current-stubs-for-system-modules, but android annotations are
180// stripped.
181java_library {
182 name: "core-current-stubs-for-system-modules-no-annotations",
183 visibility: ["//development/sdk"],
Spandan Dasb0f3d422023-03-29 20:59:47 +0000184 defaults: [
185 "system-modules-no-annotations",
186 ],
Sorin Bascabdbae602022-07-26 15:24:15 +0100187 static_libs: [
188 "core-current-stubs-for-system-modules",
189 ],
Sorin Bascabdbae602022-07-26 15:24:15 +0100190 dists: [
191 {
192 // Legacy dist location for the public file.
193 dest: "core-for-system-modules-no-annotations.jar",
194 targets: dist_targets,
195 },
196 {
197 dest: "system-modules/public/core-for-system-modules-no-annotations.jar",
198 targets: dist_targets,
199 },
200 ],
Sorin Bascabdbae602022-07-26 15:24:15 +0100201}
202
Paul Duffinbb360c32021-07-10 23:31:50 +0100203// Used when compiling higher-level code against core.current.stubs.
204java_system_modules {
Paul Duffin10fb76f2021-11-03 16:53:31 +0000205 name: "core-public-stubs-system-modules",
Paul Duffinbb360c32021-07-10 23:31:50 +0100206 visibility: ["//visibility:public"],
207 libs: [
Sorin Bascabdbae602022-07-26 15:24:15 +0100208 "core-current-stubs-for-system-modules-no-annotations",
Paul Duffinbb360c32021-07-10 23:31:50 +0100209 ],
210}
211
Romain Jobredeaux9d54fda2023-07-28 10:32:50 -0400212java_defaults {
213 name: "core.module_lib.stubs.defaults",
214 visibility: ["//visibility:private"],
215 sdk_version: "none",
216 system_modules: "none",
217}
218
Paul Duffinbb360c32021-07-10 23:31:50 +0100219// A stubs target containing the parts of the public SDK & @SystemApi(MODULE_LIBRARIES) API
220// provided by the core libraries.
221//
222// Don't use this directly, use "sdk_version: module_current".
223java_library {
224 name: "core.module_lib.stubs",
Romain Jobredeaux9d54fda2023-07-28 10:32:50 -0400225 defaults: [
226 "core.module_lib.stubs.defaults",
227 ],
228 static_libs: [
Paul Duffinbb360c32021-07-10 23:31:50 +0100229 "art.module.public.api.stubs.module_lib",
230
231 // Replace the following with the module-lib correspondence when Conscrypt or i18N module
232 // provides @SystemApi(MODULE_LIBRARIES). Currently, assume that only ART module provides
233 // @SystemApi(MODULE_LIBRARIES).
234 "conscrypt.module.public.api.stubs",
235 "i18n.module.public.api.stubs",
236 ],
Paul Duffinbb360c32021-07-10 23:31:50 +0100237}
238
Paul Duffinbce9f082021-10-28 12:34:41 +0100239// Produces a dist file that is used by the
240// prebuilts/sdk/update_prebuilts.py script to update the prebuilts/sdk
241// directory.
242java_library {
243 name: "core-module-lib-stubs-for-system-modules",
244 visibility: ["//visibility:private"],
245 static_libs: [
Paul Duffinbb360c32021-07-10 23:31:50 +0100246 "core.module_lib.stubs",
247 // This one is not on device but it's needed when javac compiles code
248 // containing lambdas.
249 "core-lambda-stubs-for-system-modules",
Paul Duffinbb360c32021-07-10 23:31:50 +0100250 ],
Paul Duffinbce9f082021-10-28 12:34:41 +0100251 sdk_version: "none",
252 system_modules: "none",
253 dist: {
254 dest: "system-modules/module-lib/core-for-system-modules.jar",
255 targets: dist_targets,
256 },
257}
258
Sorin Basca69f4b082022-05-09 13:55:11 +0100259// Same as core-module-lib-stubs-for-system-modules, but android annotations are
260// stripped. This is used by the Java toolchain, while the annotated stub is to
261// be used by Kotlin one.
262java_library {
263 name: "core-module-lib-stubs-for-system-modules-no-annotations",
264 visibility: ["//visibility:private"],
Spandan Dasb0f3d422023-03-29 20:59:47 +0000265 defaults: [
266 "system-modules-no-annotations",
267 ],
Sorin Basca69f4b082022-05-09 13:55:11 +0100268 static_libs: [
269 "core-module-lib-stubs-for-system-modules",
270 ],
Sorin Basca69f4b082022-05-09 13:55:11 +0100271 dist: {
272 dest: "system-modules/module-lib/core-for-system-modules-no-annotations.jar",
273 targets: dist_targets,
274 },
Sorin Basca69f4b082022-05-09 13:55:11 +0100275}
276
Paul Duffinbce9f082021-10-28 12:34:41 +0100277// Used when compiling higher-level code with sdk_version "module_current"
278java_system_modules {
279 name: "core-module-lib-stubs-system-modules",
280 libs: [
Sorin Basca69f4b082022-05-09 13:55:11 +0100281 "core-module-lib-stubs-for-system-modules-no-annotations",
Paul Duffinbce9f082021-10-28 12:34:41 +0100282 ],
Paul Duffinbb360c32021-07-10 23:31:50 +0100283 visibility: ["//visibility:public"],
284}
285
286// Ideally this should be a restricted allowlist but there are hundreds of modules that depend on
287// this.
288// TODO(http://b/134561230) - limit the number of dependents on this.
289core_platform_visibility = ["//visibility:public"]
290
291// Libraries containing the core platform API stubs for the core libraries.
292//
293// Although this stubs library is primarily used by the Java compiler / build to indicate
294// the core platform API surface area, compile_dex: true is used so that the Core Platform
295// API annotations are available to the dex tools that enable enforcement of runtime
296// accessibility. b/119068555
297java_library {
Jihoon Kangb0f4c022024-08-06 00:15:25 +0000298 name: "legacy.core.platform.api.stubs",
Paul Duffinbb360c32021-07-10 23:31:50 +0100299 visibility: core_platform_visibility,
Jihoon Kang67b64432023-05-31 22:25:21 +0000300 defaults: [
301 "core.platform.api.stubs.defaults",
302 ],
Paul Duffinbb360c32021-07-10 23:31:50 +0100303 static_libs: [
304 "art.module.public.api.stubs.module_lib",
305 "conscrypt.module.platform.api.stubs",
306 "legacy.i18n.module.platform.api.stubs",
307 ],
Jihoon Kang67b64432023-05-31 22:25:21 +0000308}
309
Jihoon Kangbd093452023-12-26 19:08:01 +0000310java_library {
Jihoon Kangb0f4c022024-08-06 00:15:25 +0000311 name: "legacy.core.platform.api.stubs.exportable",
Jihoon Kangbd093452023-12-26 19:08:01 +0000312 visibility: core_platform_visibility,
313 defaults: [
314 "core.platform.api.stubs.defaults",
315 ],
316 static_libs: [
317 "art.module.public.api.stubs.exportable.module_lib",
318 "conscrypt.module.platform.api.stubs.exportable",
319 "legacy.i18n.module.platform.api.stubs.exportable",
320 ],
321}
322
Jihoon Kangb281ddc2023-08-17 18:14:35 +0000323java_defaults {
324 name: "android_core_platform_stubs_current_contributions",
325 api_surface: "core_platform",
326 api_contributions: [
327 "art.module.public.api.stubs.source.api.contribution",
328 "art.module.public.api.stubs.source.system.api.contribution",
329 "art.module.public.api.stubs.source.module_lib.api.contribution",
330 "conscrypt.module.platform.api.stubs.source.api.contribution",
331 "i18n.module.public.api.stubs.source.api.contribution",
332 ],
333}
334
Jihoon Kang67b64432023-05-31 22:25:21 +0000335java_defaults {
336 name: "core.platform.api.stubs.defaults",
337 hostdex: true,
338 compile_dex: true,
339
340 sdk_version: "none",
341 system_modules: "none",
Paul Duffinbb360c32021-07-10 23:31:50 +0100342 patch_module: "java.base",
Jihoon Kang85bc1932024-07-01 17:04:46 +0000343 is_stubs_module: true,
Paul Duffinbb360c32021-07-10 23:31:50 +0100344}
345
Sorin Basca69f4b082022-05-09 13:55:11 +0100346// Same as legacy.core.platform.api.stubs, but android annotations are
347// stripped. This is used by the Java toolchain, while the annotated stub is to
348// be used by Kotlin one.
349java_library {
350 name: "legacy.core.platform.api.no.annotations.stubs",
351 visibility: core_platform_visibility,
Spandan Dasb0f3d422023-03-29 20:59:47 +0000352 defaults: [
353 "system-modules-no-annotations",
354 ],
Sorin Basca69f4b082022-05-09 13:55:11 +0100355 hostdex: true,
356 compile_dex: true,
357
Sorin Basca69f4b082022-05-09 13:55:11 +0100358 static_libs: [
359 "legacy.core.platform.api.stubs",
360 ],
361 patch_module: "java.base",
Jihoon Kang85bc1932024-07-01 17:04:46 +0000362 is_stubs_module: true,
Sorin Basca69f4b082022-05-09 13:55:11 +0100363}
364
Paul Duffinbb360c32021-07-10 23:31:50 +0100365java_library {
Jihoon Kangb0f4c022024-08-06 00:15:25 +0000366 name: "stable.core.platform.api.stubs",
Paul Duffinbb360c32021-07-10 23:31:50 +0100367 visibility: core_platform_visibility,
Jihoon Kang67b64432023-05-31 22:25:21 +0000368 defaults: [
369 "core.platform.api.stubs.defaults",
370 ],
Paul Duffinbb360c32021-07-10 23:31:50 +0100371 static_libs: [
372 "art.module.public.api.stubs.module_lib",
373 // conscrypt only has a stable version, so it is okay to depend on it here:
374 "conscrypt.module.platform.api.stubs",
375 "stable.i18n.module.platform.api.stubs",
376 ],
Jihoon Kang67b64432023-05-31 22:25:21 +0000377}
378
Sorin Basca69f4b082022-05-09 13:55:11 +0100379// Same as stable.core.platform.api.stubs, but android annotations are
380// stripped. This is used by the Java toolchain, while the annotated stub is to
381// be used by Kotlin one.
382java_library {
383 name: "stable.core.platform.api.no.annotations.stubs",
384 visibility: core_platform_visibility,
Spandan Dasb0f3d422023-03-29 20:59:47 +0000385 defaults: [
386 "system-modules-no-annotations",
387 ],
Sorin Basca69f4b082022-05-09 13:55:11 +0100388 hostdex: true,
389 compile_dex: true,
390
Sorin Basca69f4b082022-05-09 13:55:11 +0100391 static_libs: [
392 "stable.core.platform.api.stubs",
393 ],
394 patch_module: "java.base",
Jihoon Kang85bc1932024-07-01 17:04:46 +0000395 is_stubs_module: true,
Sorin Basca69f4b082022-05-09 13:55:11 +0100396}
397
Paul Duffinbb360c32021-07-10 23:31:50 +0100398// Used when compiling higher-level code against *.core.platform.api.stubs.
399java_system_modules {
400 name: "legacy-core-platform-api-stubs-system-modules",
401 visibility: core_platform_visibility,
402 libs: [
Sorin Basca69f4b082022-05-09 13:55:11 +0100403 "legacy.core.platform.api.no.annotations.stubs",
Paul Duffinbb360c32021-07-10 23:31:50 +0100404 // This one is not on device but it's needed when javac compiles code
405 // containing lambdas.
406 "core-lambda-stubs-for-system-modules",
Paul Duffinbb360c32021-07-10 23:31:50 +0100407 ],
408}
409
410java_system_modules {
411 name: "stable-core-platform-api-stubs-system-modules",
412 visibility: core_platform_visibility,
413 libs: [
Sorin Basca69f4b082022-05-09 13:55:11 +0100414 "stable.core.platform.api.no.annotations.stubs",
Paul Duffinbb360c32021-07-10 23:31:50 +0100415 // This one is not on device but it's needed when javac compiles code
416 // containing lambdas.
417 "core-lambda-stubs-for-system-modules",
Paul Duffinbb360c32021-07-10 23:31:50 +0100418 ],
419}
Spandan Dasfe85ca22022-12-08 02:42:25 +0000420
421// Used when compiling higher-level code against art.module.public.api.stubs.
422// This abstraction should come from the inner tree linking against the stubs
423// and not from an "sdk", since parts of this abstraction do not belong to an
424// official API (e.g. stub-annotations).
425//
426// This is only intended for use within core libraries and must not be used
427// from outside.
428java_system_modules {
429 name: "art-module-public-api-stubs-system-modules",
430 visibility: [
431 "//art/build/sdk",
432 "//external/conscrypt",
433 "//external/icu/android_icu4j",
434 "//external/wycheproof",
435 ],
436 libs: [
437 "art.module.public.api.stubs",
438 // This one is not on device but it's needed when javac compiles code
439 // containing lambdas.
440 "core-lambda-stubs-for-system-modules",
Spandan Dasfe85ca22022-12-08 02:42:25 +0000441
442 // Ensure that core libraries that depend on the public API can access
443 // the UnsupportedAppUsage, CorePlatformApi and IntraCoreApi
444 // annotations.
445 "art.module.api.annotations.for.system.modules",
Spandan Dasfe85ca22022-12-08 02:42:25 +0000446 ],
447}
448
449// Used when compiling higher-level code against art.module.public.api.stubs.module_lib.
450//
451// This is only intended for use within core libraries and must not be used
452// from outside.
453java_system_modules {
454 name: "art-module-lib-api-stubs-system-modules",
455 visibility: [
456 "//art/build/sdk",
457 "//external/conscrypt",
458 "//external/icu/android_icu4j",
459 ],
460 libs: [
461 "art.module.public.api.stubs.module_lib",
462 ],
463}
464
465// Used when compiling against art.module.intra.core.api.stubs.
466java_system_modules {
467 name: "art-module-intra-core-api-stubs-system-modules",
468 visibility: [
469 "//art/build/sdk",
470 "//external/bouncycastle",
471 "//external/conscrypt",
472 "//external/icu/android_icu4j",
473 ],
474 libs: [
475 // The intra core API stubs library.
476 "art.module.intra.core.api.stubs",
477
478 // Additional classes needed by javac but which are not present in the stubs.
479 "art-module-intra-core-api-stubs-system-modules-lib",
480 ],
481}