blob: bfd5cf8b1fada9e469ec4cdecf981eefe01d7cb0 [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
Sorin Bascabdbae602022-07-26 15:24:15 +010087// Same as core-current-stubs-for-system-modules, but android annotations are
88// stripped.
89java_library {
90 name: "core-current-stubs-for-system-modules-no-annotations",
91 visibility: ["//development/sdk"],
92 static_libs: [
93 "core-current-stubs-for-system-modules",
94 ],
95 sdk_version: "none",
96 system_modules: "none",
97 dists: [
98 {
99 // Legacy dist location for the public file.
100 dest: "core-for-system-modules-no-annotations.jar",
101 targets: dist_targets,
102 },
103 {
104 dest: "system-modules/public/core-for-system-modules-no-annotations.jar",
105 targets: dist_targets,
106 },
107 ],
108 jarjar_rules: "jarjar-strip-annotations-rules.txt",
109}
110
Paul Duffinbb360c32021-07-10 23:31:50 +0100111// Used when compiling higher-level code against core.current.stubs.
112java_system_modules {
Paul Duffin10fb76f2021-11-03 16:53:31 +0000113 name: "core-public-stubs-system-modules",
Paul Duffinbb360c32021-07-10 23:31:50 +0100114 visibility: ["//visibility:public"],
115 libs: [
Sorin Bascabdbae602022-07-26 15:24:15 +0100116 "core-current-stubs-for-system-modules-no-annotations",
Paul Duffinbb360c32021-07-10 23:31:50 +0100117 ],
118}
119
120// A stubs target containing the parts of the public SDK & @SystemApi(MODULE_LIBRARIES) API
121// provided by the core libraries.
122//
123// Don't use this directly, use "sdk_version: module_current".
124java_library {
125 name: "core.module_lib.stubs",
126 static_libs: [
127 "art.module.public.api.stubs.module_lib",
128
129 // Replace the following with the module-lib correspondence when Conscrypt or i18N module
130 // provides @SystemApi(MODULE_LIBRARIES). Currently, assume that only ART module provides
131 // @SystemApi(MODULE_LIBRARIES).
132 "conscrypt.module.public.api.stubs",
133 "i18n.module.public.api.stubs",
134 ],
135 sdk_version: "none",
136 system_modules: "none",
137 visibility: ["//visibility:private"],
138}
139
Paul Duffinbce9f082021-10-28 12:34:41 +0100140// Produces a dist file that is used by the
141// prebuilts/sdk/update_prebuilts.py script to update the prebuilts/sdk
142// directory.
143java_library {
144 name: "core-module-lib-stubs-for-system-modules",
145 visibility: ["//visibility:private"],
146 static_libs: [
Paul Duffinbb360c32021-07-10 23:31:50 +0100147 "core.module_lib.stubs",
148 // This one is not on device but it's needed when javac compiles code
149 // containing lambdas.
150 "core-lambda-stubs-for-system-modules",
151 // This one is not on device but it's needed when javac compiles code
152 // containing @Generated annotations produced by some code generation
153 // tools.
154 // See http://b/123891440.
155 "core-generated-annotation-stubs",
156 ],
Paul Duffinbce9f082021-10-28 12:34:41 +0100157 sdk_version: "none",
158 system_modules: "none",
159 dist: {
160 dest: "system-modules/module-lib/core-for-system-modules.jar",
161 targets: dist_targets,
162 },
163}
164
Sorin Basca69f4b082022-05-09 13:55:11 +0100165// Same as core-module-lib-stubs-for-system-modules, but android annotations are
166// stripped. This is used by the Java toolchain, while the annotated stub is to
167// be used by Kotlin one.
168java_library {
169 name: "core-module-lib-stubs-for-system-modules-no-annotations",
170 visibility: ["//visibility:private"],
171 static_libs: [
172 "core-module-lib-stubs-for-system-modules",
173 ],
174 sdk_version: "none",
175 system_modules: "none",
176 dist: {
177 dest: "system-modules/module-lib/core-for-system-modules-no-annotations.jar",
178 targets: dist_targets,
179 },
180 jarjar_rules: "jarjar-strip-annotations-rules.txt",
181}
182
Paul Duffinbce9f082021-10-28 12:34:41 +0100183// Used when compiling higher-level code with sdk_version "module_current"
184java_system_modules {
185 name: "core-module-lib-stubs-system-modules",
186 libs: [
Sorin Basca69f4b082022-05-09 13:55:11 +0100187 "core-module-lib-stubs-for-system-modules-no-annotations",
Paul Duffinbce9f082021-10-28 12:34:41 +0100188 ],
Paul Duffinbb360c32021-07-10 23:31:50 +0100189 visibility: ["//visibility:public"],
190}
191
192// Ideally this should be a restricted allowlist but there are hundreds of modules that depend on
193// this.
194// TODO(http://b/134561230) - limit the number of dependents on this.
195core_platform_visibility = ["//visibility:public"]
196
197// Libraries containing the core platform API stubs for the core libraries.
198//
199// Although this stubs library is primarily used by the Java compiler / build to indicate
200// the core platform API surface area, compile_dex: true is used so that the Core Platform
201// API annotations are available to the dex tools that enable enforcement of runtime
202// accessibility. b/119068555
203java_library {
204 name: "legacy.core.platform.api.stubs",
205 visibility: core_platform_visibility,
206 hostdex: true,
207 compile_dex: true,
208
209 sdk_version: "none",
210 system_modules: "none",
211 static_libs: [
212 "art.module.public.api.stubs.module_lib",
213 "conscrypt.module.platform.api.stubs",
214 "legacy.i18n.module.platform.api.stubs",
215 ],
216 patch_module: "java.base",
217}
218
Sorin Basca69f4b082022-05-09 13:55:11 +0100219// Same as legacy.core.platform.api.stubs, but android annotations are
220// stripped. This is used by the Java toolchain, while the annotated stub is to
221// be used by Kotlin one.
222java_library {
223 name: "legacy.core.platform.api.no.annotations.stubs",
224 visibility: core_platform_visibility,
225 hostdex: true,
226 compile_dex: true,
227
228 sdk_version: "none",
229 system_modules: "none",
230 static_libs: [
231 "legacy.core.platform.api.stubs",
232 ],
233 patch_module: "java.base",
234 jarjar_rules: "jarjar-strip-annotations-rules.txt",
235}
236
Paul Duffinbb360c32021-07-10 23:31:50 +0100237java_library {
238 name: "stable.core.platform.api.stubs",
239 visibility: core_platform_visibility,
240 hostdex: true,
241 compile_dex: true,
242
243 sdk_version: "none",
244 system_modules: "none",
245 static_libs: [
246 "art.module.public.api.stubs.module_lib",
247 // conscrypt only has a stable version, so it is okay to depend on it here:
248 "conscrypt.module.platform.api.stubs",
249 "stable.i18n.module.platform.api.stubs",
250 ],
251 patch_module: "java.base",
252}
253
Sorin Basca69f4b082022-05-09 13:55:11 +0100254// Same as stable.core.platform.api.stubs, but android annotations are
255// stripped. This is used by the Java toolchain, while the annotated stub is to
256// be used by Kotlin one.
257java_library {
258 name: "stable.core.platform.api.no.annotations.stubs",
259 visibility: core_platform_visibility,
260 hostdex: true,
261 compile_dex: true,
262
263 sdk_version: "none",
264 system_modules: "none",
265 static_libs: [
266 "stable.core.platform.api.stubs",
267 ],
268 patch_module: "java.base",
269 jarjar_rules: "jarjar-strip-annotations-rules.txt",
270}
271
Paul Duffinbb360c32021-07-10 23:31:50 +0100272// Used when compiling higher-level code against *.core.platform.api.stubs.
273java_system_modules {
274 name: "legacy-core-platform-api-stubs-system-modules",
275 visibility: core_platform_visibility,
276 libs: [
Sorin Basca69f4b082022-05-09 13:55:11 +0100277 "legacy.core.platform.api.no.annotations.stubs",
Paul Duffinbb360c32021-07-10 23:31:50 +0100278 // This one is not on device but it's needed when javac compiles code
279 // containing lambdas.
280 "core-lambda-stubs-for-system-modules",
281 // This one is not on device but it's needed when javac compiles code
282 // containing @Generated annotations produced by some code generation
283 // tools.
284 // See http://b/123891440.
285 "core-generated-annotation-stubs",
286 ],
287}
288
289java_system_modules {
290 name: "stable-core-platform-api-stubs-system-modules",
291 visibility: core_platform_visibility,
292 libs: [
Sorin Basca69f4b082022-05-09 13:55:11 +0100293 "stable.core.platform.api.no.annotations.stubs",
Paul Duffinbb360c32021-07-10 23:31:50 +0100294 // This one is not on device but it's needed when javac compiles code
295 // containing lambdas.
296 "core-lambda-stubs-for-system-modules",
297 // This one is not on device but it's needed when javac compiles code
298 // containing @Generated annotations produced by some code generation
299 // tools.
300 // See http://b/123891440.
301 "core-generated-annotation-stubs",
302 ],
303}