blob: 51d998a2e3799d2a74271d89189019941a3d49b2 [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".
27java_library {
28 name: "core.current.stubs",
29 visibility: ["//visibility:public"],
30 static_libs: [
31 "art.module.public.api.stubs",
32 "conscrypt.module.public.api.stubs",
33 "i18n.module.public.api.stubs",
34 ],
35 sdk_version: "none",
36 system_modules: "none",
37
38 dist: {
39 targets: [
40 "sdk",
41 "win_sdk",
42 ],
43 },
44}
45
46// Distributed with the SDK for turning into system modules to compile apps
47// against.
48java_library {
49 name: "core-current-stubs-for-system-modules",
50 visibility: ["//development/sdk"],
51 static_libs: [
52 "core.current.stubs",
53 // This one is not on device but it's needed when javac compiles code
54 // containing lambdas.
55 "core-lambda-stubs-for-system-modules",
56 // This one is not on device but it's needed when javac compiles code
57 // containing @Generated annotations produced by some code generation
58 // tools.
59 // See http://b/123891440.
60 "core-generated-annotation-stubs",
61 ],
62 sdk_version: "none",
63 system_modules: "none",
64 dist: {
65 dest: "core-for-system-modules.jar",
66 targets: [
67 "sdk",
68 "win_sdk",
69 ],
70 },
71}
72
73// Used when compiling higher-level code against core.current.stubs.
74java_system_modules {
75 name: "core-current-stubs-system-modules",
76 visibility: ["//visibility:public"],
77 libs: [
78 "core-current-stubs-for-system-modules",
79 ],
80}
81
82// A stubs target containing the parts of the public SDK & @SystemApi(MODULE_LIBRARIES) API
83// provided by the core libraries.
84//
85// Don't use this directly, use "sdk_version: module_current".
86java_library {
87 name: "core.module_lib.stubs",
88 static_libs: [
89 "art.module.public.api.stubs.module_lib",
90
91 // Replace the following with the module-lib correspondence when Conscrypt or i18N module
92 // provides @SystemApi(MODULE_LIBRARIES). Currently, assume that only ART module provides
93 // @SystemApi(MODULE_LIBRARIES).
94 "conscrypt.module.public.api.stubs",
95 "i18n.module.public.api.stubs",
96 ],
97 sdk_version: "none",
98 system_modules: "none",
99 visibility: ["//visibility:private"],
100}
101
102// Used when compiling higher-level code with sdk_version "module_current"
103java_system_modules {
104 name: "core-module-lib-stubs-system-modules",
105 libs: [
106 "core.module_lib.stubs",
107 // This one is not on device but it's needed when javac compiles code
108 // containing lambdas.
109 "core-lambda-stubs-for-system-modules",
110 // This one is not on device but it's needed when javac compiles code
111 // containing @Generated annotations produced by some code generation
112 // tools.
113 // See http://b/123891440.
114 "core-generated-annotation-stubs",
115 ],
116 visibility: ["//visibility:public"],
117}
118
119// Ideally this should be a restricted allowlist but there are hundreds of modules that depend on
120// this.
121// TODO(http://b/134561230) - limit the number of dependents on this.
122core_platform_visibility = ["//visibility:public"]
123
124// Libraries containing the core platform API stubs for the core libraries.
125//
126// Although this stubs library is primarily used by the Java compiler / build to indicate
127// the core platform API surface area, compile_dex: true is used so that the Core Platform
128// API annotations are available to the dex tools that enable enforcement of runtime
129// accessibility. b/119068555
130java_library {
131 name: "legacy.core.platform.api.stubs",
132 visibility: core_platform_visibility,
133 hostdex: true,
134 compile_dex: true,
135
136 sdk_version: "none",
137 system_modules: "none",
138 static_libs: [
139 "art.module.public.api.stubs.module_lib",
140 "conscrypt.module.platform.api.stubs",
141 "legacy.i18n.module.platform.api.stubs",
142 ],
143 patch_module: "java.base",
144}
145
146java_library {
147 name: "stable.core.platform.api.stubs",
148 visibility: core_platform_visibility,
149 hostdex: true,
150 compile_dex: true,
151
152 sdk_version: "none",
153 system_modules: "none",
154 static_libs: [
155 "art.module.public.api.stubs.module_lib",
156 // conscrypt only has a stable version, so it is okay to depend on it here:
157 "conscrypt.module.platform.api.stubs",
158 "stable.i18n.module.platform.api.stubs",
159 ],
160 patch_module: "java.base",
161}
162
163// Used when compiling higher-level code against *.core.platform.api.stubs.
164java_system_modules {
165 name: "legacy-core-platform-api-stubs-system-modules",
166 visibility: core_platform_visibility,
167 libs: [
168 "legacy.core.platform.api.stubs",
169 // This one is not on device but it's needed when javac compiles code
170 // containing lambdas.
171 "core-lambda-stubs-for-system-modules",
172 // This one is not on device but it's needed when javac compiles code
173 // containing @Generated annotations produced by some code generation
174 // tools.
175 // See http://b/123891440.
176 "core-generated-annotation-stubs",
177 ],
178}
179
180java_system_modules {
181 name: "stable-core-platform-api-stubs-system-modules",
182 visibility: core_platform_visibility,
183 libs: [
184 "stable.core.platform.api.stubs",
185 // This one is not on device but it's needed when javac compiles code
186 // containing lambdas.
187 "core-lambda-stubs-for-system-modules",
188 // This one is not on device but it's needed when javac compiles code
189 // containing @Generated annotations produced by some code generation
190 // tools.
191 // See http://b/123891440.
192 "core-generated-annotation-stubs",
193 ],
194}