blob: 2c5592a60252c2b8cfa5c14786374e510b9deb27 [file] [log] [blame]
Colin Cross9a51b152017-08-29 16:04:52 -07001//
2// Copyright (C) 2017 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16
Paul Duffind772e592019-06-03 16:09:02 +010017package {
18 default_visibility: ["//visibility:private"],
19}
20
Colin Cross9a51b152017-08-29 16:04:52 -070021//==========================================================
22// build repackaged ICU for target
23//
24// This is done in the libcore/JavaLibraries.mk file as there are circular
25// dependencies between ICU and libcore
26//==========================================================
27filegroup {
Victor Changc9ae0db2019-10-28 18:56:09 +000028 name: "android_icu4j_public_api_files",
Paul Duffind772e592019-06-03 16:09:02 +010029 visibility: [
Paul Duffin093a4042020-03-26 15:36:49 +000030 "//frameworks/base",
Paul Duffind772e592019-06-03 16:09:02 +010031 ],
Victor Chang92c3bcf2019-10-07 11:36:39 +010032 srcs: [
33 ":android_icu4j_repackaged_src_files",
Victor Chang92c3bcf2019-10-07 11:36:39 +010034 ],
Jiyong Park684fe8a2019-08-19 13:23:42 +090035 path: "src/main/java",
Colin Cross9a51b152017-08-29 16:04:52 -070036}
37
Victor Chang92c3bcf2019-10-07 11:36:39 +010038filegroup {
39 name: "android_icu4j_repackaged_src_files",
40 srcs: ["src/main/java/android/icu/**/*.java"],
41 path: "src/main/java",
42}
43
44// The files contains Android-specific codes to expose intra-core APIs
Victor Chang71d684d2020-05-15 18:17:49 +010045// from ICU4J/ICU4C to libcore or core platform APIs to the framework.
46// The package is com.android.icu.* and should not expose any public APIs.
Victor Chang92c3bcf2019-10-07 11:36:39 +010047filegroup {
48 name: "libcore_icu_bridge_src_files",
Victor Changc9ae0db2019-10-28 18:56:09 +000049 srcs: ["libcore_bridge/src/java/**/*.java"],
50 path: "libcore_bridge/src/java",
Victor Chang92c3bcf2019-10-07 11:36:39 +010051}
52
Victor Change5b242d2020-10-30 11:39:52 +000053java_defaults {
54 name: "libcore_icu_bridge_defaults",
55 srcs: [
56 "libcore_bridge/src/java/**/*.java",
57 ":app-compat-annotations-source",
58 ],
59 plugins: [
60 "compat-changeid-annotation-processor",
61 ],
62}
63
Victor Chang21639cd2020-06-17 15:25:10 +010064// timezone-related source that is also used in host tests / tools and its
65// dependencies.
66filegroup {
67 name: "timezone_host_files",
68 srcs: [
Victor Chang21639cd2020-06-17 15:25:10 +010069 "libcore_bridge/src/java/com/android/i18n/timezone/TzDataSetVersion.java",
70 ],
71 path: "libcore_bridge/src/java",
72 visibility: ["//libcore"],
73}
74
Victor Chang92c3bcf2019-10-07 11:36:39 +010075// core-repackaged-icu4j contains only the repackaged ICU4J that does not
76// use any internal or android specific code. If it ever did then it could depend on
77// art-module-intra-core-api-stubs-system-modules (a superset) instead.
78// It is important that core-icu4j is restricted to only use stable APIs from the ART module
79// since it is in a different APEX module that can be updated independently.
80java_library_static {
81 name: "core-repackaged-icu4j",
82 installable: false,
83 srcs: [":android_icu4j_repackaged_src_files"],
Artur Satayev2fc4dc32019-12-10 12:12:35 +000084 libs: ["unsupportedappusage"],
Victor Chang92c3bcf2019-10-07 11:36:39 +010085 // The resource files are generated in the downstream branch master-icu-dev.
86 java_resource_dirs: ["resources"],
87
88 sdk_version: "none",
89 system_modules: "art-module-public-api-stubs-system-modules",
90
91 dxflags: ["--core-library"],
Victor Changaaf68452020-05-05 16:02:45 +010092 apex_available: [
93 "com.android.i18n",
94 ],
Victor Chang92c3bcf2019-10-07 11:36:39 +010095 errorprone: {
96 javacflags: [
97 "-Xep:MissingOverride:OFF", // Ignore missing @Override.
98 "-Xep:ConstantOverflow:WARN", // Known constant overflow in SplittableRandom
99 ],
100 },
101}
102
Paul Duffind31a0602019-09-26 16:23:55 +0100103// A separated core library that contains ICU4J because ICU4J will be in a different APEX module,
104// not in ART module.
105java_library {
106 name: "core-icu4j",
Victor Change5b242d2020-10-30 11:39:52 +0000107 defaults: ["libcore_icu_bridge_defaults"],
Paul Duffind31a0602019-09-26 16:23:55 +0100108 visibility: [
Victor Changa12ff872020-05-15 18:20:51 +0100109 "//packages/modules/RuntimeI18n/apex",
Paul Duffind31a0602019-09-26 16:23:55 +0100110 "//external/robolectric-shadows",
111 "//frameworks/layoutlib",
Victor Changaaf68452020-05-05 16:02:45 +0100112 "//art/build",
Paul Duffind31a0602019-09-26 16:23:55 +0100113 ],
Jiyong Park0ddd1ef2019-12-19 02:11:30 +0000114 apex_available: [
Victor Changaaf68452020-05-05 16:02:45 +0100115 "com.android.i18n",
116 ],
117 permitted_packages: [
118 "android.icu",
119 "com.android.icu",
Victor Chang21639cd2020-06-17 15:25:10 +0100120 "com.android.i18n.timezone",
Jiyong Park0ddd1ef2019-12-19 02:11:30 +0000121 ],
Paul Duffind31a0602019-09-26 16:23:55 +0100122 installable: true,
Victor Changaaf68452020-05-05 16:02:45 +0100123 hostdex: false,
Paul Duffind31a0602019-09-26 16:23:55 +0100124
Victor Chang92c3bcf2019-10-07 11:36:39 +0100125 static_libs: ["core-repackaged-icu4j"],
Paul Duffin2626a2a2019-10-08 15:17:42 +0100126
Paul Duffind31a0602019-09-26 16:23:55 +0100127 // It is important that core-icu4j is restricted to only use stable APIs from the ART module
128 // since it is in a different APEX module that can be updated independently.
129 sdk_version: "none",
Victor Chang92c3bcf2019-10-07 11:36:39 +0100130 system_modules: "art-module-intra-core-api-stubs-system-modules",
Paul Duffind31a0602019-09-26 16:23:55 +0100131
132 dxflags: ["--core-library"],
Paul Duffind31a0602019-09-26 16:23:55 +0100133}
134
Victor Change5b242d2020-10-30 11:39:52 +0000135platform_compat_config {
136 name: "icu4j-platform-compat-config",
137 src: ":core-icu4j",
138}
139
Nicolas Geoffray329d0352020-06-01 16:04:02 +0100140java_sdk_library {
141 name: "i18n.module.public.api",
142 visibility: [
143 "//libcore",
144 "//packages/modules/RuntimeI18n/apex",
145 // Visibility for prebuilt i18n-module-sdk from the prebuilt of
146 // this module.
147 // TODO(b/155921753): Restrict this when prebuilts are in their proper
148 // locations.
149 "//prebuilts:__subpackages__",
150 ],
Paul Duffind31a0602019-09-26 16:23:55 +0100151 srcs: [
Victor Changc9ae0db2019-10-28 18:56:09 +0000152 ":android_icu4j_public_api_files",
Paul Duffind31a0602019-09-26 16:23:55 +0100153 ],
Paul Duffind31a0602019-09-26 16:23:55 +0100154 errorprone: {
155 javacflags: [
156 "-Xep:MissingOverride:OFF",
157 ],
158 },
Nicolas Geoffray329d0352020-06-01 16:04:02 +0100159 api_dir: "api/public",
160 api_only: true,
Paul Duffind31a0602019-09-26 16:23:55 +0100161 sdk_version: "none",
162 system_modules: "art-module-public-api-stubs-system-modules",
163}
164
Nicolas Geoffray7f8aaf62020-06-03 14:39:04 +0100165// Referenced implicitly from i18n.module.intra.api.
166filegroup {
167 name: "i18n.module.intra.api.api.public.latest",
168 srcs: [
169 "api/intra/last-api.txt",
170 ],
171}
172
173// Referenced implicitly from i18n.module.intra.api.
174filegroup {
175 name: "i18n.module.intra.api-removed.api.public.latest",
176 srcs: [
177 "api/intra/last-removed.txt",
178 ],
179}
180
Paul Duffincff90fa2019-10-02 10:18:28 +0100181// Generates stub source files for the intra-core API of the I18N module.
182// i.e. every class/member that is either in the public API or annotated with
183// @IntraCoreApi.
184//
185// The API specification .txt files managed by this only contain the additional
186// classes/members that are in the intra-core API but which are not the public
187// API.
Nicolas Geoffray7f8aaf62020-06-03 14:39:04 +0100188java_sdk_library {
189 name: "i18n.module.intra.core.api",
Victor Change5b242d2020-10-30 11:39:52 +0000190 defaults: ["libcore_icu_bridge_defaults"],
Paul Duffincff90fa2019-10-02 10:18:28 +0100191 srcs: [
Victor Changc9ae0db2019-10-28 18:56:09 +0000192 ":android_icu4j_repackaged_src_files",
Paul Duffincff90fa2019-10-02 10:18:28 +0100193 ],
Paul Duffincff90fa2019-10-02 10:18:28 +0100194 visibility: [
195 "//libcore:__subpackages__",
Nicolas Geoffray7f8aaf62020-06-03 14:39:04 +0100196 "//packages/modules/RuntimeI18n/apex",
197 // Visibility for prebuilt i18n-module-sdk from the prebuilt of
198 // this module.
199 // TODO(b/155921753): Restrict this when prebuilts are in their proper
200 // locations.
201 "//prebuilts:__subpackages__",
Paul Duffincff90fa2019-10-02 10:18:28 +0100202 ],
Nicolas Geoffray7f8aaf62020-06-03 14:39:04 +0100203 api_dir: "api/intra",
204 api_only: true,
Paul Duffincff90fa2019-10-02 10:18:28 +0100205 sdk_version: "none",
206 system_modules: "art-module-intra-core-api-stubs-system-modules",
Nicolas Geoffray7f8aaf62020-06-03 14:39:04 +0100207
208 droiddoc_options: [
209 "--hide-annotation libcore.api.Hide ",
210 "--show-single-annotation libcore.api.IntraCoreApi ",
211 "--skip-annotation-instance-methods=false ",
212 ],
Paul Duffincff90fa2019-10-02 10:18:28 +0100213}
214
Pete Gillinecffbde2020-06-05 19:46:45 +0100215// Referenced implicitly from legacy.i18n.module.platform.api.
Nicolas Geoffray4f8142a2020-05-29 17:00:48 +0100216filegroup {
Pete Gillinecffbde2020-06-05 19:46:45 +0100217 name: "legacy.i18n.module.platform.api.api.public.latest",
Nicolas Geoffray4f8142a2020-05-29 17:00:48 +0100218 srcs: [
Pete Gillinecffbde2020-06-05 19:46:45 +0100219 "api/legacy_platform/last-api.txt",
Nicolas Geoffray4f8142a2020-05-29 17:00:48 +0100220 ],
221}
222
Pete Gillinecffbde2020-06-05 19:46:45 +0100223// Referenced implicitly from legacy.i18n.module.platform.api.
Nicolas Geoffray4f8142a2020-05-29 17:00:48 +0100224filegroup {
Pete Gillinecffbde2020-06-05 19:46:45 +0100225 name: "legacy.i18n.module.platform.api-removed.api.public.latest",
Nicolas Geoffray4f8142a2020-05-29 17:00:48 +0100226 srcs: [
Pete Gillinecffbde2020-06-05 19:46:45 +0100227 "api/legacy_platform/last-removed.txt",
228 ],
229}
230
231// Referenced implicitly from stable.i18n.module.platform.api.
232filegroup {
233 name: "stable.i18n.module.platform.api.api.public.latest",
234 srcs: [
235 "api/stable_platform/last-api.txt",
236 ],
237}
238
239// Referenced implicitly from stable.i18n.module.platform.api.
240filegroup {
241 name: "stable.i18n.module.platform.api-removed.api.public.latest",
242 srcs: [
243 "api/stable_platform/last-removed.txt",
Nicolas Geoffray4f8142a2020-05-29 17:00:48 +0100244 ],
245}
246
Paul Duffin4321d6b2019-10-03 13:32:26 +0100247// Generates stub source files for the core platform API of the I18N module.
248// i.e. every class/member that is either in the public API or annotated with
249// @CorePlatformApi.
250//
251// The API specification .txt files managed by this only contain the additional
252// classes/members that are in the intra-core API but which are not in the public
253// API.
Pete Gillinecffbde2020-06-05 19:46:45 +0100254//
255// For notes on the legacy and stable versions see mmodules/core_platform_api/Android.bp.
256
Nicolas Geoffray4f8142a2020-05-29 17:00:48 +0100257java_sdk_library {
Pete Gillinecffbde2020-06-05 19:46:45 +0100258 name: "legacy.i18n.module.platform.api",
Victor Change5b242d2020-10-30 11:39:52 +0000259 defaults: ["libcore_icu_bridge_defaults"],
Paul Duffin4321d6b2019-10-03 13:32:26 +0100260 srcs: [
Victor Changc9ae0db2019-10-28 18:56:09 +0000261 ":android_icu4j_repackaged_src_files",
Paul Duffin4321d6b2019-10-03 13:32:26 +0100262 ],
Paul Duffin4321d6b2019-10-03 13:32:26 +0100263 visibility: [
264 "//libcore:__subpackages__",
Nicolas Geoffray4f8142a2020-05-29 17:00:48 +0100265 "//packages/modules/RuntimeI18n/apex",
266 // Visibility for prebuilt i18n-module-sdk from the prebuilt of
267 // this module.
268 // TODO(b/155921753): Restrict this when prebuilts are in their proper
269 // locations.
270 "//prebuilts:__subpackages__",
Paul Duffin4321d6b2019-10-03 13:32:26 +0100271 ],
272 hostdex: true,
Pete Gillinecffbde2020-06-05 19:46:45 +0100273 api_dir: "api/legacy_platform",
Nicolas Geoffray4f8142a2020-05-29 17:00:48 +0100274 api_only: true,
Paul Duffin4321d6b2019-10-03 13:32:26 +0100275 sdk_version: "none",
Pete Gillin5e28f352020-06-02 16:22:22 +0100276 system_modules: "legacy-art-module-platform-api-stubs-system-modules",
Nicolas Geoffray4f8142a2020-05-29 17:00:48 +0100277
278 droiddoc_options: [
279 "--hide-annotation libcore.api.Hide ",
280 "--show-single-annotation libcore.api.CorePlatformApi ",
281 "--skip-annotation-instance-methods=false ",
282 ],
Paul Duffin4321d6b2019-10-03 13:32:26 +0100283}
284
Pete Gillinecffbde2020-06-05 19:46:45 +0100285java_sdk_library {
286 name: "stable.i18n.module.platform.api",
Victor Change5b242d2020-10-30 11:39:52 +0000287 defaults: ["libcore_icu_bridge_defaults"],
Pete Gillinecffbde2020-06-05 19:46:45 +0100288 srcs: [
289 ":android_icu4j_repackaged_src_files",
Pete Gillinecffbde2020-06-05 19:46:45 +0100290 ],
291 visibility: [
292 "//libcore:__subpackages__",
293 "//packages/modules/RuntimeI18n/apex",
294 // Visibility for prebuilt i18n-module-sdk from the prebuilt of
295 // this module.
296 // TODO(b/155921753): Restrict this when prebuilts are in their proper
297 // locations.
298 "//prebuilts:__subpackages__",
299 ],
300 hostdex: true,
301 api_dir: "api/stable_platform",
302 api_only: true,
303 sdk_version: "none",
304 system_modules: "stable-art-module-platform-api-stubs-system-modules",
305
306 droiddoc_options: [
307 "--hide-annotation libcore.api.Hide ",
308 "--show-single-annotation libcore.api.CorePlatformApi\\(status=libcore.api.CorePlatformApi.Status.STABLE\\)",
309 "--skip-annotation-instance-methods=false ",
310 ],
311}
312
Colin Cross6e18e292018-09-11 16:41:13 -0700313//==========================================================
314// build repackaged ICU tests
315//
316// Target builds against core-libart and core-oj so that it can access all the
317// repackaged android.icu classes and methods and not just the ones available
318// through the Android API.
Colin Cross6e18e292018-09-11 16:41:13 -0700319//==========================================================
320java_test {
321 name: "android-icu4j-tests",
Paul Duffind772e592019-06-03 16:09:02 +0100322 visibility: [
323 "//cts/tests/tests/icu",
324 ],
Colin Cross6e18e292018-09-11 16:41:13 -0700325
326 srcs: [
327 "src/main/tests/**/*.java",
328 "testing/src/**/*.java",
329 ],
Victor Changd956e992018-11-20 11:07:18 +0000330 java_resource_dirs: [
331 "src/main/tests",
Paul Duffin22d367a2019-06-25 12:06:26 +0100332 "testing/src",
Victor Changd956e992018-11-20 11:07:18 +0000333 ],
Paul Duffincddef922019-10-02 11:46:02 +0100334 libs: [
335 "core-icu4j",
336 ],
Colin Cross6e18e292018-09-11 16:41:13 -0700337 static_libs: [
338 "junit",
339 "junit-params",
Victor Chang21639cd2020-06-17 15:25:10 +0100340 "tzdata-testing",
Colin Cross6e18e292018-09-11 16:41:13 -0700341 ],
Colin Cross6e18e292018-09-11 16:41:13 -0700342
Neil Fuller45359cf2018-10-02 16:42:42 +0100343 patch_module: "java.base",
Paul Duffin7f35fb92019-06-07 14:10:01 +0100344 sdk_version: "none",
Paul Duffincddef922019-10-02 11:46:02 +0100345 system_modules: "art-module-intra-core-api-stubs-system-modules",
Colin Cross6e18e292018-09-11 16:41:13 -0700346}