1*0e209d39SAndroid Build Coastguard Worker// Copyright (C) 2018 The Android Open Source Project 2*0e209d39SAndroid Build Coastguard Worker// 3*0e209d39SAndroid Build Coastguard Worker// Licensed under the Apache License, Version 2.0 (the "License"); 4*0e209d39SAndroid Build Coastguard Worker// you may not use this file except in compliance with the License. 5*0e209d39SAndroid Build Coastguard Worker// You may obtain a copy of the License at 6*0e209d39SAndroid Build Coastguard Worker// 7*0e209d39SAndroid Build Coastguard Worker// http://www.apache.org/licenses/LICENSE-2.0 8*0e209d39SAndroid Build Coastguard Worker// 9*0e209d39SAndroid Build Coastguard Worker// Unless required by applicable law or agreed to in writing, software 10*0e209d39SAndroid Build Coastguard Worker// distributed under the License is distributed on an "AS IS" BASIS, 11*0e209d39SAndroid Build Coastguard Worker// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12*0e209d39SAndroid Build Coastguard Worker// See the License for the specific language governing permissions and 13*0e209d39SAndroid Build Coastguard Worker// limitations under the License. 14*0e209d39SAndroid Build Coastguard Worker 15*0e209d39SAndroid Build Coastguard Worker// A shared library for use on Android by frameworks and other code outside 16*0e209d39SAndroid Build Coastguard Worker// of the ART mainline module. It provides a subset of ICU APIs, some 17*0e209d39SAndroid Build Coastguard Worker// Android extensions and stable symbols. Most Android target code should 18*0e209d39SAndroid Build Coastguard Worker// depend on this library. 19*0e209d39SAndroid Build Coastguard Worker// 20*0e209d39SAndroid Build Coastguard Worker// With the exception of a few special cases like host apex build targets, 21*0e209d39SAndroid Build Coastguard Worker// host binaries should use libicuuc + libicui18n directly. 22*0e209d39SAndroid Build Coastguard Workerpackage { 23*0e209d39SAndroid Build Coastguard Worker default_team: "trendy_team_java_core_libraries", 24*0e209d39SAndroid Build Coastguard Worker // See: http://go/android-license-faq 25*0e209d39SAndroid Build Coastguard Worker // A large-scale-change added 'default_applicable_licenses' to import 26*0e209d39SAndroid Build Coastguard Worker // all of the 'license_kinds' from "external_icu_license" 27*0e209d39SAndroid Build Coastguard Worker // to get the below license kinds: 28*0e209d39SAndroid Build Coastguard Worker // SPDX-license-identifier-Apache-2.0 29*0e209d39SAndroid Build Coastguard Worker // SPDX-license-identifier-Unicode-DFS 30*0e209d39SAndroid Build Coastguard Worker default_applicable_licenses: ["external_icu_license"], 31*0e209d39SAndroid Build Coastguard Worker default_visibility: ["//external/icu:__subpackages__"], 32*0e209d39SAndroid Build Coastguard Worker} 33*0e209d39SAndroid Build Coastguard Worker 34*0e209d39SAndroid Build Coastguard Workercc_library_shared { 35*0e209d39SAndroid Build Coastguard Worker name: "libandroidicu", 36*0e209d39SAndroid Build Coastguard Worker 37*0e209d39SAndroid Build Coastguard Worker // All code is imported via libandroidicu_static. 38*0e209d39SAndroid Build Coastguard Worker srcs: [], 39*0e209d39SAndroid Build Coastguard Worker // host_supported is required for some cases, e.g. host apex. This library 40*0e209d39SAndroid Build Coastguard Worker // is not intended for general host use. Please refer to 41*0e209d39SAndroid Build Coastguard Worker // external/icu/build/icu.go for the full allowlist. 42*0e209d39SAndroid Build Coastguard Worker host_supported: true, 43*0e209d39SAndroid Build Coastguard Worker native_bridge_supported: true, 44*0e209d39SAndroid Build Coastguard Worker unique_host_soname: true, 45*0e209d39SAndroid Build Coastguard Worker apex_available: [ 46*0e209d39SAndroid Build Coastguard Worker "com.android.i18n", 47*0e209d39SAndroid Build Coastguard Worker ], 48*0e209d39SAndroid Build Coastguard Worker 49*0e209d39SAndroid Build Coastguard Worker // The implementation of libandroidicu depends on libicuuc and and libicui18n, 50*0e209d39SAndroid Build Coastguard Worker // but we need to export the headers in include/. 51*0e209d39SAndroid Build Coastguard Worker // 52*0e209d39SAndroid Build Coastguard Worker // However, include/unicode has a copy of a subset of header files 53*0e209d39SAndroid Build Coastguard Worker // as in libicuuc and libicui18n. We can't build C/C++ codes against 54*0e209d39SAndroid Build Coastguard Worker // both set of headers, since the headers have the same relative paths, 55*0e209d39SAndroid Build Coastguard Worker // and the compiler will find it ambiguous. 56*0e209d39SAndroid Build Coastguard Worker // 57*0e209d39SAndroid Build Coastguard Worker // Instead, we build the implementation of the shim libaray 58*0e209d39SAndroid Build Coastguard Worker // as a static library aganist libicuuc and libicui18n first, 59*0e209d39SAndroid Build Coastguard Worker // and export the headers in include/. 60*0e209d39SAndroid Build Coastguard Worker whole_static_libs: ["libandroidicu_static"], 61*0e209d39SAndroid Build Coastguard Worker shared_libs: [ 62*0e209d39SAndroid Build Coastguard Worker "libbase", 63*0e209d39SAndroid Build Coastguard Worker "libicuuc", 64*0e209d39SAndroid Build Coastguard Worker "libicui18n", 65*0e209d39SAndroid Build Coastguard Worker "liblog", 66*0e209d39SAndroid Build Coastguard Worker ], 67*0e209d39SAndroid Build Coastguard Worker header_libs: ["libandroidicu_headers"], 68*0e209d39SAndroid Build Coastguard Worker export_header_lib_headers: ["libandroidicu_headers"], 69*0e209d39SAndroid Build Coastguard Worker stubs: { 70*0e209d39SAndroid Build Coastguard Worker symbol_file: "libandroidicu.map.txt", 71*0e209d39SAndroid Build Coastguard Worker versions: [ 72*0e209d39SAndroid Build Coastguard Worker "1", 73*0e209d39SAndroid Build Coastguard Worker ], 74*0e209d39SAndroid Build Coastguard Worker }, 75*0e209d39SAndroid Build Coastguard Worker cflags: [ 76*0e209d39SAndroid Build Coastguard Worker "-Wall", 77*0e209d39SAndroid Build Coastguard Worker "-Werror", 78*0e209d39SAndroid Build Coastguard Worker ], 79*0e209d39SAndroid Build Coastguard Worker target: { 80*0e209d39SAndroid Build Coastguard Worker android: { 81*0e209d39SAndroid Build Coastguard Worker cflags: [ 82*0e209d39SAndroid Build Coastguard Worker "-DANDROID_LINK_SHARED_ICU4C", 83*0e209d39SAndroid Build Coastguard Worker ], 84*0e209d39SAndroid Build Coastguard Worker version_script: "libandroidicu.map.txt", 85*0e209d39SAndroid Build Coastguard Worker }, 86*0e209d39SAndroid Build Coastguard Worker windows: { 87*0e209d39SAndroid Build Coastguard Worker enabled: true, 88*0e209d39SAndroid Build Coastguard Worker }, 89*0e209d39SAndroid Build Coastguard Worker }, 90*0e209d39SAndroid Build Coastguard Worker // Only add a new path below if your project needs UConverter or URegularExpression from ICU. 91*0e209d39SAndroid Build Coastguard Worker visibility: [ 92*0e209d39SAndroid Build Coastguard Worker "//build/orchestrator/apis", 93*0e209d39SAndroid Build Coastguard Worker "//external/icu:__subpackages__", 94*0e209d39SAndroid Build Coastguard Worker "//packages/modules/RuntimeI18n:__subpackages__", 95*0e209d39SAndroid Build Coastguard Worker // The following dependencies can't use libicu instead, because it depends on UConverter 96*0e209d39SAndroid Build Coastguard Worker // or URegularExpression or statically linking libsqlite / libxml2. 97*0e209d39SAndroid Build Coastguard Worker "//external/libxml2", 98*0e209d39SAndroid Build Coastguard Worker "//external/robolectric/nativeruntime/external/sqlite/android", 99*0e209d39SAndroid Build Coastguard Worker "//external/sqlite:__subpackages__", 100*0e209d39SAndroid Build Coastguard Worker "//frameworks/av/media/libmedia", 101*0e209d39SAndroid Build Coastguard Worker "//frameworks/base/ravenwood:__subpackages__", 102*0e209d39SAndroid Build Coastguard Worker ], 103*0e209d39SAndroid Build Coastguard Worker} 104*0e209d39SAndroid Build Coastguard Worker 105*0e209d39SAndroid Build Coastguard Workercc_library_headers { 106*0e209d39SAndroid Build Coastguard Worker name: "libandroidicu_headers", 107*0e209d39SAndroid Build Coastguard Worker host_supported: true, 108*0e209d39SAndroid Build Coastguard Worker native_bridge_supported: true, 109*0e209d39SAndroid Build Coastguard Worker apex_available: [ 110*0e209d39SAndroid Build Coastguard Worker "com.android.art", 111*0e209d39SAndroid Build Coastguard Worker "com.android.art.debug", 112*0e209d39SAndroid Build Coastguard Worker "com.android.i18n", 113*0e209d39SAndroid Build Coastguard Worker ], 114*0e209d39SAndroid Build Coastguard Worker 115*0e209d39SAndroid Build Coastguard Worker // include/unicode/: Includes modified C headers from ICU4C, 116*0e209d39SAndroid Build Coastguard Worker // but excludes C++ headers. 117*0e209d39SAndroid Build Coastguard Worker // include/uconfig_local.h: local configuration specific for libandroidicu 118*0e209d39SAndroid Build Coastguard Worker export_include_dirs: ["include"], 119*0e209d39SAndroid Build Coastguard Worker target: { 120*0e209d39SAndroid Build Coastguard Worker windows: { 121*0e209d39SAndroid Build Coastguard Worker enabled: true, 122*0e209d39SAndroid Build Coastguard Worker }, 123*0e209d39SAndroid Build Coastguard Worker }, 124*0e209d39SAndroid Build Coastguard Worker} 125*0e209d39SAndroid Build Coastguard Worker 126*0e209d39SAndroid Build Coastguard Worker// TODO: http://b/120776993 Testing for libandroidicu 127