• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright (C) 2018 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// A shared library for use on Android by frameworks and other code outside
16// of the ART mainline module. It provides a subset of ICU APIs, some
17// Android extensions and stable symbols. Most Android target code should
18// depend on this library.
19//
20// With the exception of a few special cases like host apex build targets,
21// host binaries should use libicuuc + libicui18n directly.
22package {
23    // See: http://go/android-license-faq
24    // A large-scale-change added 'default_applicable_licenses' to import
25    // all of the 'license_kinds' from "external_icu_license"
26    // to get the below license kinds:
27    //   SPDX-license-identifier-Apache-2.0
28    //   SPDX-license-identifier-Unicode-DFS
29    default_applicable_licenses: ["external_icu_license"],
30    default_visibility: ["//external/icu:__subpackages__"],
31}
32
33cc_library_shared {
34    name: "libandroidicu",
35
36    // All code is imported via libandroidicu_static.
37    srcs: [],
38    // host_supported is required for some cases, e.g. host apex. This library
39    // is not intended for general host use.  Please refer to
40    // external/icu/build/icu.go for the full allowlist.
41    host_supported: true,
42    native_bridge_supported: true,
43    unique_host_soname: true,
44    apex_available: [
45        "com.android.i18n",
46    ],
47
48    // The implementation of libandroidicu depends on libicuuc and and libicui18n,
49    // but we need to export the headers in include/.
50    //
51    // However, include/unicode has a copy of a subset of header files
52    // as in libicuuc and libicui18n. We can't build C/C++ codes against
53    // both set of headers, since the headers have the same relative paths,
54    // and the compiler will find it ambiguous.
55    //
56    // Instead, we build the implementation of the shim libaray
57    // as a static library aganist libicuuc and libicui18n first,
58    // and export the headers in include/.
59    whole_static_libs: ["libandroidicu_static"],
60    shared_libs: [
61        "libbase",
62        "libicuuc",
63        "libicui18n",
64        "liblog",
65    ],
66    header_libs: ["libandroidicu_headers"],
67    export_header_lib_headers: ["libandroidicu_headers"],
68    stubs: {
69        symbol_file: "libandroidicu.map.txt",
70        versions: [
71            "1",
72        ],
73    },
74    cflags: [
75        "-Wall",
76        "-Werror",
77    ],
78    target: {
79        android: {
80            cflags: [
81                "-DANDROID_LINK_SHARED_ICU4C",
82            ],
83            version_script: "libandroidicu.map.txt",
84        },
85        windows: {
86            enabled: true,
87        },
88    },
89    // Only add a new path below if your project needs UConverter or URegularExpression from ICU.
90    visibility: [
91        "//build/orchestrator/apis",
92        "//external/icu:__subpackages__",
93        "//packages/modules/RuntimeI18n:__subpackages__",
94        // The following dependencies can't use libicu instead, because it depends on UConverter
95        // or URegularExpression or statically linking libsqlite / libxml2.
96        "//external/libxml2",
97        "//external/robolectric/nativeruntime/external/sqlite/android",
98        "//external/sqlite:__subpackages__",
99        "//external/sfntly",
100        "//frameworks/av/media/libmedia",
101    ],
102}
103
104cc_library_headers {
105    name: "libandroidicu_headers",
106    host_supported: true,
107    native_bridge_supported: true,
108    apex_available: [
109        "com.android.art",
110        "com.android.art.debug",
111        "com.android.i18n",
112    ],
113
114    // include/unicode/: Includes modified C headers from ICU4C,
115    //                   but excludes C++ headers.
116    // include/uconfig_local.h: local configuration specific for libandroidicu
117    export_include_dirs: ["include"],
118    target: {
119        windows: {
120            enabled: true,
121        },
122    },
123}
124
125// TODO: http://b/120776993 Testing for libandroidicu
126