blob: 1cca7ad49d2d78269185dddcb30410643fd4a7a1 [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
44java_library {
Jihoon Kangb0f4c022024-08-06 00:15:25 +000045 name: "core.current.stubs",
Jihoon Kang67b64432023-05-31 22:25:21 +000046 defaults: [
47 "core.current.stubs.defaults",
48 ],
Paul Duffinbb360c32021-07-10 23:31:50 +010049 static_libs: [
50 "art.module.public.api.stubs",
51 "conscrypt.module.public.api.stubs",
52 "i18n.module.public.api.stubs",
53 ],
Jihoon Kang67b64432023-05-31 22:25:21 +000054}
Paul Duffinbb360c32021-07-10 23:31:50 +010055
Jihoon Kangb0f4c022024-08-06 00:15:25 +000056// Used for bootstrapping ART system modules
Jihoon Kangb281ddc2023-08-17 18:14:35 +000057java_api_library {
58 name: "core.current.stubs.from-text",
Jihoon Kangb0f4c022024-08-06 00:15:25 +000059 defaults: [
60 "core.current.stubs.defaults",
61 ],
Jihoon Kangb281ddc2023-08-17 18:14:35 +000062 api_surface: "core",
63 api_contributions: [
64 "art.module.public.api.stubs.source.api.contribution",
65 "conscrypt.module.public.api.stubs.source.api.contribution",
66 "i18n.module.public.api.stubs.source.api.contribution",
67 ],
68 libs: [
69 "stub-annotations",
70 ],
Jihoon Kang063ec002023-06-28 01:16:23 +000071 enable_validation: false,
Jihoon Kang5d701272024-02-15 21:53:49 +000072 stubs_type: "everything",
Jihoon Kangb281ddc2023-08-17 18:14:35 +000073}
74
Jihoon Kang67b64432023-05-31 22:25:21 +000075java_library {
Jihoon Kangb0f4c022024-08-06 00:15:25 +000076 name: "core.current.stubs.exportable",
Jihoon Kangbd093452023-12-26 19:08:01 +000077 defaults: [
78 "core.current.stubs.defaults",
79 ],
80 static_libs: [
81 "art.module.public.api.stubs.exportable",
82 "conscrypt.module.public.api.stubs.exportable",
83 "i18n.module.public.api.stubs.exportable",
84 ],
85 dist: {
86 targets: dist_targets,
87 dest: "core.current.stubs.jar",
88 },
89}
90
Paul Duffinbb360c32021-07-10 23:31:50 +010091// Distributed with the SDK for turning into system modules to compile apps
92// against.
Paul Duffinbce9f082021-10-28 12:34:41 +010093//
94// Also, produces dist files that are used by the
95// prebuilts/sdk/update_prebuilts.py script to update the prebuilts/sdk
96// directory.
Paul Duffinbb360c32021-07-10 23:31:50 +010097java_library {
98 name: "core-current-stubs-for-system-modules",
99 visibility: ["//development/sdk"],
100 static_libs: [
101 "core.current.stubs",
102 // This one is not on device but it's needed when javac compiles code
103 // containing lambdas.
104 "core-lambda-stubs-for-system-modules",
Paul Duffinbb360c32021-07-10 23:31:50 +0100105 ],
106 sdk_version: "none",
107 system_modules: "none",
Paul Duffinbce9f082021-10-28 12:34:41 +0100108 dists: [
109 {
110 // Legacy dist location for the public file.
111 dest: "core-for-system-modules.jar",
112 targets: dist_targets,
113 },
114 {
115 dest: "system-modules/public/core-for-system-modules.jar",
116 targets: dist_targets,
117 },
118 ],
Paul Duffinbb360c32021-07-10 23:31:50 +0100119}
120
Spandan Dasb0f3d422023-03-29 20:59:47 +0000121// Defaults module to strip out android annotations
122java_defaults {
123 name: "system-modules-no-annotations",
124 sdk_version: "none",
125 system_modules: "none",
126 jarjar_rules: "jarjar-strip-annotations-rules.txt",
127}
128
Sorin Bascabdbae602022-07-26 15:24:15 +0100129// Same as core-current-stubs-for-system-modules, but android annotations are
130// stripped.
131java_library {
132 name: "core-current-stubs-for-system-modules-no-annotations",
133 visibility: ["//development/sdk"],
Spandan Dasb0f3d422023-03-29 20:59:47 +0000134 defaults: [
135 "system-modules-no-annotations",
136 ],
Sorin Bascabdbae602022-07-26 15:24:15 +0100137 static_libs: [
138 "core-current-stubs-for-system-modules",
139 ],
Sorin Bascabdbae602022-07-26 15:24:15 +0100140 dists: [
141 {
142 // Legacy dist location for the public file.
143 dest: "core-for-system-modules-no-annotations.jar",
144 targets: dist_targets,
145 },
146 {
147 dest: "system-modules/public/core-for-system-modules-no-annotations.jar",
148 targets: dist_targets,
149 },
150 ],
Sorin Bascabdbae602022-07-26 15:24:15 +0100151}
152
Paul Duffinbb360c32021-07-10 23:31:50 +0100153// Used when compiling higher-level code against core.current.stubs.
154java_system_modules {
Paul Duffin10fb76f2021-11-03 16:53:31 +0000155 name: "core-public-stubs-system-modules",
Paul Duffinbb360c32021-07-10 23:31:50 +0100156 visibility: ["//visibility:public"],
157 libs: [
Sorin Bascabdbae602022-07-26 15:24:15 +0100158 "core-current-stubs-for-system-modules-no-annotations",
Paul Duffinbb360c32021-07-10 23:31:50 +0100159 ],
160}
161
Romain Jobredeaux9d54fda2023-07-28 10:32:50 -0400162java_defaults {
163 name: "core.module_lib.stubs.defaults",
164 visibility: ["//visibility:private"],
165 sdk_version: "none",
166 system_modules: "none",
167}
168
Paul Duffinbb360c32021-07-10 23:31:50 +0100169// A stubs target containing the parts of the public SDK & @SystemApi(MODULE_LIBRARIES) API
170// provided by the core libraries.
171//
172// Don't use this directly, use "sdk_version: module_current".
173java_library {
174 name: "core.module_lib.stubs",
Romain Jobredeaux9d54fda2023-07-28 10:32:50 -0400175 defaults: [
176 "core.module_lib.stubs.defaults",
177 ],
178 static_libs: [
Paul Duffinbb360c32021-07-10 23:31:50 +0100179 "art.module.public.api.stubs.module_lib",
180
181 // Replace the following with the module-lib correspondence when Conscrypt or i18N module
182 // provides @SystemApi(MODULE_LIBRARIES). Currently, assume that only ART module provides
183 // @SystemApi(MODULE_LIBRARIES).
184 "conscrypt.module.public.api.stubs",
185 "i18n.module.public.api.stubs",
186 ],
Paul Duffinbb360c32021-07-10 23:31:50 +0100187}
188
Paul Duffinbce9f082021-10-28 12:34:41 +0100189// Produces a dist file that is used by the
190// prebuilts/sdk/update_prebuilts.py script to update the prebuilts/sdk
191// directory.
192java_library {
193 name: "core-module-lib-stubs-for-system-modules",
194 visibility: ["//visibility:private"],
195 static_libs: [
Paul Duffinbb360c32021-07-10 23:31:50 +0100196 "core.module_lib.stubs",
197 // This one is not on device but it's needed when javac compiles code
198 // containing lambdas.
199 "core-lambda-stubs-for-system-modules",
Paul Duffinbb360c32021-07-10 23:31:50 +0100200 ],
Paul Duffinbce9f082021-10-28 12:34:41 +0100201 sdk_version: "none",
202 system_modules: "none",
203 dist: {
204 dest: "system-modules/module-lib/core-for-system-modules.jar",
205 targets: dist_targets,
206 },
207}
208
Sorin Basca69f4b082022-05-09 13:55:11 +0100209// Same as core-module-lib-stubs-for-system-modules, but android annotations are
210// stripped. This is used by the Java toolchain, while the annotated stub is to
211// be used by Kotlin one.
212java_library {
213 name: "core-module-lib-stubs-for-system-modules-no-annotations",
214 visibility: ["//visibility:private"],
Spandan Dasb0f3d422023-03-29 20:59:47 +0000215 defaults: [
216 "system-modules-no-annotations",
217 ],
Sorin Basca69f4b082022-05-09 13:55:11 +0100218 static_libs: [
219 "core-module-lib-stubs-for-system-modules",
220 ],
Sorin Basca69f4b082022-05-09 13:55:11 +0100221 dist: {
222 dest: "system-modules/module-lib/core-for-system-modules-no-annotations.jar",
223 targets: dist_targets,
224 },
Sorin Basca69f4b082022-05-09 13:55:11 +0100225}
226
Paul Duffinbce9f082021-10-28 12:34:41 +0100227// Used when compiling higher-level code with sdk_version "module_current"
228java_system_modules {
229 name: "core-module-lib-stubs-system-modules",
230 libs: [
Sorin Basca69f4b082022-05-09 13:55:11 +0100231 "core-module-lib-stubs-for-system-modules-no-annotations",
Paul Duffinbce9f082021-10-28 12:34:41 +0100232 ],
Paul Duffinbb360c32021-07-10 23:31:50 +0100233 visibility: ["//visibility:public"],
234}
235
236// Ideally this should be a restricted allowlist but there are hundreds of modules that depend on
237// this.
238// TODO(http://b/134561230) - limit the number of dependents on this.
239core_platform_visibility = ["//visibility:public"]
240
241// Libraries containing the core platform API stubs for the core libraries.
242//
243// Although this stubs library is primarily used by the Java compiler / build to indicate
244// the core platform API surface area, compile_dex: true is used so that the Core Platform
245// API annotations are available to the dex tools that enable enforcement of runtime
246// accessibility. b/119068555
247java_library {
Jihoon Kangb0f4c022024-08-06 00:15:25 +0000248 name: "legacy.core.platform.api.stubs",
Paul Duffinbb360c32021-07-10 23:31:50 +0100249 visibility: core_platform_visibility,
Jihoon Kang67b64432023-05-31 22:25:21 +0000250 defaults: [
251 "core.platform.api.stubs.defaults",
252 ],
Paul Duffinbb360c32021-07-10 23:31:50 +0100253 static_libs: [
254 "art.module.public.api.stubs.module_lib",
255 "conscrypt.module.platform.api.stubs",
256 "legacy.i18n.module.platform.api.stubs",
257 ],
Jihoon Kang67b64432023-05-31 22:25:21 +0000258}
259
Jihoon Kangbd093452023-12-26 19:08:01 +0000260java_library {
Jihoon Kangb0f4c022024-08-06 00:15:25 +0000261 name: "legacy.core.platform.api.stubs.exportable",
Jihoon Kangbd093452023-12-26 19:08:01 +0000262 visibility: core_platform_visibility,
263 defaults: [
264 "core.platform.api.stubs.defaults",
265 ],
266 static_libs: [
267 "art.module.public.api.stubs.exportable.module_lib",
268 "conscrypt.module.platform.api.stubs.exportable",
269 "legacy.i18n.module.platform.api.stubs.exportable",
270 ],
271}
272
Jihoon Kangb281ddc2023-08-17 18:14:35 +0000273java_defaults {
274 name: "android_core_platform_stubs_current_contributions",
275 api_surface: "core_platform",
276 api_contributions: [
277 "art.module.public.api.stubs.source.api.contribution",
278 "art.module.public.api.stubs.source.system.api.contribution",
279 "art.module.public.api.stubs.source.module_lib.api.contribution",
280 "conscrypt.module.platform.api.stubs.source.api.contribution",
281 "i18n.module.public.api.stubs.source.api.contribution",
282 ],
283}
284
Jihoon Kang67b64432023-05-31 22:25:21 +0000285java_defaults {
286 name: "core.platform.api.stubs.defaults",
287 hostdex: true,
288 compile_dex: true,
289
290 sdk_version: "none",
291 system_modules: "none",
Paul Duffinbb360c32021-07-10 23:31:50 +0100292 patch_module: "java.base",
Jihoon Kang85bc1932024-07-01 17:04:46 +0000293 is_stubs_module: true,
Paul Duffinbb360c32021-07-10 23:31:50 +0100294}
295
Sorin Basca69f4b082022-05-09 13:55:11 +0100296// Same as legacy.core.platform.api.stubs, but android annotations are
297// stripped. This is used by the Java toolchain, while the annotated stub is to
298// be used by Kotlin one.
299java_library {
300 name: "legacy.core.platform.api.no.annotations.stubs",
301 visibility: core_platform_visibility,
Spandan Dasb0f3d422023-03-29 20:59:47 +0000302 defaults: [
303 "system-modules-no-annotations",
304 ],
Sorin Basca69f4b082022-05-09 13:55:11 +0100305 hostdex: true,
306 compile_dex: true,
307
Sorin Basca69f4b082022-05-09 13:55:11 +0100308 static_libs: [
309 "legacy.core.platform.api.stubs",
310 ],
311 patch_module: "java.base",
Jihoon Kang85bc1932024-07-01 17:04:46 +0000312 is_stubs_module: true,
Sorin Basca69f4b082022-05-09 13:55:11 +0100313}
314
Paul Duffinbb360c32021-07-10 23:31:50 +0100315java_library {
Jihoon Kangb0f4c022024-08-06 00:15:25 +0000316 name: "stable.core.platform.api.stubs",
Paul Duffinbb360c32021-07-10 23:31:50 +0100317 visibility: core_platform_visibility,
Jihoon Kang67b64432023-05-31 22:25:21 +0000318 defaults: [
319 "core.platform.api.stubs.defaults",
320 ],
Paul Duffinbb360c32021-07-10 23:31:50 +0100321 static_libs: [
322 "art.module.public.api.stubs.module_lib",
323 // conscrypt only has a stable version, so it is okay to depend on it here:
324 "conscrypt.module.platform.api.stubs",
325 "stable.i18n.module.platform.api.stubs",
326 ],
Jihoon Kang67b64432023-05-31 22:25:21 +0000327}
328
Sorin Basca69f4b082022-05-09 13:55:11 +0100329// Same as stable.core.platform.api.stubs, but android annotations are
330// stripped. This is used by the Java toolchain, while the annotated stub is to
331// be used by Kotlin one.
332java_library {
333 name: "stable.core.platform.api.no.annotations.stubs",
334 visibility: core_platform_visibility,
Spandan Dasb0f3d422023-03-29 20:59:47 +0000335 defaults: [
336 "system-modules-no-annotations",
337 ],
Sorin Basca69f4b082022-05-09 13:55:11 +0100338 hostdex: true,
339 compile_dex: true,
340
Sorin Basca69f4b082022-05-09 13:55:11 +0100341 static_libs: [
342 "stable.core.platform.api.stubs",
343 ],
344 patch_module: "java.base",
Jihoon Kang85bc1932024-07-01 17:04:46 +0000345 is_stubs_module: true,
Sorin Basca69f4b082022-05-09 13:55:11 +0100346}
347
Paul Duffinbb360c32021-07-10 23:31:50 +0100348// Used when compiling higher-level code against *.core.platform.api.stubs.
349java_system_modules {
350 name: "legacy-core-platform-api-stubs-system-modules",
351 visibility: core_platform_visibility,
352 libs: [
Sorin Basca69f4b082022-05-09 13:55:11 +0100353 "legacy.core.platform.api.no.annotations.stubs",
Paul Duffinbb360c32021-07-10 23:31:50 +0100354 // This one is not on device but it's needed when javac compiles code
355 // containing lambdas.
356 "core-lambda-stubs-for-system-modules",
Paul Duffinbb360c32021-07-10 23:31:50 +0100357 ],
358}
359
360java_system_modules {
361 name: "stable-core-platform-api-stubs-system-modules",
362 visibility: core_platform_visibility,
363 libs: [
Sorin Basca69f4b082022-05-09 13:55:11 +0100364 "stable.core.platform.api.no.annotations.stubs",
Paul Duffinbb360c32021-07-10 23:31:50 +0100365 // This one is not on device but it's needed when javac compiles code
366 // containing lambdas.
367 "core-lambda-stubs-for-system-modules",
Paul Duffinbb360c32021-07-10 23:31:50 +0100368 ],
369}
Spandan Dasfe85ca22022-12-08 02:42:25 +0000370
371// Used when compiling higher-level code against art.module.public.api.stubs.
372// This abstraction should come from the inner tree linking against the stubs
373// and not from an "sdk", since parts of this abstraction do not belong to an
374// official API (e.g. stub-annotations).
375//
376// This is only intended for use within core libraries and must not be used
377// from outside.
378java_system_modules {
379 name: "art-module-public-api-stubs-system-modules",
380 visibility: [
381 "//art/build/sdk",
382 "//external/conscrypt",
383 "//external/icu/android_icu4j",
384 "//external/wycheproof",
385 ],
386 libs: [
387 "art.module.public.api.stubs",
388 // This one is not on device but it's needed when javac compiles code
389 // containing lambdas.
390 "core-lambda-stubs-for-system-modules",
Spandan Dasfe85ca22022-12-08 02:42:25 +0000391
392 // Ensure that core libraries that depend on the public API can access
393 // the UnsupportedAppUsage, CorePlatformApi and IntraCoreApi
394 // annotations.
395 "art.module.api.annotations.for.system.modules",
Spandan Dasfe85ca22022-12-08 02:42:25 +0000396 ],
397}
398
399// Used when compiling higher-level code against art.module.public.api.stubs.module_lib.
400//
401// This is only intended for use within core libraries and must not be used
402// from outside.
403java_system_modules {
404 name: "art-module-lib-api-stubs-system-modules",
405 visibility: [
406 "//art/build/sdk",
407 "//external/conscrypt",
408 "//external/icu/android_icu4j",
409 ],
410 libs: [
411 "art.module.public.api.stubs.module_lib",
412 ],
413}
414
415// Used when compiling against art.module.intra.core.api.stubs.
416java_system_modules {
417 name: "art-module-intra-core-api-stubs-system-modules",
418 visibility: [
419 "//art/build/sdk",
420 "//external/bouncycastle",
421 "//external/conscrypt",
422 "//external/icu/android_icu4j",
423 ],
424 libs: [
425 // The intra core API stubs library.
426 "art.module.intra.core.api.stubs",
427
428 // Additional classes needed by javac but which are not present in the stubs.
429 "art-module-intra-core-api-stubs-system-modules-lib",
430 ],
431}