• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1//
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
17package {
18    default_team: "trendy_team_java_core_libraries",
19    default_visibility: ["//visibility:private"],
20    // See: http://go/android-license-faq
21    // A large-scale-change added 'default_applicable_licenses' to import
22    // all of the 'license_kinds' from "external_icu_license"
23    // to get the below license kinds:
24    //   SPDX-license-identifier-Apache-2.0
25    //   SPDX-license-identifier-BSD
26    //   SPDX-license-identifier-ICU
27    //   SPDX-license-identifier-MIT
28    //   SPDX-license-identifier-Unicode-DFS
29    //   legacy_unencumbered
30    default_applicable_licenses: ["external_icu_license"],
31}
32
33//==========================================================
34// build repackaged ICU for target
35//
36// This is done in the libcore/JavaLibraries.mk file as there are circular
37// dependencies between ICU and libcore
38//==========================================================
39filegroup {
40    name: "android_icu4j_public_api_files",
41    srcs: [
42        ":android_icu4j_repackaged_src_files",
43    ],
44    path: "src/main/java",
45}
46
47filegroup {
48    name: "android_icu4j_repackaged_src_files",
49    srcs: ["src/main/java/android/icu/**/*.java"],
50    path: "src/main/java",
51}
52
53// The files contains Android-specific codes to expose intra-core APIs
54// from ICU4J/ICU4C to libcore or core platform APIs to the framework.
55// The package is com.android.icu.* and should not expose any public APIs.
56filegroup {
57    name: "libcore_icu_bridge_src_files",
58    srcs: ["libcore_bridge/src/java/**/*.java"],
59    path: "libcore_bridge/src/java",
60}
61
62java_defaults {
63    name: "libcore_icu_bridge_defaults",
64    srcs: [
65        "libcore_bridge/src/java/**/*.java",
66        ":app-compat-annotations-source",
67    ],
68    jarjar_rules: "jarjar-rules.txt",
69    plugins: [
70        "compat-changeid-annotation-processor",
71    ],
72}
73
74// A host library containing time zone related classes. Used for
75// host-side tools and tests that have to deal with Android
76// time zone data.
77java_library_host {
78    name: "timezone-host",
79    visibility: [
80        "//packages/modules/RuntimeI18n/apex",
81        "//system/timezone/input_tools/version",
82    ],
83    srcs: [
84        "libcore_bridge/src/java/com/android/i18n/timezone/TzDataSetVersion.java",
85    ],
86    libs: [
87        "art.module.api.annotations",
88    ],
89}
90
91// core-repackaged-icu4j contains only the repackaged ICU4J that does not
92// use any internal or android specific code. If it ever did then it could depend on
93// art-module-intra-core-api-stubs-system-modules (a superset) instead.
94// It is important that core-icu4j is restricted to only use stable APIs from the ART module
95// since it is in a different APEX module that can be updated independently.
96java_library_static {
97    name: "core-repackaged-icu4j",
98    installable: false,
99    srcs: [":android_icu4j_repackaged_src_files"],
100    libs: [
101        "unsupportedappusage",
102        // Need framework-api-annotations-lib for @FlaggedApi.
103        // Put framework-api-annotations into libs to avoid exposing the definition of framework's
104        // annotations from ICU (wrong place) instead of framework (correct place).
105        "framework-annotations-lib",
106        // We only need the aconfig library for @FlaggedApi. We can move it to static_libs
107        // if we need it for flagging features in the future.
108        "icu_aconfig_flags_lib",
109    ],
110    // The resource files are generated in the downstream branch master-icu-dev.
111    java_resource_dirs: ["resources"],
112
113    sdk_version: "none",
114    system_modules: "art-module-public-api-stubs-system-modules",
115
116    dxflags: ["--core-library"],
117    apex_available: [
118        "com.android.i18n",
119    ],
120    errorprone: {
121        javacflags: [
122            "-Xep:MissingOverride:OFF", // Ignore missing @Override.
123            "-Xep:ConstantOverflow:WARN", // Known constant overflow in SplittableRandom
124            "-Xep:BoxedPrimitiveEquality:WARN",
125            "-Xep:ComparableType:WARN",
126            "-Xep:EmptyTopLevelDeclaration:WARN",
127        ],
128    },
129    lint: {
130        warning_checks: ["SuspiciousIndentation"],
131    },
132}
133
134// A separated core library that contains ICU4J because ICU4J will be in a different APEX module,
135// not in ART module.
136java_library {
137    name: "core-icu4j",
138    defaults: ["libcore_icu_bridge_defaults"],
139    visibility: [
140        "//packages/modules/RuntimeI18n/apex",
141    ],
142    apex_available: [
143        "com.android.i18n",
144    ],
145    permitted_packages: [
146        "android.icu",
147        "com.android.icu",
148        "com.android.i18n.system",
149        "com.android.i18n.timezone",
150        "com.android.i18n.util",
151    ],
152    installable: true,
153    hostdex: false,
154
155    static_libs: ["core-repackaged-icu4j"],
156
157    // It is important that core-icu4j is restricted to only use stable APIs from the ART module
158    // since it is in a different APEX module that can be updated independently.
159    sdk_version: "none",
160    system_modules: "art-module-intra-core-api-stubs-system-modules",
161
162    dxflags: ["--core-library"],
163}
164
165// Java library for use on host, e.g. by ravenwood, robolectric.
166java_library {
167    name: "core-icu4j-for-host",
168    visibility: [
169        "//art/build",
170        "//external/robolectric",
171        "//external/robolectric-shadows",
172        "//frameworks/layoutlib",
173        "//frameworks/base/ravenwood:__subpackages__",
174        "//packages/modules/RuntimeI18n/apex",
175    ],
176    static_libs: [
177        "core-icu4j",
178    ],
179    sdk_version: "none",
180    system_modules: "none",
181}
182
183platform_compat_config {
184    name: "icu4j-platform-compat-config",
185    src: ":core-icu4j",
186    visibility: [
187        "//frameworks/base",
188    ],
189}
190
191java_sdk_library {
192    name: "i18n.module.public.api",
193    visibility: [
194        "//build/soong/java/core-libraries",
195        "//frameworks/base",
196        "//frameworks/base/api",
197        "//packages/modules/RuntimeI18n/apex",
198        // Visibility for prebuilt i18n-module-sdk from the prebuilt of
199        // this module.
200        // TODO(b/155921753): Restrict this when prebuilts are in their proper
201        // locations.
202        "//prebuilts:__subpackages__",
203    ],
204    // Added to make sure that no private classes leak out in stubs.
205    defaults: ["libcore_icu_bridge_defaults"],
206    srcs: [
207        // Added to make sure that no private classes leak out in stubs.
208        ":android_icu4j_repackaged_src_files",
209        ":android_icu4j_public_api_files",
210    ],
211    libs: [
212        "icu_aconfig_flags_lib",
213    ],
214    droiddoc_options: [
215        "--force-convert-to-warning-nullability-annotations +*:-android.*:+android.icu.*:-dalvik.* ",
216    ],
217    errorprone: {
218        javacflags: [
219            "-Xep:MissingOverride:OFF",
220        ],
221    },
222    lint: {
223        warning_checks: ["SuspiciousIndentation"],
224    },
225
226    public: {
227        enabled: true,
228    },
229    system: {
230        enabled: true,
231    },
232    module_lib: {
233        enabled: true,
234    },
235
236    api_dir: "api/public",
237    api_only: true,
238
239    // Emit nullability annotations from the source to the stub files.
240    annotations_enabled: true,
241
242    sdk_version: "none",
243    system_modules: "art-module-public-api-stubs-system-modules",
244
245    // The base name for the artifacts that are automatically published to the
246    // dist and which end up in one of the sub-directories of prebuilts/sdk.
247    // As long as this matches the name of the artifacts in prebuilts/sdk then
248    // the API will be checked for compatibility against the latest released
249    // version of the API.
250    dist_stem: "runtime-i18n",
251    dist_group: "android",
252    aconfig_declarations: [
253        "icu_aconfig_flags",
254    ],
255}
256
257// Generates stub source files for the intra-core API of the I18N module.
258// i.e. every class/member that is either in the public API or annotated with
259// @IntraCoreApi.
260//
261// The API specification .txt files managed by this only contain the additional
262// classes/members that are in the intra-core API but which are not the public
263// API.
264java_sdk_library {
265    name: "i18n.module.intra.core.api",
266    defaults: ["libcore_icu_bridge_defaults"],
267    srcs: [
268        ":android_icu4j_repackaged_src_files",
269    ],
270    visibility: [
271        "//libcore:__subpackages__",
272        "//packages/modules/RuntimeI18n/apex",
273        // Visibility for prebuilt i18n-module-sdk from the prebuilt of
274        // this module.
275        // TODO(b/155921753): Restrict this when prebuilts are in their proper
276        // locations.
277        "//prebuilts:__subpackages__",
278    ],
279    api_dir: "api/intra",
280    api_only: true,
281    sdk_version: "none",
282    system_modules: "art-module-intra-core-api-stubs-system-modules",
283
284    droiddoc_options: [
285        "--hide-annotation libcore.api.Hide ",
286        "--show-single-annotation libcore.api.IntraCoreApi ",
287    ],
288
289    // Don't copy any output files to the dist.
290    no_dist: true,
291
292    lint: {
293        warning_checks: ["SuspiciousIndentation"],
294    },
295}
296
297// Referenced implicitly from i18n.module.intra.core.api.
298filegroup {
299    name: "i18n.module.intra.core.api.api.combined.public.latest",
300    srcs: [
301        "api/intra/last-api.txt",
302    ],
303}
304
305// Referenced implicitly from i18n.module.intra.core.api.
306filegroup {
307    name: "i18n.module.intra.core.api-removed.api.combined.public.latest",
308    srcs: [
309        "api/intra/last-removed.txt",
310    ],
311}
312
313// Referenced implicitly from i18n.module.intra.core.api.
314filegroup {
315    name: "i18n.module.intra.core.api-incompatibilities.api.public.latest",
316    srcs: [
317        "api/intra/last-incompatibilities.txt",
318    ],
319}
320
321// Referenced implicitly from legacy.i18n.module.platform.api.
322filegroup {
323    name: "legacy.i18n.module.platform.api.api.combined.public.latest",
324    srcs: [
325        "api/legacy_platform/last-api.txt",
326    ],
327}
328
329// Referenced implicitly from legacy.i18n.module.platform.api.
330filegroup {
331    name: "legacy.i18n.module.platform.api-removed.api.combined.public.latest",
332    srcs: [
333        "api/legacy_platform/last-removed.txt",
334    ],
335}
336
337// Referenced implicitly from legacy.i18n.module.platform.api.
338filegroup {
339    name: "legacy.i18n.module.platform.api-incompatibilities.api.public.latest",
340    srcs: [
341        "api/legacy_platform/last-incompatibilities.txt",
342    ],
343}
344
345// Referenced implicitly from stable.i18n.module.platform.api.
346filegroup {
347    name: "stable.i18n.module.platform.api.api.combined.public.latest",
348    srcs: [
349        "api/stable_platform/last-api.txt",
350    ],
351}
352
353// Referenced implicitly from stable.i18n.module.platform.api.
354filegroup {
355    name: "stable.i18n.module.platform.api-removed.api.combined.public.latest",
356    srcs: [
357        "api/stable_platform/last-removed.txt",
358    ],
359}
360
361// Referenced implicitly from stable.i18n.module.platform.api.
362filegroup {
363    name: "stable.i18n.module.platform.api-incompatibilities.api.public.latest",
364    srcs: [
365        "api/stable_platform/last-incompatibilities.txt",
366    ],
367}
368
369// Generates stub source files for the core platform API of the I18N module.
370// i.e. every class/member that is either in the public API or annotated with
371// @CorePlatformApi.
372//
373// The API specification .txt files managed by this only contain the additional
374// classes/members that are in the intra-core API but which are not in the public
375// API.
376//
377// For notes on the legacy and stable versions see mmodules/core_platform_api/Android.bp.
378
379java_sdk_library {
380    name: "legacy.i18n.module.platform.api",
381    defaults: ["libcore_icu_bridge_defaults"],
382    srcs: [
383        ":android_icu4j_repackaged_src_files",
384    ],
385    visibility: [
386        "//build/soong/java/core-libraries",
387        "//packages/modules/RuntimeI18n/apex",
388        // Visibility for prebuilt i18n-module-sdk from the prebuilt of
389        // this module.
390        // TODO(b/155921753): Restrict this when prebuilts are in their proper
391        // locations.
392        "//prebuilts:__subpackages__",
393    ],
394    hostdex: true,
395    api_dir: "api/legacy_platform",
396    api_only: true,
397    sdk_version: "none",
398    system_modules: "art-module-lib-api-stubs-system-modules",
399
400    droiddoc_options: [
401        "--hide-annotation libcore.api.Hide ",
402        "--show-single-annotation libcore.api.CorePlatformApi ",
403    ],
404
405    // Don't copy any output files to the dist.
406    no_dist: true,
407
408    lint: {
409        warning_checks: ["SuspiciousIndentation"],
410    },
411}
412
413java_sdk_library {
414    name: "stable.i18n.module.platform.api",
415    defaults: ["libcore_icu_bridge_defaults"],
416    srcs: [
417        ":android_icu4j_repackaged_src_files",
418    ],
419    visibility: [
420        "//build/soong/java/core-libraries",
421        "//packages/modules/RuntimeI18n/apex",
422        // Visibility for prebuilt i18n-module-sdk from the prebuilt of
423        // this module.
424        // TODO(b/155921753): Restrict this when prebuilts are in their proper
425        // locations.
426        "//prebuilts:__subpackages__",
427    ],
428    hostdex: true,
429    api_dir: "api/stable_platform",
430    api_only: true,
431    sdk_version: "none",
432    system_modules: "art-module-lib-api-stubs-system-modules",
433
434    droiddoc_options: [
435        "--hide-annotation libcore.api.Hide ",
436        "--show-single-annotation libcore.api.CorePlatformApi\\(status=libcore.api.CorePlatformApi.Status.STABLE\\)",
437    ],
438
439    // Don't copy any output files to the dist.
440    no_dist: true,
441
442    lint: {
443        warning_checks: ["SuspiciousIndentation"],
444    },
445}
446
447//==========================================================
448// build repackaged ICU tests
449//
450// Target builds against core-libart and core-oj so that it can access all the
451// repackaged android.icu classes and methods and not just the ones available
452// through the Android API.
453//==========================================================
454java_test {
455    name: "android-icu4j-tests",
456    visibility: [
457        "//cts/tests/tests/icu",
458    ],
459
460    srcs: [
461        "src/main/tests/**/*.java",
462        "testing/src/**/*.java",
463    ],
464    java_resource_dirs: [
465        "src/main/tests",
466        "testing/src",
467    ],
468    libs: [
469        "core-icu4j",
470    ],
471    static_libs: [
472        "gson",
473        "junit",
474        "junit-params",
475        "tzdata-testing",
476    ],
477
478    patch_module: "java.base",
479    sdk_version: "none",
480    system_modules: "art-module-intra-core-api-stubs-system-modules",
481
482    errorprone: {
483        javacflags: [
484            "-Xep:EqualsNull:WARN",
485            "-Xep:ArrayToString:WARN",
486            "-Xep:SelfEquals:WARN",
487            "-Xep:SelfComparison:WARN",
488            "-Xep:ReturnValueIgnored:WARN",
489            "-Xep:IdentityBinaryExpression:WARN",
490            "-Xep:BoxedPrimitiveEquality:WARN",
491            "-Xep:ComparableType:WARN",
492        ],
493    },
494}
495