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