blob: aa7bb2fb8f3b2ea7550813e0c2c14976c2d32b0f [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
Jaewoong Jung3fd81f32021-03-09 16:06:07 -0800245// Referenced implicitly from i18n.module.intra.core.api.
246filegroup {
247 name: "i18n.module.intra.core.api-incompatibilities.api.public.latest",
248 srcs: [
249 "api/intra/last-incompatibilities.txt",
250 ],
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.api.public.latest",
Nicolas Geoffray4f8142a2020-05-29 17:00:48 +0100256 srcs: [
Pete Gillinecffbde2020-06-05 19:46:45 +0100257 "api/legacy_platform/last-api.txt",
Nicolas Geoffray4f8142a2020-05-29 17:00:48 +0100258 ],
259}
260
Pete Gillinecffbde2020-06-05 19:46:45 +0100261// Referenced implicitly from legacy.i18n.module.platform.api.
Nicolas Geoffray4f8142a2020-05-29 17:00:48 +0100262filegroup {
Pete Gillinecffbde2020-06-05 19:46:45 +0100263 name: "legacy.i18n.module.platform.api-removed.api.public.latest",
Nicolas Geoffray4f8142a2020-05-29 17:00:48 +0100264 srcs: [
Pete Gillinecffbde2020-06-05 19:46:45 +0100265 "api/legacy_platform/last-removed.txt",
266 ],
267}
268
Jaewoong Jung3fd81f32021-03-09 16:06:07 -0800269// Referenced implicitly from legacy.i18n.module.platform.api.
270filegroup {
271 name: "legacy.i18n.module.platform.api-incompatibilities.api.public.latest",
272 srcs: [
273 "api/legacy_platform/last-incompatibilities.txt",
274 ],
275}
276
Pete Gillinecffbde2020-06-05 19:46:45 +0100277// Referenced implicitly from stable.i18n.module.platform.api.
278filegroup {
279 name: "stable.i18n.module.platform.api.api.public.latest",
280 srcs: [
281 "api/stable_platform/last-api.txt",
282 ],
283}
284
285// Referenced implicitly from stable.i18n.module.platform.api.
286filegroup {
287 name: "stable.i18n.module.platform.api-removed.api.public.latest",
288 srcs: [
289 "api/stable_platform/last-removed.txt",
Nicolas Geoffray4f8142a2020-05-29 17:00:48 +0100290 ],
291}
292
Jaewoong Jung3fd81f32021-03-09 16:06:07 -0800293// Referenced implicitly from stable.i18n.module.platform.api.
294filegroup {
295 name: "stable.i18n.module.platform.api-incompatibilities.api.public.latest",
296 srcs: [
297 "api/stable_platform/last-incompatibilities.txt",
298 ],
299}
300
Paul Duffin4321d6b2019-10-03 13:32:26 +0100301// Generates stub source files for the core platform API of the I18N module.
302// i.e. every class/member that is either in the public API or annotated with
303// @CorePlatformApi.
304//
305// The API specification .txt files managed by this only contain the additional
306// classes/members that are in the intra-core API but which are not in the public
307// API.
Pete Gillinecffbde2020-06-05 19:46:45 +0100308//
309// For notes on the legacy and stable versions see mmodules/core_platform_api/Android.bp.
310
Nicolas Geoffray4f8142a2020-05-29 17:00:48 +0100311java_sdk_library {
Pete Gillinecffbde2020-06-05 19:46:45 +0100312 name: "legacy.i18n.module.platform.api",
Victor Change5b242d2020-10-30 11:39:52 +0000313 defaults: ["libcore_icu_bridge_defaults"],
Paul Duffin4321d6b2019-10-03 13:32:26 +0100314 srcs: [
Victor Changc9ae0db2019-10-28 18:56:09 +0000315 ":android_icu4j_repackaged_src_files",
Paul Duffin4321d6b2019-10-03 13:32:26 +0100316 ],
Paul Duffin4321d6b2019-10-03 13:32:26 +0100317 visibility: [
318 "//libcore:__subpackages__",
Nicolas Geoffray4f8142a2020-05-29 17:00:48 +0100319 "//packages/modules/RuntimeI18n/apex",
320 // Visibility for prebuilt i18n-module-sdk from the prebuilt of
321 // this module.
322 // TODO(b/155921753): Restrict this when prebuilts are in their proper
323 // locations.
324 "//prebuilts:__subpackages__",
Paul Duffin4321d6b2019-10-03 13:32:26 +0100325 ],
326 hostdex: true,
Pete Gillinecffbde2020-06-05 19:46:45 +0100327 api_dir: "api/legacy_platform",
Nicolas Geoffray4f8142a2020-05-29 17:00:48 +0100328 api_only: true,
Paul Duffin4321d6b2019-10-03 13:32:26 +0100329 sdk_version: "none",
Pete Gillin5e28f352020-06-02 16:22:22 +0100330 system_modules: "legacy-art-module-platform-api-stubs-system-modules",
Nicolas Geoffray4f8142a2020-05-29 17:00:48 +0100331
332 droiddoc_options: [
333 "--hide-annotation libcore.api.Hide ",
334 "--show-single-annotation libcore.api.CorePlatformApi ",
335 "--skip-annotation-instance-methods=false ",
336 ],
Paul Duffinb70de992020-11-19 19:26:46 +0000337
338 // Don't copy any output files to the dist.
339 no_dist: true,
Paul Duffin4321d6b2019-10-03 13:32:26 +0100340}
341
Pete Gillinecffbde2020-06-05 19:46:45 +0100342java_sdk_library {
343 name: "stable.i18n.module.platform.api",
Victor Change5b242d2020-10-30 11:39:52 +0000344 defaults: ["libcore_icu_bridge_defaults"],
Pete Gillinecffbde2020-06-05 19:46:45 +0100345 srcs: [
346 ":android_icu4j_repackaged_src_files",
Pete Gillinecffbde2020-06-05 19:46:45 +0100347 ],
348 visibility: [
349 "//libcore:__subpackages__",
350 "//packages/modules/RuntimeI18n/apex",
351 // Visibility for prebuilt i18n-module-sdk from the prebuilt of
352 // this module.
353 // TODO(b/155921753): Restrict this when prebuilts are in their proper
354 // locations.
355 "//prebuilts:__subpackages__",
356 ],
357 hostdex: true,
358 api_dir: "api/stable_platform",
359 api_only: true,
360 sdk_version: "none",
361 system_modules: "stable-art-module-platform-api-stubs-system-modules",
362
363 droiddoc_options: [
364 "--hide-annotation libcore.api.Hide ",
365 "--show-single-annotation libcore.api.CorePlatformApi\\(status=libcore.api.CorePlatformApi.Status.STABLE\\)",
366 "--skip-annotation-instance-methods=false ",
367 ],
Paul Duffinb70de992020-11-19 19:26:46 +0000368
369 // Don't copy any output files to the dist.
370 no_dist: true,
Pete Gillinecffbde2020-06-05 19:46:45 +0100371}
372
Colin Cross6e18e292018-09-11 16:41:13 -0700373//==========================================================
374// build repackaged ICU tests
375//
376// Target builds against core-libart and core-oj so that it can access all the
377// repackaged android.icu classes and methods and not just the ones available
378// through the Android API.
Colin Cross6e18e292018-09-11 16:41:13 -0700379//==========================================================
380java_test {
381 name: "android-icu4j-tests",
Paul Duffind772e592019-06-03 16:09:02 +0100382 visibility: [
383 "//cts/tests/tests/icu",
384 ],
Colin Cross6e18e292018-09-11 16:41:13 -0700385
386 srcs: [
387 "src/main/tests/**/*.java",
388 "testing/src/**/*.java",
389 ],
Victor Changd956e992018-11-20 11:07:18 +0000390 java_resource_dirs: [
391 "src/main/tests",
Paul Duffin22d367a2019-06-25 12:06:26 +0100392 "testing/src",
Victor Changd956e992018-11-20 11:07:18 +0000393 ],
Paul Duffincddef922019-10-02 11:46:02 +0100394 libs: [
395 "core-icu4j",
396 ],
Colin Cross6e18e292018-09-11 16:41:13 -0700397 static_libs: [
398 "junit",
399 "junit-params",
Victor Chang21639cd2020-06-17 15:25:10 +0100400 "tzdata-testing",
Colin Cross6e18e292018-09-11 16:41:13 -0700401 ],
Colin Cross6e18e292018-09-11 16:41:13 -0700402
Neil Fuller45359cf2018-10-02 16:42:42 +0100403 patch_module: "java.base",
Paul Duffin7f35fb92019-06-07 14:10:01 +0100404 sdk_version: "none",
Paul Duffincddef922019-10-02 11:46:02 +0100405 system_modules: "art-module-intra-core-api-stubs-system-modules",
Colin Cross6e18e292018-09-11 16:41:13 -0700406}