blob: 513c6061bfe48123f4879ccd6734d83bcfe45e32 [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",
66 // This one is not on device but it's needed when javac compiles code
67 // containing @Generated annotations produced by some code generation
68 // tools.
69 // See http://b/123891440.
70 "core-generated-annotation-stubs",
71 ],
72 sdk_version: "none",
73 system_modules: "none",
Paul Duffinbce9f082021-10-28 12:34:41 +010074 dists: [
75 {
76 // Legacy dist location for the public file.
77 dest: "core-for-system-modules.jar",
78 targets: dist_targets,
79 },
80 {
81 dest: "system-modules/public/core-for-system-modules.jar",
82 targets: dist_targets,
83 },
84 ],
Paul Duffinbb360c32021-07-10 23:31:50 +010085}
86
87// Used when compiling higher-level code against core.current.stubs.
88java_system_modules {
Paul Duffin10fb76f2021-11-03 16:53:31 +000089 name: "core-public-stubs-system-modules",
Paul Duffinbb360c32021-07-10 23:31:50 +010090 visibility: ["//visibility:public"],
91 libs: [
92 "core-current-stubs-for-system-modules",
93 ],
94}
95
96// A stubs target containing the parts of the public SDK & @SystemApi(MODULE_LIBRARIES) API
97// provided by the core libraries.
98//
99// Don't use this directly, use "sdk_version: module_current".
100java_library {
101 name: "core.module_lib.stubs",
102 static_libs: [
103 "art.module.public.api.stubs.module_lib",
104
105 // Replace the following with the module-lib correspondence when Conscrypt or i18N module
106 // provides @SystemApi(MODULE_LIBRARIES). Currently, assume that only ART module provides
107 // @SystemApi(MODULE_LIBRARIES).
108 "conscrypt.module.public.api.stubs",
109 "i18n.module.public.api.stubs",
110 ],
111 sdk_version: "none",
112 system_modules: "none",
113 visibility: ["//visibility:private"],
114}
115
Paul Duffinbce9f082021-10-28 12:34:41 +0100116// Produces a dist file that is used by the
117// prebuilts/sdk/update_prebuilts.py script to update the prebuilts/sdk
118// directory.
119java_library {
120 name: "core-module-lib-stubs-for-system-modules",
121 visibility: ["//visibility:private"],
122 static_libs: [
Paul Duffinbb360c32021-07-10 23:31:50 +0100123 "core.module_lib.stubs",
124 // This one is not on device but it's needed when javac compiles code
125 // containing lambdas.
126 "core-lambda-stubs-for-system-modules",
127 // This one is not on device but it's needed when javac compiles code
128 // containing @Generated annotations produced by some code generation
129 // tools.
130 // See http://b/123891440.
131 "core-generated-annotation-stubs",
132 ],
Paul Duffinbce9f082021-10-28 12:34:41 +0100133 sdk_version: "none",
134 system_modules: "none",
135 dist: {
136 dest: "system-modules/module-lib/core-for-system-modules.jar",
137 targets: dist_targets,
138 },
139}
140
Sorin Basca69f4b082022-05-09 13:55:11 +0100141// Same as core-module-lib-stubs-for-system-modules, but android annotations are
142// stripped. This is used by the Java toolchain, while the annotated stub is to
143// be used by Kotlin one.
144java_library {
145 name: "core-module-lib-stubs-for-system-modules-no-annotations",
146 visibility: ["//visibility:private"],
147 static_libs: [
148 "core-module-lib-stubs-for-system-modules",
149 ],
150 sdk_version: "none",
151 system_modules: "none",
152 dist: {
153 dest: "system-modules/module-lib/core-for-system-modules-no-annotations.jar",
154 targets: dist_targets,
155 },
156 jarjar_rules: "jarjar-strip-annotations-rules.txt",
157}
158
Paul Duffinbce9f082021-10-28 12:34:41 +0100159// Used when compiling higher-level code with sdk_version "module_current"
160java_system_modules {
161 name: "core-module-lib-stubs-system-modules",
162 libs: [
Sorin Basca69f4b082022-05-09 13:55:11 +0100163 "core-module-lib-stubs-for-system-modules-no-annotations",
Paul Duffinbce9f082021-10-28 12:34:41 +0100164 ],
Paul Duffinbb360c32021-07-10 23:31:50 +0100165 visibility: ["//visibility:public"],
166}
167
168// Ideally this should be a restricted allowlist but there are hundreds of modules that depend on
169// this.
170// TODO(http://b/134561230) - limit the number of dependents on this.
171core_platform_visibility = ["//visibility:public"]
172
173// Libraries containing the core platform API stubs for the core libraries.
174//
175// Although this stubs library is primarily used by the Java compiler / build to indicate
176// the core platform API surface area, compile_dex: true is used so that the Core Platform
177// API annotations are available to the dex tools that enable enforcement of runtime
178// accessibility. b/119068555
179java_library {
180 name: "legacy.core.platform.api.stubs",
181 visibility: core_platform_visibility,
182 hostdex: true,
183 compile_dex: true,
184
185 sdk_version: "none",
186 system_modules: "none",
187 static_libs: [
188 "art.module.public.api.stubs.module_lib",
189 "conscrypt.module.platform.api.stubs",
190 "legacy.i18n.module.platform.api.stubs",
191 ],
192 patch_module: "java.base",
193}
194
Sorin Basca69f4b082022-05-09 13:55:11 +0100195// Same as legacy.core.platform.api.stubs, but android annotations are
196// stripped. This is used by the Java toolchain, while the annotated stub is to
197// be used by Kotlin one.
198java_library {
199 name: "legacy.core.platform.api.no.annotations.stubs",
200 visibility: core_platform_visibility,
201 hostdex: true,
202 compile_dex: true,
203
204 sdk_version: "none",
205 system_modules: "none",
206 static_libs: [
207 "legacy.core.platform.api.stubs",
208 ],
209 patch_module: "java.base",
210 jarjar_rules: "jarjar-strip-annotations-rules.txt",
211}
212
Paul Duffinbb360c32021-07-10 23:31:50 +0100213java_library {
214 name: "stable.core.platform.api.stubs",
215 visibility: core_platform_visibility,
216 hostdex: true,
217 compile_dex: true,
218
219 sdk_version: "none",
220 system_modules: "none",
221 static_libs: [
222 "art.module.public.api.stubs.module_lib",
223 // conscrypt only has a stable version, so it is okay to depend on it here:
224 "conscrypt.module.platform.api.stubs",
225 "stable.i18n.module.platform.api.stubs",
226 ],
227 patch_module: "java.base",
228}
229
Sorin Basca69f4b082022-05-09 13:55:11 +0100230// Same as stable.core.platform.api.stubs, but android annotations are
231// stripped. This is used by the Java toolchain, while the annotated stub is to
232// be used by Kotlin one.
233java_library {
234 name: "stable.core.platform.api.no.annotations.stubs",
235 visibility: core_platform_visibility,
236 hostdex: true,
237 compile_dex: true,
238
239 sdk_version: "none",
240 system_modules: "none",
241 static_libs: [
242 "stable.core.platform.api.stubs",
243 ],
244 patch_module: "java.base",
245 jarjar_rules: "jarjar-strip-annotations-rules.txt",
246}
247
Paul Duffinbb360c32021-07-10 23:31:50 +0100248// Used when compiling higher-level code against *.core.platform.api.stubs.
249java_system_modules {
250 name: "legacy-core-platform-api-stubs-system-modules",
251 visibility: core_platform_visibility,
252 libs: [
Sorin Basca69f4b082022-05-09 13:55:11 +0100253 "legacy.core.platform.api.no.annotations.stubs",
Paul Duffinbb360c32021-07-10 23:31:50 +0100254 // This one is not on device but it's needed when javac compiles code
255 // containing lambdas.
256 "core-lambda-stubs-for-system-modules",
257 // This one is not on device but it's needed when javac compiles code
258 // containing @Generated annotations produced by some code generation
259 // tools.
260 // See http://b/123891440.
261 "core-generated-annotation-stubs",
262 ],
263}
264
265java_system_modules {
266 name: "stable-core-platform-api-stubs-system-modules",
267 visibility: core_platform_visibility,
268 libs: [
Sorin Basca69f4b082022-05-09 13:55:11 +0100269 "stable.core.platform.api.no.annotations.stubs",
Paul Duffinbb360c32021-07-10 23:31:50 +0100270 // This one is not on device but it's needed when javac compiles code
271 // containing lambdas.
272 "core-lambda-stubs-for-system-modules",
273 // This one is not on device but it's needed when javac compiles code
274 // containing @Generated annotations produced by some code generation
275 // tools.
276 // See http://b/123891440.
277 "core-generated-annotation-stubs",
278 ],
279}