Dan Willemsen | ae0ef99 | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 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 | |
Bob Badour | 7ca20c1 | 2021-02-03 18:29:06 -0800 | [diff] [blame] | 17 | package { |
| 18 | default_applicable_licenses: ["system_logging_liblog_license"], |
| 19 | } |
| 20 | |
| 21 | // Added automatically by a large-scale-change |
| 22 | license { |
| 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 | |
Mark Salyzyn | 5f9e16a | 2016-03-01 13:45:42 -0800 | [diff] [blame] | 33 | liblog_sources = [ |
Tom Cherry | 408b144 | 2019-01-10 10:37:36 -0800 | [diff] [blame] | 34 | "log_event_list.cpp", |
| 35 | "log_event_write.cpp", |
Tom Cherry | 408b144 | 2019-01-10 10:37:36 -0800 | [diff] [blame] | 36 | "logger_name.cpp", |
| 37 | "logger_read.cpp", |
| 38 | "logger_write.cpp", |
| 39 | "logprint.cpp", |
Tom Cherry | 1a3d90c | 2020-01-27 15:45:52 -0800 | [diff] [blame] | 40 | "properties.cpp", |
Dan Willemsen | ae0ef99 | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 41 | ] |
| 42 | liblog_target_sources = [ |
Mark Salyzyn | 6280b21 | 2016-11-21 12:00:03 -0800 | [diff] [blame] | 43 | "event_tag_map.cpp", |
Dan Willemsen | ae0ef99 | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 44 | "log_time.cpp", |
Tom Cherry | 408b144 | 2019-01-10 10:37:36 -0800 | [diff] [blame] | 45 | "pmsg_reader.cpp", |
| 46 | "pmsg_writer.cpp", |
| 47 | "logd_reader.cpp", |
| 48 | "logd_writer.cpp", |
Dan Willemsen | ae0ef99 | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 49 | ] |
| 50 | |
Steven Moreland | 9b999ca | 2017-07-10 16:40:36 -0700 | [diff] [blame] | 51 | cc_library_headers { |
| 52 | name: "liblog_headers", |
| 53 | host_supported: true, |
| 54 | vendor_available: true, |
Justin Yun | 99ee810 | 2020-11-11 19:26:15 +0900 | [diff] [blame] | 55 | product_available: true, |
Yifan Hong | 2ab0b8e | 2020-01-21 18:17:19 -0800 | [diff] [blame] | 56 | ramdisk_available: true, |
Yifan Hong | 0cc91e5 | 2020-10-21 18:51:44 -0700 | [diff] [blame] | 57 | vendor_ramdisk_available: true, |
Jiyong Park | f8c5bd3 | 2018-04-27 21:48:43 +0900 | [diff] [blame] | 58 | recovery_available: true, |
Jiyong Park | 71f618c | 2020-03-07 16:36:09 +0900 | [diff] [blame] | 59 | apex_available: [ |
| 60 | "//apex_available:platform", |
| 61 | "//apex_available:anyapex", |
| 62 | ], |
Jooyung Han | 8adaf8e | 2020-04-16 18:48:33 +0900 | [diff] [blame] | 63 | min_sdk_version: "29", |
Tom Cherry | c7467b4 | 2020-09-17 14:30:25 -0700 | [diff] [blame] | 64 | sdk_version: "minimum", |
dimitry | 23b6192 | 2019-05-06 14:01:58 +0200 | [diff] [blame] | 65 | native_bridge_supported: true, |
Steven Moreland | 9b999ca | 2017-07-10 16:40:36 -0700 | [diff] [blame] | 66 | export_include_dirs: ["include"], |
Elliott Hughes | e02adef | 2019-02-13 12:42:06 -0800 | [diff] [blame] | 67 | system_shared_libs: [], |
| 68 | stl: "none", |
Steven Moreland | 9b999ca | 2017-07-10 16:40:36 -0700 | [diff] [blame] | 69 | target: { |
| 70 | windows: { |
| 71 | enabled: true, |
| 72 | }, |
| 73 | linux_bionic: { |
| 74 | enabled: true, |
| 75 | }, |
| 76 | vendor: { |
Steven Moreland | afed144 | 2018-01-05 14:42:12 -0800 | [diff] [blame] | 77 | override_export_include_dirs: ["include_vndk"], |
Steven Moreland | 9b999ca | 2017-07-10 16:40:36 -0700 | [diff] [blame] | 78 | }, |
Justin Yun | 99ee810 | 2020-11-11 19:26:15 +0900 | [diff] [blame] | 79 | product: { |
| 80 | override_export_include_dirs: ["include_vndk"], |
| 81 | }, |
Steven Moreland | 9b999ca | 2017-07-10 16:40:36 -0700 | [diff] [blame] | 82 | }, |
| 83 | } |
| 84 | |
Dan Willemsen | ae0ef99 | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 85 | // Shared and static library for host and device |
| 86 | // ======================================================== |
| 87 | cc_library { |
| 88 | name: "liblog", |
| 89 | host_supported: true, |
Yifan Hong | 2ab0b8e | 2020-01-21 18:17:19 -0800 | [diff] [blame] | 90 | ramdisk_available: true, |
Yifan Hong | 3886994 | 2020-10-23 17:42:37 -0700 | [diff] [blame] | 91 | vendor_ramdisk_available: true, |
Jiyong Park | f8c5bd3 | 2018-04-27 21:48:43 +0900 | [diff] [blame] | 92 | recovery_available: true, |
dimitry | 23b6192 | 2019-05-06 14:01:58 +0200 | [diff] [blame] | 93 | native_bridge_supported: true, |
Colin Cross | 5e22f73 | 2021-04-21 19:01:54 -0700 | [diff] [blame] | 94 | llndk: { |
| 95 | symbol_file: "liblog.map.txt", |
| 96 | override_export_include_dirs: ["include_vndk"], |
| 97 | }, |
Mark Salyzyn | 5f9e16a | 2016-03-01 13:45:42 -0800 | [diff] [blame] | 98 | srcs: liblog_sources, |
| 99 | |
Dan Willemsen | ae0ef99 | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 100 | target: { |
Dan Willemsen | ae0ef99 | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 101 | android: { |
Tom Cherry | 366cbbc | 2019-01-17 11:38:31 -0800 | [diff] [blame] | 102 | version_script: "liblog.map.txt", |
Dan Willemsen | ae0ef99 | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 103 | srcs: liblog_target_sources, |
| 104 | // AddressSanitizer runtime library depends on liblog. |
Colin Cross | 3723b33 | 2016-04-07 13:30:22 -0700 | [diff] [blame] | 105 | sanitize: { |
Evgenii Stepanov | f1c4ff5 | 2016-11-29 15:02:30 -0800 | [diff] [blame] | 106 | address: false, |
Colin Cross | 3723b33 | 2016-04-07 13:30:22 -0700 | [diff] [blame] | 107 | }, |
Dan Willemsen | ae0ef99 | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 108 | }, |
Ian Pedowitz | af4378d | 2018-01-18 16:25:24 -0800 | [diff] [blame] | 109 | android_arm: { |
| 110 | // TODO: This is to work around b/24465209. Remove after root cause is fixed |
Chih-Hung Hsieh | f55fccb | 2018-05-23 18:55:10 -0700 | [diff] [blame] | 111 | pack_relocations: false, |
Ian Pedowitz | af4378d | 2018-01-18 16:25:24 -0800 | [diff] [blame] | 112 | ldflags: ["-Wl,--hash-style=both"], |
| 113 | }, |
Dan Willemsen | ae0ef99 | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 114 | windows: { |
Dan Willemsen | fe3b143 | 2015-11-30 15:35:09 -0800 | [diff] [blame] | 115 | enabled: true, |
Dan Willemsen | ae0ef99 | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 116 | }, |
| 117 | not_windows: { |
Mark Salyzyn | 6280b21 | 2016-11-21 12:00:03 -0800 | [diff] [blame] | 118 | srcs: ["event_tag_map.cpp"], |
Dan Willemsen | ae0ef99 | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 119 | }, |
Dan Willemsen | 7b8edc6 | 2016-11-29 13:39:55 -0800 | [diff] [blame] | 120 | linux_bionic: { |
| 121 | enabled: true, |
| 122 | }, |
Dan Willemsen | ae0ef99 | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 123 | }, |
| 124 | |
Tom Cherry | ca03043 | 2019-12-20 16:06:34 -0800 | [diff] [blame] | 125 | header_libs: [ |
| 126 | "libbase_headers", |
Tom Cherry | d6b9693 | 2020-09-17 09:38:42 -0700 | [diff] [blame] | 127 | "libcutils_headers", |
Tom Cherry | ca03043 | 2019-12-20 16:06:34 -0800 | [diff] [blame] | 128 | "liblog_headers", |
| 129 | ], |
Steven Moreland | 9b999ca | 2017-07-10 16:40:36 -0700 | [diff] [blame] | 130 | export_header_lib_headers: ["liblog_headers"], |
Vijay Venkatraman | e15a3b1 | 2017-01-25 18:52:17 +0000 | [diff] [blame] | 131 | |
Tom Cherry | aadd4a7 | 2019-02-08 11:55:36 -0800 | [diff] [blame] | 132 | stubs: { |
| 133 | symbol_file: "liblog.map.txt", |
Chong Zhang | 9f77e9d | 2020-01-15 13:58:13 -0800 | [diff] [blame] | 134 | versions: ["29", "30"], |
Tom Cherry | aadd4a7 | 2019-02-08 11:55:36 -0800 | [diff] [blame] | 135 | }, |
| 136 | |
Dan Willemsen | ae0ef99 | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 137 | cflags: [ |
Tom Cherry | b78cd02 | 2019-09-30 12:58:55 -0700 | [diff] [blame] | 138 | "-Wall", |
Dan Willemsen | ae0ef99 | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 139 | "-Werror", |
Tom Cherry | b78cd02 | 2019-09-30 12:58:55 -0700 | [diff] [blame] | 140 | "-Wextra", |
Elliott Hughes | f5c76cd | 2021-03-04 16:17:53 -0800 | [diff] [blame] | 141 | "-Wexit-time-destructors", |
Dan Willemsen | ae0ef99 | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 142 | // This is what we want to do: |
| 143 | // liblog_cflags := $(shell \ |
| 144 | // sed -n \ |
| 145 | // 's/^\([0-9]*\)[ \t]*liblog[ \t].*/-DLIBLOG_LOG_TAG=\1/p' \ |
| 146 | // $(LOCAL_PATH)/event.logtags) |
| 147 | // so make sure we do not regret hard-coding it as follows: |
Mark Salyzyn | 77c24e1 | 2016-09-12 14:51:48 -0700 | [diff] [blame] | 148 | "-DLIBLOG_LOG_TAG=1006", |
Mark Salyzyn | 248bae7 | 2016-03-25 15:50:46 -0700 | [diff] [blame] | 149 | "-DSNET_EVENT_LOG_TAG=1397638484", |
Dan Willemsen | ae0ef99 | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 150 | ], |
Dan Willemsen | 5306720 | 2016-06-01 15:32:35 -0700 | [diff] [blame] | 151 | logtags: ["event.logtags"], |
Dan Willemsen | ae0ef99 | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 152 | compile_multilib: "both", |
Jeffrey Huang | 7ff1958 | 2020-02-13 12:31:07 -0800 | [diff] [blame] | 153 | apex_available: [ |
Jeffrey Huang | 7ff1958 | 2020-02-13 12:31:07 -0800 | [diff] [blame] | 154 | "//apex_available:platform", |
Jiyong Park | 0db9725 | 2020-03-09 14:35:57 +0900 | [diff] [blame] | 155 | // liblog is exceptionally available to the runtime APEX |
| 156 | // because the dynamic linker has to use it statically. |
| 157 | // See b/151051671 |
| 158 | "com.android.runtime", |
| 159 | // DO NOT add more apex names here |
Jeffrey Huang | 7ff1958 | 2020-02-13 12:31:07 -0800 | [diff] [blame] | 160 | ], |
Yi Kong | 53fcb9c | 2020-12-11 15:00:43 +0800 | [diff] [blame] | 161 | pgo: { |
| 162 | sampling: true, |
| 163 | profile_file: "logging/liblog.profdata", |
| 164 | }, |
Dan Willemsen | ae0ef99 | 2015-09-16 15:54:14 -0700 | [diff] [blame] | 165 | } |
Dan Albert | b7f77e2 | 2016-09-23 15:43:23 -0700 | [diff] [blame] | 166 | |
Dan Albert | f7060b8 | 2016-10-05 13:47:31 -0700 | [diff] [blame] | 167 | ndk_headers { |
Steven Moreland | 9b999ca | 2017-07-10 16:40:36 -0700 | [diff] [blame] | 168 | name: "liblog_ndk_headers", |
Mark Salyzyn | d5a36ed | 2016-12-21 23:15:24 +0000 | [diff] [blame] | 169 | from: "include/android", |
Dan Albert | f7060b8 | 2016-10-05 13:47:31 -0700 | [diff] [blame] | 170 | to: "android", |
Mark Salyzyn | d5a36ed | 2016-12-21 23:15:24 +0000 | [diff] [blame] | 171 | srcs: ["include/android/log.h"], |
Dan Albert | 032495f | 2016-10-20 10:18:27 -0700 | [diff] [blame] | 172 | license: "NOTICE", |
Dan Albert | f7060b8 | 2016-10-05 13:47:31 -0700 | [diff] [blame] | 173 | } |
| 174 | |
Dan Albert | b7f77e2 | 2016-09-23 15:43:23 -0700 | [diff] [blame] | 175 | ndk_library { |
Dan Willemsen | fabc406 | 2017-04-07 15:26:08 -0700 | [diff] [blame] | 176 | name: "liblog", |
Dan Albert | b7f77e2 | 2016-09-23 15:43:23 -0700 | [diff] [blame] | 177 | symbol_file: "liblog.map.txt", |
| 178 | first_version: "9", |
Dan Albert | 522e3f0 | 2017-01-05 15:55:49 -0800 | [diff] [blame] | 179 | unversioned_until: "current", |
Dan Albert | b7f77e2 | 2016-09-23 15:43:23 -0700 | [diff] [blame] | 180 | } |
Pavel Grafov | b2cb35c | 2021-04-21 18:07:01 +0100 | [diff] [blame] | 181 | |
| 182 | rust_bindgen { |
| 183 | name: "liblog_event_list_bindgen", |
| 184 | wrapper_src: "rust/liblog_wrapper.h", |
| 185 | crate_name: "log_event_list_bindgen", |
| 186 | source_stem: "bindings", |
| 187 | |
| 188 | bindgen_flags: [ |
| 189 | "--size_t-is-usize", |
| 190 | "--allowlist-function=create_android_logger", |
| 191 | "--allowlist-function=android_log_destroy", |
| 192 | "--allowlist-function=android_log_write_int32", |
| 193 | "--allowlist-function=android_log_write_string8_len", |
| 194 | "--allowlist-function=android_log_write_list", |
| 195 | "--allowlist-function=__android_log_security", |
| 196 | "--allowlist-type=log_id", |
| 197 | ], |
| 198 | } |