1// 2// Copyright (C) 2008-2014 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_applicable_licenses: ["system_logging_liblog_license"], 19} 20 21// Added automatically by a large-scale-change 22license { 23 name: "system_logging_liblog_license", 24 visibility: [":__subpackages__"], 25 license_kinds: [ 26 "SPDX-license-identifier-Apache-2.0", 27 ], 28 license_text: [ 29 "NOTICE", 30 ], 31} 32 33liblog_sources = [ 34 "log_event_list.cpp", 35 "log_event_write.cpp", 36 "logger_name.cpp", 37 "logger_read.cpp", 38 "logger_write.cpp", 39 "logprint.cpp", 40 "properties.cpp", 41] 42liblog_target_sources = [ 43 "event_tag_map.cpp", 44 "log_time.cpp", 45 "pmsg_reader.cpp", 46 "pmsg_writer.cpp", 47 "logd_reader.cpp", 48 "logd_writer.cpp", 49] 50 51cc_library_headers { 52 name: "liblog_headers", 53 host_supported: true, 54 vendor_available: true, 55 product_available: true, 56 ramdisk_available: true, 57 vendor_ramdisk_available: true, 58 recovery_available: true, 59 apex_available: [ 60 "//apex_available:platform", 61 "//apex_available:anyapex", 62 ], 63 min_sdk_version: "29", 64 sdk_version: "minimum", 65 native_bridge_supported: true, 66 export_include_dirs: ["include"], 67 system_shared_libs: [], 68 stl: "none", 69 target: { 70 windows: { 71 enabled: true, 72 }, 73 linux_bionic: { 74 enabled: true, 75 }, 76 vendor: { 77 override_export_include_dirs: ["include_vndk"], 78 }, 79 product: { 80 override_export_include_dirs: ["include_vndk"], 81 }, 82 }, 83} 84 85// Shared and static library for host and device 86// ======================================================== 87cc_defaults { 88 name: "liblog.defaults", 89 defaults: ["bug_24465209_workaround"], 90 host_supported: true, 91 ramdisk_available: true, 92 vendor_ramdisk_available: true, 93 recovery_available: true, 94 native_bridge_supported: true, 95 srcs: liblog_sources, 96 97 target: { 98 android: { 99 version_script: "liblog.map.txt", 100 srcs: liblog_target_sources, 101 // AddressSanitizer runtime library depends on liblog. 102 sanitize: { 103 address: false, 104 }, 105 }, 106 windows: { 107 enabled: true, 108 }, 109 not_windows: { 110 srcs: ["event_tag_map.cpp"], 111 }, 112 linux_bionic: { 113 enabled: true, 114 }, 115 }, 116 117 header_libs: [ 118 "libbase_headers", 119 "libcutils_headers", 120 "liblog_headers", 121 ], 122 export_header_lib_headers: ["liblog_headers"], 123 124 cflags: [ 125 "-Wall", 126 "-Werror", 127 "-Wextra", 128 "-Wexit-time-destructors", 129 // This is what we want to do: 130 // liblog_cflags := $(shell \ 131 // sed -n \ 132 // 's/^\([0-9]*\)[ \t]*liblog[ \t].*/-DLIBLOG_LOG_TAG=\1/p' \ 133 // $(LOCAL_PATH)/event.logtags) 134 // so make sure we do not regret hard-coding it as follows: 135 "-DLIBLOG_LOG_TAG=1006", 136 "-DSNET_EVENT_LOG_TAG=1397638484", 137 "-DANDROID_DEBUGGABLE=0", 138 ], 139 logtags: ["event.logtags"], 140 compile_multilib: "both", 141 afdo: true, 142 product_variables: { 143 debuggable: { 144 cflags: [ 145 "-UANDROID_DEBUGGABLE", 146 "-DANDROID_DEBUGGABLE=1", 147 ], 148 }, 149 }, 150} 151 152cc_library { 153 name: "liblog", 154 defaults: ["liblog.defaults"], 155 156 llndk: { 157 symbol_file: "liblog.map.txt", 158 override_export_include_dirs: ["include_vndk"], 159 }, 160 161 stubs: { 162 symbol_file: "liblog.map.txt", 163 versions: [ 164 "29", 165 "30", 166 ], 167 }, 168 169} 170 171// liblog_for_runtime_apex is a static liblog which is exclusively for 172// the runtime APEX. See b/151051671 173cc_library_static { 174 name: "liblog_for_runtime_apex", 175 defaults: ["liblog.defaults"], 176 apex_available: [ 177 "//apex_available:platform", 178 "com.android.runtime", 179 // DO NOT add more apex names here 180 ], 181 visibility: [ 182 "//bionic/linker", 183 "//frameworks/libs/native_bridge_support/android_api/linker", 184 "//system/apex/libs/libapexutil", 185 "//system/core/debuggerd", 186 "//system/linkerconfig", 187 ], 188} 189 190ndk_headers { 191 name: "liblog_ndk_headers", 192 from: "include/android", 193 to: "android", 194 srcs: [ 195 "include/android/log.h", 196 "include/android/log_macros.h", 197 ], 198 license: "NOTICE", 199} 200 201ndk_library { 202 name: "liblog", 203 symbol_file: "liblog.map.txt", 204 first_version: "9", 205 unversioned_until: "current", 206} 207 208rust_bindgen { 209 name: "liblog_event_list_bindgen", 210 wrapper_src: "rust/liblog_wrapper.h", 211 crate_name: "log_event_list_bindgen", 212 visibility: ["//system/logging/rust"], 213 source_stem: "bindings", 214 215 bindgen_flags: [ 216 "--allowlist-function=create_android_logger", 217 "--allowlist-function=android_log_destroy", 218 "--allowlist-function=android_log_write_int32", 219 "--allowlist-function=android_log_write_int64", 220 "--allowlist-function=android_log_write_float32", 221 "--allowlist-function=android_log_write_string8_len", 222 "--allowlist-function=android_log_write_list", 223 "--allowlist-function=android_log_write_list_begin", 224 "--allowlist-function=android_log_write_list_end", 225 "--allowlist-function=__android_log_security", 226 "--allowlist-type=log_id", 227 ], 228 vendor_available: true, 229 product_available: true, 230} 231 232rust_test { 233 name: "liblog_event_list_bindgen_test", 234 srcs: [":liblog_event_list_bindgen"], 235 crate_name: "log_event_list_bindgen_test", 236 test_suites: ["general-tests"], 237 auto_gen_config: true, 238 clippy_lints: "none", 239 lints: "none", 240} 241