blob: cee7a192ef93e83843a8b55be5ffca0bd5b0bf84 [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 Kang67b64432023-05-31 22:25:21 +000041}
42
43java_library {
Jihoon Kangb0f4c022024-08-06 00:15:25 +000044 name: "core.current.stubs",
Jihoon Kang67b64432023-05-31 22:25:21 +000045 defaults: [
46 "core.current.stubs.defaults",
47 ],
Paul Duffinbb360c32021-07-10 23:31:50 +010048 static_libs: [
49 "art.module.public.api.stubs",
50 "conscrypt.module.public.api.stubs",
51 "i18n.module.public.api.stubs",
52 ],
Jihoon Kang67b64432023-05-31 22:25:21 +000053}
Paul Duffinbb360c32021-07-10 23:31:50 +010054
Jihoon Kangb0f4c022024-08-06 00:15:25 +000055// Used for bootstrapping ART system modules
Jihoon Kangb281ddc2023-08-17 18:14:35 +000056java_api_library {
57 name: "core.current.stubs.from-text",
Jihoon Kangb0f4c022024-08-06 00:15:25 +000058 defaults: [
59 "core.current.stubs.defaults",
60 ],
Jihoon Kangb281ddc2023-08-17 18:14:35 +000061 api_surface: "core",
62 api_contributions: [
63 "art.module.public.api.stubs.source.api.contribution",
64 "conscrypt.module.public.api.stubs.source.api.contribution",
65 "i18n.module.public.api.stubs.source.api.contribution",
66 ],
67 libs: [
68 "stub-annotations",
69 ],
Jihoon Kang063ec002023-06-28 01:16:23 +000070 enable_validation: false,
Jihoon Kang5d701272024-02-15 21:53:49 +000071 stubs_type: "everything",
Jihoon Kangb281ddc2023-08-17 18:14:35 +000072}
73
Jihoon Kang67b64432023-05-31 22:25:21 +000074java_library {
Jihoon Kangb0f4c022024-08-06 00:15:25 +000075 name: "core.current.stubs.exportable",
Jihoon Kangbd093452023-12-26 19:08:01 +000076 defaults: [
77 "core.current.stubs.defaults",
78 ],
79 static_libs: [
80 "art.module.public.api.stubs.exportable",
81 "conscrypt.module.public.api.stubs.exportable",
82 "i18n.module.public.api.stubs.exportable",
83 ],
84 dist: {
85 targets: dist_targets,
86 dest: "core.current.stubs.jar",
87 },
88}
89
Paul Duffinbb360c32021-07-10 23:31:50 +010090// Distributed with the SDK for turning into system modules to compile apps
91// against.
Paul Duffinbce9f082021-10-28 12:34:41 +010092//
93// Also, produces dist files that are used by the
94// prebuilts/sdk/update_prebuilts.py script to update the prebuilts/sdk
95// directory.
Paul Duffinbb360c32021-07-10 23:31:50 +010096java_library {
97 name: "core-current-stubs-for-system-modules",
98 visibility: ["//development/sdk"],
99 static_libs: [
100 "core.current.stubs",
101 // This one is not on device but it's needed when javac compiles code
102 // containing lambdas.
103 "core-lambda-stubs-for-system-modules",
Paul Duffinbb360c32021-07-10 23:31:50 +0100104 ],
105 sdk_version: "none",
106 system_modules: "none",
Paul Duffinbce9f082021-10-28 12:34:41 +0100107 dists: [
108 {
109 // Legacy dist location for the public file.
110 dest: "core-for-system-modules.jar",
111 targets: dist_targets,
112 },
113 {
114 dest: "system-modules/public/core-for-system-modules.jar",
115 targets: dist_targets,
116 },
117 ],
Paul Duffinbb360c32021-07-10 23:31:50 +0100118}
119
Spandan Dasb0f3d422023-03-29 20:59:47 +0000120// Defaults module to strip out android annotations
121java_defaults {
122 name: "system-modules-no-annotations",
123 sdk_version: "none",
124 system_modules: "none",
125 jarjar_rules: "jarjar-strip-annotations-rules.txt",
126}
127
Sorin Bascabdbae602022-07-26 15:24:15 +0100128// Same as core-current-stubs-for-system-modules, but android annotations are
129// stripped.
130java_library {
131 name: "core-current-stubs-for-system-modules-no-annotations",
132 visibility: ["//development/sdk"],
Spandan Dasb0f3d422023-03-29 20:59:47 +0000133 defaults: [
134 "system-modules-no-annotations",
135 ],
Sorin Bascabdbae602022-07-26 15:24:15 +0100136 static_libs: [
137 "core-current-stubs-for-system-modules",
138 ],
Sorin Bascabdbae602022-07-26 15:24:15 +0100139 dists: [
140 {
141 // Legacy dist location for the public file.
142 dest: "core-for-system-modules-no-annotations.jar",
143 targets: dist_targets,
144 },
145 {
146 dest: "system-modules/public/core-for-system-modules-no-annotations.jar",
147 targets: dist_targets,
148 },
149 ],
Sorin Bascabdbae602022-07-26 15:24:15 +0100150}
151
Paul Duffinbb360c32021-07-10 23:31:50 +0100152// Used when compiling higher-level code against core.current.stubs.
153java_system_modules {
Paul Duffin10fb76f2021-11-03 16:53:31 +0000154 name: "core-public-stubs-system-modules",
Paul Duffinbb360c32021-07-10 23:31:50 +0100155 visibility: ["//visibility:public"],
156 libs: [
Sorin Bascabdbae602022-07-26 15:24:15 +0100157 "core-current-stubs-for-system-modules-no-annotations",
Paul Duffinbb360c32021-07-10 23:31:50 +0100158 ],
159}
160
Romain Jobredeaux9d54fda2023-07-28 10:32:50 -0400161java_defaults {
162 name: "core.module_lib.stubs.defaults",
163 visibility: ["//visibility:private"],
164 sdk_version: "none",
165 system_modules: "none",
166}
167
Paul Duffinbb360c32021-07-10 23:31:50 +0100168// A stubs target containing the parts of the public SDK & @SystemApi(MODULE_LIBRARIES) API
169// provided by the core libraries.
170//
171// Don't use this directly, use "sdk_version: module_current".
172java_library {
173 name: "core.module_lib.stubs",
Romain Jobredeaux9d54fda2023-07-28 10:32:50 -0400174 defaults: [
175 "core.module_lib.stubs.defaults",
176 ],
177 static_libs: [
Paul Duffinbb360c32021-07-10 23:31:50 +0100178 "art.module.public.api.stubs.module_lib",
179
180 // Replace the following with the module-lib correspondence when Conscrypt or i18N module
181 // provides @SystemApi(MODULE_LIBRARIES). Currently, assume that only ART module provides
182 // @SystemApi(MODULE_LIBRARIES).
183 "conscrypt.module.public.api.stubs",
184 "i18n.module.public.api.stubs",
185 ],
Paul Duffinbb360c32021-07-10 23:31:50 +0100186}
187
Paul Duffinbce9f082021-10-28 12:34:41 +0100188// Produces a dist file that is used by the
189// prebuilts/sdk/update_prebuilts.py script to update the prebuilts/sdk
190// directory.
191java_library {
192 name: "core-module-lib-stubs-for-system-modules",
193 visibility: ["//visibility:private"],
194 static_libs: [
Paul Duffinbb360c32021-07-10 23:31:50 +0100195 "core.module_lib.stubs",
196 // This one is not on device but it's needed when javac compiles code
197 // containing lambdas.
198 "core-lambda-stubs-for-system-modules",
Paul Duffinbb360c32021-07-10 23:31:50 +0100199 ],
Paul Duffinbce9f082021-10-28 12:34:41 +0100200 sdk_version: "none",
201 system_modules: "none",
202 dist: {
203 dest: "system-modules/module-lib/core-for-system-modules.jar",
204 targets: dist_targets,
205 },
206}
207
Sorin Basca69f4b082022-05-09 13:55:11 +0100208// Same as core-module-lib-stubs-for-system-modules, but android annotations are
209// stripped. This is used by the Java toolchain, while the annotated stub is to
210// be used by Kotlin one.
211java_library {
212 name: "core-module-lib-stubs-for-system-modules-no-annotations",
213 visibility: ["//visibility:private"],
Spandan Dasb0f3d422023-03-29 20:59:47 +0000214 defaults: [
215 "system-modules-no-annotations",
216 ],
Sorin Basca69f4b082022-05-09 13:55:11 +0100217 static_libs: [
218 "core-module-lib-stubs-for-system-modules",
219 ],
Sorin Basca69f4b082022-05-09 13:55:11 +0100220 dist: {
221 dest: "system-modules/module-lib/core-for-system-modules-no-annotations.jar",
222 targets: dist_targets,
223 },
Sorin Basca69f4b082022-05-09 13:55:11 +0100224}
225
Paul Duffinbce9f082021-10-28 12:34:41 +0100226// Used when compiling higher-level code with sdk_version "module_current"
227java_system_modules {
228 name: "core-module-lib-stubs-system-modules",
229 libs: [
Sorin Basca69f4b082022-05-09 13:55:11 +0100230 "core-module-lib-stubs-for-system-modules-no-annotations",
Paul Duffinbce9f082021-10-28 12:34:41 +0100231 ],
Paul Duffinbb360c32021-07-10 23:31:50 +0100232 visibility: ["//visibility:public"],
233}
234
235// Ideally this should be a restricted allowlist but there are hundreds of modules that depend on
236// this.
237// TODO(http://b/134561230) - limit the number of dependents on this.
238core_platform_visibility = ["//visibility:public"]
239
240// Libraries containing the core platform API stubs for the core libraries.
241//
242// Although this stubs library is primarily used by the Java compiler / build to indicate
243// the core platform API surface area, compile_dex: true is used so that the Core Platform
244// API annotations are available to the dex tools that enable enforcement of runtime
245// accessibility. b/119068555
246java_library {
Jihoon Kangb0f4c022024-08-06 00:15:25 +0000247 name: "legacy.core.platform.api.stubs",
Paul Duffinbb360c32021-07-10 23:31:50 +0100248 visibility: core_platform_visibility,
Jihoon Kang67b64432023-05-31 22:25:21 +0000249 defaults: [
250 "core.platform.api.stubs.defaults",
251 ],
Paul Duffinbb360c32021-07-10 23:31:50 +0100252 static_libs: [
253 "art.module.public.api.stubs.module_lib",
254 "conscrypt.module.platform.api.stubs",
255 "legacy.i18n.module.platform.api.stubs",
256 ],
Jihoon Kang67b64432023-05-31 22:25:21 +0000257}
258
Jihoon Kangbd093452023-12-26 19:08:01 +0000259java_library {
Jihoon Kangb0f4c022024-08-06 00:15:25 +0000260 name: "legacy.core.platform.api.stubs.exportable",
Jihoon Kangbd093452023-12-26 19:08:01 +0000261 visibility: core_platform_visibility,
262 defaults: [
263 "core.platform.api.stubs.defaults",
264 ],
265 static_libs: [
266 "art.module.public.api.stubs.exportable.module_lib",
267 "conscrypt.module.platform.api.stubs.exportable",
268 "legacy.i18n.module.platform.api.stubs.exportable",
269 ],
270}
271
Jihoon Kangb281ddc2023-08-17 18:14:35 +0000272java_defaults {
273 name: "android_core_platform_stubs_current_contributions",
274 api_surface: "core_platform",
275 api_contributions: [
276 "art.module.public.api.stubs.source.api.contribution",
277 "art.module.public.api.stubs.source.system.api.contribution",
278 "art.module.public.api.stubs.source.module_lib.api.contribution",
279 "conscrypt.module.platform.api.stubs.source.api.contribution",
280 "i18n.module.public.api.stubs.source.api.contribution",
281 ],
282}
283
Jihoon Kang67b64432023-05-31 22:25:21 +0000284java_defaults {
285 name: "core.platform.api.stubs.defaults",
286 hostdex: true,
287 compile_dex: true,
288
289 sdk_version: "none",
290 system_modules: "none",
Paul Duffinbb360c32021-07-10 23:31:50 +0100291 patch_module: "java.base",
292}
293
Sorin Basca69f4b082022-05-09 13:55:11 +0100294// Same as legacy.core.platform.api.stubs, but android annotations are
295// stripped. This is used by the Java toolchain, while the annotated stub is to
296// be used by Kotlin one.
297java_library {
298 name: "legacy.core.platform.api.no.annotations.stubs",
299 visibility: core_platform_visibility,
Spandan Dasb0f3d422023-03-29 20:59:47 +0000300 defaults: [
301 "system-modules-no-annotations",
302 ],
Sorin Basca69f4b082022-05-09 13:55:11 +0100303 hostdex: true,
304 compile_dex: true,
305
Sorin Basca69f4b082022-05-09 13:55:11 +0100306 static_libs: [
307 "legacy.core.platform.api.stubs",
308 ],
309 patch_module: "java.base",
Sorin Basca69f4b082022-05-09 13:55:11 +0100310}
311
Paul Duffinbb360c32021-07-10 23:31:50 +0100312java_library {
Jihoon Kangb0f4c022024-08-06 00:15:25 +0000313 name: "stable.core.platform.api.stubs",
Paul Duffinbb360c32021-07-10 23:31:50 +0100314 visibility: core_platform_visibility,
Jihoon Kang67b64432023-05-31 22:25:21 +0000315 defaults: [
316 "core.platform.api.stubs.defaults",
317 ],
Paul Duffinbb360c32021-07-10 23:31:50 +0100318 static_libs: [
319 "art.module.public.api.stubs.module_lib",
320 // conscrypt only has a stable version, so it is okay to depend on it here:
321 "conscrypt.module.platform.api.stubs",
322 "stable.i18n.module.platform.api.stubs",
323 ],
Jihoon Kang67b64432023-05-31 22:25:21 +0000324}
325
Sorin Basca69f4b082022-05-09 13:55:11 +0100326// Same as stable.core.platform.api.stubs, but android annotations are
327// stripped. This is used by the Java toolchain, while the annotated stub is to
328// be used by Kotlin one.
329java_library {
330 name: "stable.core.platform.api.no.annotations.stubs",
331 visibility: core_platform_visibility,
Spandan Dasb0f3d422023-03-29 20:59:47 +0000332 defaults: [
333 "system-modules-no-annotations",
334 ],
Sorin Basca69f4b082022-05-09 13:55:11 +0100335 hostdex: true,
336 compile_dex: true,
337
Sorin Basca69f4b082022-05-09 13:55:11 +0100338 static_libs: [
339 "stable.core.platform.api.stubs",
340 ],
341 patch_module: "java.base",
Sorin Basca69f4b082022-05-09 13:55:11 +0100342}
343
Paul Duffinbb360c32021-07-10 23:31:50 +0100344// Used when compiling higher-level code against *.core.platform.api.stubs.
345java_system_modules {
346 name: "legacy-core-platform-api-stubs-system-modules",
347 visibility: core_platform_visibility,
348 libs: [
Sorin Basca69f4b082022-05-09 13:55:11 +0100349 "legacy.core.platform.api.no.annotations.stubs",
Paul Duffinbb360c32021-07-10 23:31:50 +0100350 // This one is not on device but it's needed when javac compiles code
351 // containing lambdas.
352 "core-lambda-stubs-for-system-modules",
Paul Duffinbb360c32021-07-10 23:31:50 +0100353 ],
354}
355
356java_system_modules {
357 name: "stable-core-platform-api-stubs-system-modules",
358 visibility: core_platform_visibility,
359 libs: [
Sorin Basca69f4b082022-05-09 13:55:11 +0100360 "stable.core.platform.api.no.annotations.stubs",
Paul Duffinbb360c32021-07-10 23:31:50 +0100361 // This one is not on device but it's needed when javac compiles code
362 // containing lambdas.
363 "core-lambda-stubs-for-system-modules",
Paul Duffinbb360c32021-07-10 23:31:50 +0100364 ],
365}
Spandan Dasfe85ca22022-12-08 02:42:25 +0000366
367// Used when compiling higher-level code against art.module.public.api.stubs.
368// This abstraction should come from the inner tree linking against the stubs
369// and not from an "sdk", since parts of this abstraction do not belong to an
370// official API (e.g. stub-annotations).
371//
372// This is only intended for use within core libraries and must not be used
373// from outside.
374java_system_modules {
375 name: "art-module-public-api-stubs-system-modules",
376 visibility: [
377 "//art/build/sdk",
378 "//external/conscrypt",
379 "//external/icu/android_icu4j",
380 "//external/wycheproof",
381 ],
382 libs: [
383 "art.module.public.api.stubs",
384 // This one is not on device but it's needed when javac compiles code
385 // containing lambdas.
386 "core-lambda-stubs-for-system-modules",
Spandan Dasfe85ca22022-12-08 02:42:25 +0000387
388 // Ensure that core libraries that depend on the public API can access
389 // the UnsupportedAppUsage, CorePlatformApi and IntraCoreApi
390 // annotations.
391 "art.module.api.annotations.for.system.modules",
Spandan Dasfe85ca22022-12-08 02:42:25 +0000392 ],
393}
394
395// Used when compiling higher-level code against art.module.public.api.stubs.module_lib.
396//
397// This is only intended for use within core libraries and must not be used
398// from outside.
399java_system_modules {
400 name: "art-module-lib-api-stubs-system-modules",
401 visibility: [
402 "//art/build/sdk",
403 "//external/conscrypt",
404 "//external/icu/android_icu4j",
405 ],
406 libs: [
407 "art.module.public.api.stubs.module_lib",
408 ],
409}
410
411// Used when compiling against art.module.intra.core.api.stubs.
412java_system_modules {
413 name: "art-module-intra-core-api-stubs-system-modules",
414 visibility: [
415 "//art/build/sdk",
416 "//external/bouncycastle",
417 "//external/conscrypt",
418 "//external/icu/android_icu4j",
419 ],
420 libs: [
421 // The intra core API stubs library.
422 "art.module.intra.core.api.stubs",
423
424 // Additional classes needed by javac but which are not present in the stubs.
425 "art-module-intra-core-api-stubs-system-modules-lib",
426 ],
427}