blob: b9332dda593abe5ffa7611246ea50e99d1af6d64 [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
Paul Duffinbb360c32021-07-10 23:31:50 +010036java_library {
37 name: "core.current.stubs",
38 visibility: ["//visibility:public"],
39 static_libs: [
40 "art.module.public.api.stubs",
41 "conscrypt.module.public.api.stubs",
42 "i18n.module.public.api.stubs",
43 ],
44 sdk_version: "none",
45 system_modules: "none",
46
47 dist: {
Paul Duffinbce9f082021-10-28 12:34:41 +010048 targets: dist_targets,
Paul Duffinbb360c32021-07-10 23:31:50 +010049 },
50}
51
52// Distributed with the SDK for turning into system modules to compile apps
53// against.
Paul Duffinbce9f082021-10-28 12:34:41 +010054//
55// Also, produces dist files that are used by the
56// prebuilts/sdk/update_prebuilts.py script to update the prebuilts/sdk
57// directory.
Paul Duffinbb360c32021-07-10 23:31:50 +010058java_library {
59 name: "core-current-stubs-for-system-modules",
60 visibility: ["//development/sdk"],
61 static_libs: [
62 "core.current.stubs",
63 // This one is not on device but it's needed when javac compiles code
64 // containing lambdas.
65 "core-lambda-stubs-for-system-modules",
Paul Duffinbb360c32021-07-10 23:31:50 +010066 ],
67 sdk_version: "none",
68 system_modules: "none",
Paul Duffinbce9f082021-10-28 12:34:41 +010069 dists: [
70 {
71 // Legacy dist location for the public file.
72 dest: "core-for-system-modules.jar",
73 targets: dist_targets,
74 },
75 {
76 dest: "system-modules/public/core-for-system-modules.jar",
77 targets: dist_targets,
78 },
79 ],
Paul Duffinbb360c32021-07-10 23:31:50 +010080}
81
Sorin Bascabdbae602022-07-26 15:24:15 +010082// Same as core-current-stubs-for-system-modules, but android annotations are
83// stripped.
84java_library {
85 name: "core-current-stubs-for-system-modules-no-annotations",
86 visibility: ["//development/sdk"],
87 static_libs: [
88 "core-current-stubs-for-system-modules",
89 ],
90 sdk_version: "none",
91 system_modules: "none",
92 dists: [
93 {
94 // Legacy dist location for the public file.
95 dest: "core-for-system-modules-no-annotations.jar",
96 targets: dist_targets,
97 },
98 {
99 dest: "system-modules/public/core-for-system-modules-no-annotations.jar",
100 targets: dist_targets,
101 },
102 ],
103 jarjar_rules: "jarjar-strip-annotations-rules.txt",
104}
105
Paul Duffinbb360c32021-07-10 23:31:50 +0100106// Used when compiling higher-level code against core.current.stubs.
107java_system_modules {
Paul Duffin10fb76f2021-11-03 16:53:31 +0000108 name: "core-public-stubs-system-modules",
Paul Duffinbb360c32021-07-10 23:31:50 +0100109 visibility: ["//visibility:public"],
110 libs: [
Sorin Bascabdbae602022-07-26 15:24:15 +0100111 "core-current-stubs-for-system-modules-no-annotations",
Paul Duffinbb360c32021-07-10 23:31:50 +0100112 ],
113}
114
115// A stubs target containing the parts of the public SDK & @SystemApi(MODULE_LIBRARIES) API
116// provided by the core libraries.
117//
118// Don't use this directly, use "sdk_version: module_current".
119java_library {
120 name: "core.module_lib.stubs",
121 static_libs: [
122 "art.module.public.api.stubs.module_lib",
123
124 // Replace the following with the module-lib correspondence when Conscrypt or i18N module
125 // provides @SystemApi(MODULE_LIBRARIES). Currently, assume that only ART module provides
126 // @SystemApi(MODULE_LIBRARIES).
127 "conscrypt.module.public.api.stubs",
128 "i18n.module.public.api.stubs",
129 ],
130 sdk_version: "none",
131 system_modules: "none",
132 visibility: ["//visibility:private"],
133}
134
Paul Duffinbce9f082021-10-28 12:34:41 +0100135// Produces a dist file that is used by the
136// prebuilts/sdk/update_prebuilts.py script to update the prebuilts/sdk
137// directory.
138java_library {
139 name: "core-module-lib-stubs-for-system-modules",
140 visibility: ["//visibility:private"],
141 static_libs: [
Paul Duffinbb360c32021-07-10 23:31:50 +0100142 "core.module_lib.stubs",
143 // This one is not on device but it's needed when javac compiles code
144 // containing lambdas.
145 "core-lambda-stubs-for-system-modules",
Paul Duffinbb360c32021-07-10 23:31:50 +0100146 ],
Paul Duffinbce9f082021-10-28 12:34:41 +0100147 sdk_version: "none",
148 system_modules: "none",
149 dist: {
150 dest: "system-modules/module-lib/core-for-system-modules.jar",
151 targets: dist_targets,
152 },
153}
154
Sorin Basca69f4b082022-05-09 13:55:11 +0100155// Same as core-module-lib-stubs-for-system-modules, but android annotations are
156// stripped. This is used by the Java toolchain, while the annotated stub is to
157// be used by Kotlin one.
158java_library {
159 name: "core-module-lib-stubs-for-system-modules-no-annotations",
160 visibility: ["//visibility:private"],
161 static_libs: [
162 "core-module-lib-stubs-for-system-modules",
163 ],
164 sdk_version: "none",
165 system_modules: "none",
166 dist: {
167 dest: "system-modules/module-lib/core-for-system-modules-no-annotations.jar",
168 targets: dist_targets,
169 },
170 jarjar_rules: "jarjar-strip-annotations-rules.txt",
171}
172
Paul Duffinbce9f082021-10-28 12:34:41 +0100173// Used when compiling higher-level code with sdk_version "module_current"
174java_system_modules {
175 name: "core-module-lib-stubs-system-modules",
176 libs: [
Sorin Basca69f4b082022-05-09 13:55:11 +0100177 "core-module-lib-stubs-for-system-modules-no-annotations",
Paul Duffinbce9f082021-10-28 12:34:41 +0100178 ],
Paul Duffinbb360c32021-07-10 23:31:50 +0100179 visibility: ["//visibility:public"],
180}
181
182// Ideally this should be a restricted allowlist but there are hundreds of modules that depend on
183// this.
184// TODO(http://b/134561230) - limit the number of dependents on this.
185core_platform_visibility = ["//visibility:public"]
186
187// Libraries containing the core platform API stubs for the core libraries.
188//
189// Although this stubs library is primarily used by the Java compiler / build to indicate
190// the core platform API surface area, compile_dex: true is used so that the Core Platform
191// API annotations are available to the dex tools that enable enforcement of runtime
192// accessibility. b/119068555
193java_library {
194 name: "legacy.core.platform.api.stubs",
195 visibility: core_platform_visibility,
196 hostdex: true,
197 compile_dex: true,
198
199 sdk_version: "none",
200 system_modules: "none",
201 static_libs: [
202 "art.module.public.api.stubs.module_lib",
203 "conscrypt.module.platform.api.stubs",
204 "legacy.i18n.module.platform.api.stubs",
205 ],
206 patch_module: "java.base",
207}
208
Sorin Basca69f4b082022-05-09 13:55:11 +0100209// Same as legacy.core.platform.api.stubs, 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: "legacy.core.platform.api.no.annotations.stubs",
214 visibility: core_platform_visibility,
215 hostdex: true,
216 compile_dex: true,
217
218 sdk_version: "none",
219 system_modules: "none",
220 static_libs: [
221 "legacy.core.platform.api.stubs",
222 ],
223 patch_module: "java.base",
224 jarjar_rules: "jarjar-strip-annotations-rules.txt",
225}
226
Paul Duffinbb360c32021-07-10 23:31:50 +0100227java_library {
228 name: "stable.core.platform.api.stubs",
229 visibility: core_platform_visibility,
230 hostdex: true,
231 compile_dex: true,
232
233 sdk_version: "none",
234 system_modules: "none",
235 static_libs: [
236 "art.module.public.api.stubs.module_lib",
237 // conscrypt only has a stable version, so it is okay to depend on it here:
238 "conscrypt.module.platform.api.stubs",
239 "stable.i18n.module.platform.api.stubs",
240 ],
241 patch_module: "java.base",
242}
243
Sorin Basca69f4b082022-05-09 13:55:11 +0100244// Same as stable.core.platform.api.stubs, but android annotations are
245// stripped. This is used by the Java toolchain, while the annotated stub is to
246// be used by Kotlin one.
247java_library {
248 name: "stable.core.platform.api.no.annotations.stubs",
249 visibility: core_platform_visibility,
250 hostdex: true,
251 compile_dex: true,
252
253 sdk_version: "none",
254 system_modules: "none",
255 static_libs: [
256 "stable.core.platform.api.stubs",
257 ],
258 patch_module: "java.base",
259 jarjar_rules: "jarjar-strip-annotations-rules.txt",
260}
261
Paul Duffinbb360c32021-07-10 23:31:50 +0100262// Used when compiling higher-level code against *.core.platform.api.stubs.
263java_system_modules {
264 name: "legacy-core-platform-api-stubs-system-modules",
265 visibility: core_platform_visibility,
266 libs: [
Sorin Basca69f4b082022-05-09 13:55:11 +0100267 "legacy.core.platform.api.no.annotations.stubs",
Paul Duffinbb360c32021-07-10 23:31:50 +0100268 // This one is not on device but it's needed when javac compiles code
269 // containing lambdas.
270 "core-lambda-stubs-for-system-modules",
Paul Duffinbb360c32021-07-10 23:31:50 +0100271 ],
272}
273
274java_system_modules {
275 name: "stable-core-platform-api-stubs-system-modules",
276 visibility: core_platform_visibility,
277 libs: [
Sorin Basca69f4b082022-05-09 13:55:11 +0100278 "stable.core.platform.api.no.annotations.stubs",
Paul Duffinbb360c32021-07-10 23:31:50 +0100279 // This one is not on device but it's needed when javac compiles code
280 // containing lambdas.
281 "core-lambda-stubs-for-system-modules",
Paul Duffinbb360c32021-07-10 23:31:50 +0100282 ],
283}
Spandan Dasfe85ca22022-12-08 02:42:25 +0000284
285// Used when compiling higher-level code against art.module.public.api.stubs.
286// This abstraction should come from the inner tree linking against the stubs
287// and not from an "sdk", since parts of this abstraction do not belong to an
288// official API (e.g. stub-annotations).
289//
290// This is only intended for use within core libraries and must not be used
291// from outside.
292java_system_modules {
293 name: "art-module-public-api-stubs-system-modules",
294 visibility: [
295 "//art/build/sdk",
296 "//external/conscrypt",
297 "//external/icu/android_icu4j",
298 "//external/wycheproof",
299 ],
300 libs: [
301 "art.module.public.api.stubs",
302 // This one is not on device but it's needed when javac compiles code
303 // containing lambdas.
304 "core-lambda-stubs-for-system-modules",
Spandan Dasfe85ca22022-12-08 02:42:25 +0000305
306 // Ensure that core libraries that depend on the public API can access
307 // the UnsupportedAppUsage, CorePlatformApi and IntraCoreApi
308 // annotations.
309 "art.module.api.annotations.for.system.modules",
310
311 // Make nullability annotations available when compiling public stubs.
312 // They are provided as a separate library because while the
313 // annotations are not themselves part of the public API provided by
314 // this module they are used in the stubs.
315 "stub-annotations",
316 ],
317}
318
319// Used when compiling higher-level code against art.module.public.api.stubs.module_lib.
320//
321// This is only intended for use within core libraries and must not be used
322// from outside.
323java_system_modules {
324 name: "art-module-lib-api-stubs-system-modules",
325 visibility: [
326 "//art/build/sdk",
327 "//external/conscrypt",
328 "//external/icu/android_icu4j",
329 ],
330 libs: [
331 "art.module.public.api.stubs.module_lib",
332 ],
333}
334
335// Used when compiling against art.module.intra.core.api.stubs.
336java_system_modules {
337 name: "art-module-intra-core-api-stubs-system-modules",
338 visibility: [
339 "//art/build/sdk",
340 "//external/bouncycastle",
341 "//external/conscrypt",
342 "//external/icu/android_icu4j",
343 ],
344 libs: [
345 // The intra core API stubs library.
346 "art.module.intra.core.api.stubs",
347
348 // Additional classes needed by javac but which are not present in the stubs.
349 "art-module-intra-core-api-stubs-system-modules-lib",
350 ],
351}