• 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}
31
32cc_library_shared {
33    name: "libandroidicu",
34
35    // All code is imported via libandroidicu_static.
36    srcs: [],
37    // host_supported is required for some cases, e.g. host apex. This library
38    // is not intended for general host use.  Please refer to
39    // external/icu/build/icu.go for the full allowlist.
40    host_supported: true,
41    native_bridge_supported: true,
42    unique_host_soname: true,
43    apex_available: [
44        "com.android.i18n",
45    ],
46
47    // The implementation of libandroidicu depends on libicuuc and and libicui18n,
48    // but we need to export the headers in include/.
49    //
50    // However, include/unicode has a copy of a subset of header files
51    // as in libicuuc and libicui18n. We can't build C/C++ codes against
52    // both set of headers, since the headers have the same relative paths,
53    // and the compiler will find it ambiguous.
54    //
55    // Instead, we build the implementation of the shim libaray
56    // as a static library aganist libicuuc and libicui18n first,
57    // and export the headers in include/.
58    whole_static_libs: ["libandroidicu_static"],
59    shared_libs: [
60        "libbase",
61        "libicuuc",
62        "libicui18n",
63        "liblog",
64    ],
65    header_libs: ["libandroidicu_headers"],
66    export_header_lib_headers: ["libandroidicu_headers"],
67    stubs: {
68        symbol_file: "libandroidicu.map.txt",
69        versions: [
70            "1",
71        ],
72    },
73    cppflags: [
74        "-std=c++11", // Use the same C++ version as libicuuc
75    ],
76    cflags: [
77        "-Wall",
78        "-Werror",
79    ],
80    target: {
81        android: {
82            cflags: [
83                "-DANDROID_LINK_SHARED_ICU4C",
84            ],
85            version_script: "libandroidicu.map.txt",
86        },
87        native_bridge: {
88            exclude_shared_libs: [
89                "libicuuc",
90                "libicui18n",
91            ],
92            shared_libs: [
93                "libnative_bridge_guest_libicuuc",
94                "libnative_bridge_guest_libicui18n",
95            ],
96        },
97        windows: {
98            enabled: true,
99        },
100    },
101}
102
103cc_library_headers {
104    name: "libandroidicu_headers",
105    host_supported: true,
106    native_bridge_supported: true,
107    apex_available: [
108        "com.android.art",
109        "com.android.art.debug",
110        "com.android.i18n",
111    ],
112
113    // include/unicode/: Includes modified C headers from ICU4C,
114    //                   but excludes C++ headers.
115    // include/uconfig_local.h: local configuration specific for libandroidicu
116    export_include_dirs: ["include"],
117    target: {
118        windows: {
119            enabled: true,
120        },
121    },
122}
123
124// TODO: http://b/120776993 Testing for libandroidicu
125