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