blob: 41eba87fccd99e258bbc1b0061071d066704cd36 [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"],
Bob Badour68fa3422021-02-12 20:43:12 -080019 // See: http://go/android-license-faq
20 // A large-scale-change added 'default_applicable_licenses' to import
21 // all of the 'license_kinds' from "external_icu_license"
22 // to get the below license kinds:
23 // SPDX-license-identifier-Apache-2.0
24 // SPDX-license-identifier-BSD
25 // SPDX-license-identifier-ICU
26 // SPDX-license-identifier-MIT
27 // SPDX-license-identifier-Unicode-DFS
28 // legacy_unencumbered
29 default_applicable_licenses: ["external_icu_license"],
Paul Duffind772e592019-06-03 16:09:02 +010030}
31
Colin Cross9a51b152017-08-29 16:04:52 -070032//==========================================================
33// build repackaged ICU for target
34//
35// This is done in the libcore/JavaLibraries.mk file as there are circular
36// dependencies between ICU and libcore
37//==========================================================
38filegroup {
Victor Changc9ae0db2019-10-28 18:56:09 +000039 name: "android_icu4j_public_api_files",
Victor Chang92c3bcf2019-10-07 11:36:39 +010040 srcs: [
41 ":android_icu4j_repackaged_src_files",
Victor Chang92c3bcf2019-10-07 11:36:39 +010042 ],
Jiyong Park684fe8a2019-08-19 13:23:42 +090043 path: "src/main/java",
Colin Cross9a51b152017-08-29 16:04:52 -070044}
45
Victor Chang92c3bcf2019-10-07 11:36:39 +010046filegroup {
47 name: "android_icu4j_repackaged_src_files",
48 srcs: ["src/main/java/android/icu/**/*.java"],
49 path: "src/main/java",
50}
51
52// The files contains Android-specific codes to expose intra-core APIs
Victor Chang71d684d2020-05-15 18:17:49 +010053// from ICU4J/ICU4C to libcore or core platform APIs to the framework.
54// The package is com.android.icu.* and should not expose any public APIs.
Victor Chang92c3bcf2019-10-07 11:36:39 +010055filegroup {
56 name: "libcore_icu_bridge_src_files",
Victor Changc9ae0db2019-10-28 18:56:09 +000057 srcs: ["libcore_bridge/src/java/**/*.java"],
58 path: "libcore_bridge/src/java",
Victor Chang92c3bcf2019-10-07 11:36:39 +010059}
60
Victor Change5b242d2020-10-30 11:39:52 +000061java_defaults {
62 name: "libcore_icu_bridge_defaults",
63 srcs: [
64 "libcore_bridge/src/java/**/*.java",
65 ":app-compat-annotations-source",
66 ],
Andrei Onea55651ce2020-12-09 16:16:43 +000067 jarjar_rules: "jarjar-rules.txt",
Victor Change5b242d2020-10-30 11:39:52 +000068 plugins: [
69 "compat-changeid-annotation-processor",
70 ],
71}
72
Martin Stjernholm3a15e592020-11-11 02:37:00 +000073// A host library containing time zone related classes. Used for
74// host-side tools and tests that have to deal with Android
75// time zone data.
76java_library_host {
77 name: "timezone-host",
78 visibility: [
79 "//packages/modules/RuntimeI18n/apex",
80 "//system/timezone/distro/core",
81 ],
Victor Chang21639cd2020-06-17 15:25:10 +010082 srcs: [
Victor Chang21639cd2020-06-17 15:25:10 +010083 "libcore_bridge/src/java/com/android/i18n/timezone/TzDataSetVersion.java",
84 ],
Martin Stjernholm3a15e592020-11-11 02:37:00 +000085 libs: [
86 "art.module.api.annotations",
87 ],
Victor Chang21639cd2020-06-17 15:25:10 +010088}
89
Victor Chang92c3bcf2019-10-07 11:36:39 +010090// core-repackaged-icu4j contains only the repackaged ICU4J that does not
91// use any internal or android specific code. If it ever did then it could depend on
92// art-module-intra-core-api-stubs-system-modules (a superset) instead.
93// It is important that core-icu4j is restricted to only use stable APIs from the ART module
94// since it is in a different APEX module that can be updated independently.
95java_library_static {
96 name: "core-repackaged-icu4j",
97 installable: false,
98 srcs: [":android_icu4j_repackaged_src_files"],
Artur Satayev2fc4dc32019-12-10 12:12:35 +000099 libs: ["unsupportedappusage"],
Victor Chang92c3bcf2019-10-07 11:36:39 +0100100 // The resource files are generated in the downstream branch master-icu-dev.
101 java_resource_dirs: ["resources"],
102
103 sdk_version: "none",
104 system_modules: "art-module-public-api-stubs-system-modules",
105
106 dxflags: ["--core-library"],
Victor Changaaf68452020-05-05 16:02:45 +0100107 apex_available: [
108 "com.android.i18n",
109 ],
Victor Chang92c3bcf2019-10-07 11:36:39 +0100110 errorprone: {
111 javacflags: [
112 "-Xep:MissingOverride:OFF", // Ignore missing @Override.
113 "-Xep:ConstantOverflow:WARN", // Known constant overflow in SplittableRandom
114 ],
115 },
116}
117
Paul Duffind31a0602019-09-26 16:23:55 +0100118// A separated core library that contains ICU4J because ICU4J will be in a different APEX module,
119// not in ART module.
120java_library {
121 name: "core-icu4j",
Victor Change5b242d2020-10-30 11:39:52 +0000122 defaults: ["libcore_icu_bridge_defaults"],
Paul Duffind31a0602019-09-26 16:23:55 +0100123 visibility: [
Victor Changa12ff872020-05-15 18:20:51 +0100124 "//packages/modules/RuntimeI18n/apex",
Paul Duffind31a0602019-09-26 16:23:55 +0100125 "//external/robolectric-shadows",
126 "//frameworks/layoutlib",
Victor Changaaf68452020-05-05 16:02:45 +0100127 "//art/build",
Paul Duffind31a0602019-09-26 16:23:55 +0100128 ],
Jiyong Park0ddd1ef2019-12-19 02:11:30 +0000129 apex_available: [
Victor Changaaf68452020-05-05 16:02:45 +0100130 "com.android.i18n",
131 ],
132 permitted_packages: [
133 "android.icu",
134 "com.android.icu",
Victor Chang21639cd2020-06-17 15:25:10 +0100135 "com.android.i18n.timezone",
Jiyong Park0ddd1ef2019-12-19 02:11:30 +0000136 ],
Paul Duffind31a0602019-09-26 16:23:55 +0100137 installable: true,
Victor Changaaf68452020-05-05 16:02:45 +0100138 hostdex: false,
Paul Duffind31a0602019-09-26 16:23:55 +0100139
Victor Chang92c3bcf2019-10-07 11:36:39 +0100140 static_libs: ["core-repackaged-icu4j"],
Paul Duffin2626a2a2019-10-08 15:17:42 +0100141
Paul Duffind31a0602019-09-26 16:23:55 +0100142 // It is important that core-icu4j is restricted to only use stable APIs from the ART module
143 // since it is in a different APEX module that can be updated independently.
144 sdk_version: "none",
Victor Chang92c3bcf2019-10-07 11:36:39 +0100145 system_modules: "art-module-intra-core-api-stubs-system-modules",
Paul Duffind31a0602019-09-26 16:23:55 +0100146
147 dxflags: ["--core-library"],
Paul Duffind31a0602019-09-26 16:23:55 +0100148}
149
Victor Change5b242d2020-10-30 11:39:52 +0000150platform_compat_config {
151 name: "icu4j-platform-compat-config",
152 src: ":core-icu4j",
153}
154
Nicolas Geoffray329d0352020-06-01 16:04:02 +0100155java_sdk_library {
156 name: "i18n.module.public.api",
157 visibility: [
Paul Duffinc5466492020-11-25 15:44:23 +0000158 "//frameworks/base",
159 "//frameworks/base/api",
Nicolas Geoffray329d0352020-06-01 16:04:02 +0100160 "//libcore",
161 "//packages/modules/RuntimeI18n/apex",
162 // Visibility for prebuilt i18n-module-sdk from the prebuilt of
163 // this module.
164 // TODO(b/155921753): Restrict this when prebuilts are in their proper
165 // locations.
166 "//prebuilts:__subpackages__",
167 ],
Paul Duffind31a0602019-09-26 16:23:55 +0100168 srcs: [
Victor Changc9ae0db2019-10-28 18:56:09 +0000169 ":android_icu4j_public_api_files",
Paul Duffind31a0602019-09-26 16:23:55 +0100170 ],
Anton Hansson2dac8582020-12-22 11:58:34 +0000171 droiddoc_options: [
172 "--force-convert-to-warning-nullability-annotations +*:-android.*:+android.icu.*:-dalvik.* ",
173 ],
Paul Duffind31a0602019-09-26 16:23:55 +0100174 errorprone: {
175 javacflags: [
176 "-Xep:MissingOverride:OFF",
177 ],
178 },
Nicolas Geoffray329d0352020-06-01 16:04:02 +0100179 api_dir: "api/public",
180 api_only: true,
Paul Duffind31a0602019-09-26 16:23:55 +0100181 sdk_version: "none",
182 system_modules: "art-module-public-api-stubs-system-modules",
Paul Duffinb70de992020-11-19 19:26:46 +0000183
Paul Duffinc5466492020-11-25 15:44:23 +0000184 // The base name for the artifacts that are automatically published to the
185 // dist and which end up in one of the sub-directories of prebuilts/sdk.
186 // As long as this matches the name of the artifacts in prebuilts/sdk then
187 // the API will be checked for compatibility against the latest released
188 // version of the API.
189 dist_stem: "runtime-i18n",
Nicolas Geoffray7f8aaf62020-06-03 14:39:04 +0100190}
191
Paul Duffincff90fa2019-10-02 10:18:28 +0100192// Generates stub source files for the intra-core API of the I18N module.
193// i.e. every class/member that is either in the public API or annotated with
194// @IntraCoreApi.
195//
196// The API specification .txt files managed by this only contain the additional
197// classes/members that are in the intra-core API but which are not the public
198// API.
Nicolas Geoffray7f8aaf62020-06-03 14:39:04 +0100199java_sdk_library {
200 name: "i18n.module.intra.core.api",
Victor Change5b242d2020-10-30 11:39:52 +0000201 defaults: ["libcore_icu_bridge_defaults"],
Paul Duffincff90fa2019-10-02 10:18:28 +0100202 srcs: [
Victor Changc9ae0db2019-10-28 18:56:09 +0000203 ":android_icu4j_repackaged_src_files",
Paul Duffincff90fa2019-10-02 10:18:28 +0100204 ],
Paul Duffincff90fa2019-10-02 10:18:28 +0100205 visibility: [
206 "//libcore:__subpackages__",
Nicolas Geoffray7f8aaf62020-06-03 14:39:04 +0100207 "//packages/modules/RuntimeI18n/apex",
208 // Visibility for prebuilt i18n-module-sdk from the prebuilt of
209 // this module.
210 // TODO(b/155921753): Restrict this when prebuilts are in their proper
211 // locations.
212 "//prebuilts:__subpackages__",
Paul Duffincff90fa2019-10-02 10:18:28 +0100213 ],
Nicolas Geoffray7f8aaf62020-06-03 14:39:04 +0100214 api_dir: "api/intra",
215 api_only: true,
Paul Duffincff90fa2019-10-02 10:18:28 +0100216 sdk_version: "none",
217 system_modules: "art-module-intra-core-api-stubs-system-modules",
Nicolas Geoffray7f8aaf62020-06-03 14:39:04 +0100218
219 droiddoc_options: [
220 "--hide-annotation libcore.api.Hide ",
221 "--show-single-annotation libcore.api.IntraCoreApi ",
222 "--skip-annotation-instance-methods=false ",
223 ],
Paul Duffinb70de992020-11-19 19:26:46 +0000224
225 // Don't copy any output files to the dist.
226 no_dist: true,
Paul Duffincff90fa2019-10-02 10:18:28 +0100227}
228
Anton Hanssona60edaf2020-12-21 17:07:12 +0000229// Referenced implicitly from i18n.module.intra.core.api.
230filegroup {
231 name: "i18n.module.intra.core.api.api.public.latest",
232 srcs: [
233 "api/intra/last-api.txt",
234 ],
235}
236
237// Referenced implicitly from i18n.module.intra.core.api.
238filegroup {
239 name: "i18n.module.intra.core.api-removed.api.public.latest",
240 srcs: [
241 "api/intra/last-removed.txt",
242 ],
243}
244
Pete Gillinecffbde2020-06-05 19:46:45 +0100245// Referenced implicitly from legacy.i18n.module.platform.api.
Nicolas Geoffray4f8142a2020-05-29 17:00:48 +0100246filegroup {
Pete Gillinecffbde2020-06-05 19:46:45 +0100247 name: "legacy.i18n.module.platform.api.api.public.latest",
Nicolas Geoffray4f8142a2020-05-29 17:00:48 +0100248 srcs: [
Pete Gillinecffbde2020-06-05 19:46:45 +0100249 "api/legacy_platform/last-api.txt",
Nicolas Geoffray4f8142a2020-05-29 17:00:48 +0100250 ],
251}
252
Pete Gillinecffbde2020-06-05 19:46:45 +0100253// Referenced implicitly from legacy.i18n.module.platform.api.
Nicolas Geoffray4f8142a2020-05-29 17:00:48 +0100254filegroup {
Pete Gillinecffbde2020-06-05 19:46:45 +0100255 name: "legacy.i18n.module.platform.api-removed.api.public.latest",
Nicolas Geoffray4f8142a2020-05-29 17:00:48 +0100256 srcs: [
Pete Gillinecffbde2020-06-05 19:46:45 +0100257 "api/legacy_platform/last-removed.txt",
258 ],
259}
260
261// Referenced implicitly from stable.i18n.module.platform.api.
262filegroup {
263 name: "stable.i18n.module.platform.api.api.public.latest",
264 srcs: [
265 "api/stable_platform/last-api.txt",
266 ],
267}
268
269// Referenced implicitly from stable.i18n.module.platform.api.
270filegroup {
271 name: "stable.i18n.module.platform.api-removed.api.public.latest",
272 srcs: [
273 "api/stable_platform/last-removed.txt",
Nicolas Geoffray4f8142a2020-05-29 17:00:48 +0100274 ],
275}
276
Paul Duffin4321d6b2019-10-03 13:32:26 +0100277// Generates stub source files for the core platform API of the I18N module.
278// i.e. every class/member that is either in the public API or annotated with
279// @CorePlatformApi.
280//
281// The API specification .txt files managed by this only contain the additional
282// classes/members that are in the intra-core API but which are not in the public
283// API.
Pete Gillinecffbde2020-06-05 19:46:45 +0100284//
285// For notes on the legacy and stable versions see mmodules/core_platform_api/Android.bp.
286
Nicolas Geoffray4f8142a2020-05-29 17:00:48 +0100287java_sdk_library {
Pete Gillinecffbde2020-06-05 19:46:45 +0100288 name: "legacy.i18n.module.platform.api",
Victor Change5b242d2020-10-30 11:39:52 +0000289 defaults: ["libcore_icu_bridge_defaults"],
Paul Duffin4321d6b2019-10-03 13:32:26 +0100290 srcs: [
Victor Changc9ae0db2019-10-28 18:56:09 +0000291 ":android_icu4j_repackaged_src_files",
Paul Duffin4321d6b2019-10-03 13:32:26 +0100292 ],
Paul Duffin4321d6b2019-10-03 13:32:26 +0100293 visibility: [
294 "//libcore:__subpackages__",
Nicolas Geoffray4f8142a2020-05-29 17:00:48 +0100295 "//packages/modules/RuntimeI18n/apex",
296 // Visibility for prebuilt i18n-module-sdk from the prebuilt of
297 // this module.
298 // TODO(b/155921753): Restrict this when prebuilts are in their proper
299 // locations.
300 "//prebuilts:__subpackages__",
Paul Duffin4321d6b2019-10-03 13:32:26 +0100301 ],
302 hostdex: true,
Pete Gillinecffbde2020-06-05 19:46:45 +0100303 api_dir: "api/legacy_platform",
Nicolas Geoffray4f8142a2020-05-29 17:00:48 +0100304 api_only: true,
Paul Duffin4321d6b2019-10-03 13:32:26 +0100305 sdk_version: "none",
Pete Gillin5e28f352020-06-02 16:22:22 +0100306 system_modules: "legacy-art-module-platform-api-stubs-system-modules",
Nicolas Geoffray4f8142a2020-05-29 17:00:48 +0100307
308 droiddoc_options: [
309 "--hide-annotation libcore.api.Hide ",
310 "--show-single-annotation libcore.api.CorePlatformApi ",
311 "--skip-annotation-instance-methods=false ",
312 ],
Paul Duffinb70de992020-11-19 19:26:46 +0000313
314 // Don't copy any output files to the dist.
315 no_dist: true,
Paul Duffin4321d6b2019-10-03 13:32:26 +0100316}
317
Pete Gillinecffbde2020-06-05 19:46:45 +0100318java_sdk_library {
319 name: "stable.i18n.module.platform.api",
Victor Change5b242d2020-10-30 11:39:52 +0000320 defaults: ["libcore_icu_bridge_defaults"],
Pete Gillinecffbde2020-06-05 19:46:45 +0100321 srcs: [
322 ":android_icu4j_repackaged_src_files",
Pete Gillinecffbde2020-06-05 19:46:45 +0100323 ],
324 visibility: [
325 "//libcore:__subpackages__",
326 "//packages/modules/RuntimeI18n/apex",
327 // Visibility for prebuilt i18n-module-sdk from the prebuilt of
328 // this module.
329 // TODO(b/155921753): Restrict this when prebuilts are in their proper
330 // locations.
331 "//prebuilts:__subpackages__",
332 ],
333 hostdex: true,
334 api_dir: "api/stable_platform",
335 api_only: true,
336 sdk_version: "none",
337 system_modules: "stable-art-module-platform-api-stubs-system-modules",
338
339 droiddoc_options: [
340 "--hide-annotation libcore.api.Hide ",
341 "--show-single-annotation libcore.api.CorePlatformApi\\(status=libcore.api.CorePlatformApi.Status.STABLE\\)",
342 "--skip-annotation-instance-methods=false ",
343 ],
Paul Duffinb70de992020-11-19 19:26:46 +0000344
345 // Don't copy any output files to the dist.
346 no_dist: true,
Pete Gillinecffbde2020-06-05 19:46:45 +0100347}
348
Colin Cross6e18e292018-09-11 16:41:13 -0700349//==========================================================
350// build repackaged ICU tests
351//
352// Target builds against core-libart and core-oj so that it can access all the
353// repackaged android.icu classes and methods and not just the ones available
354// through the Android API.
Colin Cross6e18e292018-09-11 16:41:13 -0700355//==========================================================
356java_test {
357 name: "android-icu4j-tests",
Paul Duffind772e592019-06-03 16:09:02 +0100358 visibility: [
359 "//cts/tests/tests/icu",
360 ],
Colin Cross6e18e292018-09-11 16:41:13 -0700361
362 srcs: [
363 "src/main/tests/**/*.java",
364 "testing/src/**/*.java",
365 ],
Victor Changd956e992018-11-20 11:07:18 +0000366 java_resource_dirs: [
367 "src/main/tests",
Paul Duffin22d367a2019-06-25 12:06:26 +0100368 "testing/src",
Victor Changd956e992018-11-20 11:07:18 +0000369 ],
Paul Duffincddef922019-10-02 11:46:02 +0100370 libs: [
371 "core-icu4j",
372 ],
Colin Cross6e18e292018-09-11 16:41:13 -0700373 static_libs: [
374 "junit",
375 "junit-params",
Victor Chang21639cd2020-06-17 15:25:10 +0100376 "tzdata-testing",
Colin Cross6e18e292018-09-11 16:41:13 -0700377 ],
Colin Cross6e18e292018-09-11 16:41:13 -0700378
Neil Fuller45359cf2018-10-02 16:42:42 +0100379 patch_module: "java.base",
Paul Duffin7f35fb92019-06-07 14:10:01 +0100380 sdk_version: "none",
Paul Duffincddef922019-10-02 11:46:02 +0100381 system_modules: "art-module-intra-core-api-stubs-system-modules",
Colin Cross6e18e292018-09-11 16:41:13 -0700382}