blob: e4d8a5897bb4a07f124fbd00c99f75b08c2dabcd [file] [log] [blame]
Dan Willemsenae0ef992015-09-16 15:54:14 -07001//
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 Badour7ca20c12021-02-03 18:29:06 -080017package {
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
Mark Salyzyn5f9e16a2016-03-01 13:45:42 -080033liblog_sources = [
Tom Cherry408b1442019-01-10 10:37:36 -080034 "log_event_list.cpp",
35 "log_event_write.cpp",
Tom Cherry408b1442019-01-10 10:37:36 -080036 "logger_name.cpp",
37 "logger_read.cpp",
38 "logger_write.cpp",
39 "logprint.cpp",
Tom Cherry1a3d90c2020-01-27 15:45:52 -080040 "properties.cpp",
Dan Willemsenae0ef992015-09-16 15:54:14 -070041]
42liblog_target_sources = [
Mark Salyzyn6280b212016-11-21 12:00:03 -080043 "event_tag_map.cpp",
Dan Willemsenae0ef992015-09-16 15:54:14 -070044 "log_time.cpp",
Tom Cherry408b1442019-01-10 10:37:36 -080045 "pmsg_reader.cpp",
46 "pmsg_writer.cpp",
47 "logd_reader.cpp",
48 "logd_writer.cpp",
Dan Willemsenae0ef992015-09-16 15:54:14 -070049]
50
Steven Moreland9b999ca2017-07-10 16:40:36 -070051cc_library_headers {
52 name: "liblog_headers",
53 host_supported: true,
54 vendor_available: true,
Justin Yun99ee8102020-11-11 19:26:15 +090055 product_available: true,
Yifan Hong2ab0b8e2020-01-21 18:17:19 -080056 ramdisk_available: true,
Yifan Hong0cc91e52020-10-21 18:51:44 -070057 vendor_ramdisk_available: true,
Jiyong Parkf8c5bd32018-04-27 21:48:43 +090058 recovery_available: true,
Jiyong Park71f618c2020-03-07 16:36:09 +090059 apex_available: [
60 "//apex_available:platform",
61 "//apex_available:anyapex",
62 ],
Jooyung Han8adaf8e2020-04-16 18:48:33 +090063 min_sdk_version: "29",
Tom Cherryc7467b42020-09-17 14:30:25 -070064 sdk_version: "minimum",
dimitry23b61922019-05-06 14:01:58 +020065 native_bridge_supported: true,
Steven Moreland9b999ca2017-07-10 16:40:36 -070066 export_include_dirs: ["include"],
Elliott Hughese02adef2019-02-13 12:42:06 -080067 system_shared_libs: [],
68 stl: "none",
Steven Moreland9b999ca2017-07-10 16:40:36 -070069 target: {
70 windows: {
71 enabled: true,
72 },
73 linux_bionic: {
74 enabled: true,
75 },
76 vendor: {
Steven Morelandafed1442018-01-05 14:42:12 -080077 override_export_include_dirs: ["include_vndk"],
Steven Moreland9b999ca2017-07-10 16:40:36 -070078 },
Justin Yun99ee8102020-11-11 19:26:15 +090079 product: {
80 override_export_include_dirs: ["include_vndk"],
81 },
Steven Moreland9b999ca2017-07-10 16:40:36 -070082 },
83}
84
Dan Willemsenae0ef992015-09-16 15:54:14 -070085// Shared and static library for host and device
86// ========================================================
87cc_library {
88 name: "liblog",
89 host_supported: true,
Yifan Hong2ab0b8e2020-01-21 18:17:19 -080090 ramdisk_available: true,
Yifan Hong38869942020-10-23 17:42:37 -070091 vendor_ramdisk_available: true,
Jiyong Parkf8c5bd32018-04-27 21:48:43 +090092 recovery_available: true,
dimitry23b61922019-05-06 14:01:58 +020093 native_bridge_supported: true,
Colin Cross5e22f732021-04-21 19:01:54 -070094 llndk: {
95 symbol_file: "liblog.map.txt",
96 override_export_include_dirs: ["include_vndk"],
97 },
Mark Salyzyn5f9e16a2016-03-01 13:45:42 -080098 srcs: liblog_sources,
99
Dan Willemsenae0ef992015-09-16 15:54:14 -0700100 target: {
Dan Willemsenae0ef992015-09-16 15:54:14 -0700101 android: {
Tom Cherry366cbbc2019-01-17 11:38:31 -0800102 version_script: "liblog.map.txt",
Dan Willemsenae0ef992015-09-16 15:54:14 -0700103 srcs: liblog_target_sources,
104 // AddressSanitizer runtime library depends on liblog.
Colin Cross3723b332016-04-07 13:30:22 -0700105 sanitize: {
Evgenii Stepanovf1c4ff52016-11-29 15:02:30 -0800106 address: false,
Colin Cross3723b332016-04-07 13:30:22 -0700107 },
Dan Willemsenae0ef992015-09-16 15:54:14 -0700108 },
Ian Pedowitzaf4378d2018-01-18 16:25:24 -0800109 android_arm: {
110 // TODO: This is to work around b/24465209. Remove after root cause is fixed
Chih-Hung Hsiehf55fccb2018-05-23 18:55:10 -0700111 pack_relocations: false,
Ian Pedowitzaf4378d2018-01-18 16:25:24 -0800112 ldflags: ["-Wl,--hash-style=both"],
113 },
Dan Willemsenae0ef992015-09-16 15:54:14 -0700114 windows: {
Dan Willemsenfe3b1432015-11-30 15:35:09 -0800115 enabled: true,
Dan Willemsenae0ef992015-09-16 15:54:14 -0700116 },
117 not_windows: {
Mark Salyzyn6280b212016-11-21 12:00:03 -0800118 srcs: ["event_tag_map.cpp"],
Dan Willemsenae0ef992015-09-16 15:54:14 -0700119 },
Dan Willemsen7b8edc62016-11-29 13:39:55 -0800120 linux_bionic: {
121 enabled: true,
122 },
Dan Willemsenae0ef992015-09-16 15:54:14 -0700123 },
124
Tom Cherryca030432019-12-20 16:06:34 -0800125 header_libs: [
126 "libbase_headers",
Tom Cherryd6b96932020-09-17 09:38:42 -0700127 "libcutils_headers",
Tom Cherryca030432019-12-20 16:06:34 -0800128 "liblog_headers",
129 ],
Steven Moreland9b999ca2017-07-10 16:40:36 -0700130 export_header_lib_headers: ["liblog_headers"],
Vijay Venkatramane15a3b12017-01-25 18:52:17 +0000131
Tom Cherryaadd4a72019-02-08 11:55:36 -0800132 stubs: {
133 symbol_file: "liblog.map.txt",
Chong Zhang9f77e9d2020-01-15 13:58:13 -0800134 versions: ["29", "30"],
Tom Cherryaadd4a72019-02-08 11:55:36 -0800135 },
136
Dan Willemsenae0ef992015-09-16 15:54:14 -0700137 cflags: [
Tom Cherryb78cd022019-09-30 12:58:55 -0700138 "-Wall",
Dan Willemsenae0ef992015-09-16 15:54:14 -0700139 "-Werror",
Tom Cherryb78cd022019-09-30 12:58:55 -0700140 "-Wextra",
Elliott Hughesf5c76cd2021-03-04 16:17:53 -0800141 "-Wexit-time-destructors",
Dan Willemsenae0ef992015-09-16 15:54:14 -0700142 // 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 Salyzyn77c24e12016-09-12 14:51:48 -0700148 "-DLIBLOG_LOG_TAG=1006",
Mark Salyzyn248bae72016-03-25 15:50:46 -0700149 "-DSNET_EVENT_LOG_TAG=1397638484",
Dan Willemsenae0ef992015-09-16 15:54:14 -0700150 ],
Dan Willemsen53067202016-06-01 15:32:35 -0700151 logtags: ["event.logtags"],
Dan Willemsenae0ef992015-09-16 15:54:14 -0700152 compile_multilib: "both",
Jeffrey Huang7ff19582020-02-13 12:31:07 -0800153 apex_available: [
Jeffrey Huang7ff19582020-02-13 12:31:07 -0800154 "//apex_available:platform",
Jiyong Park0db97252020-03-09 14:35:57 +0900155 // 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 Huang7ff19582020-02-13 12:31:07 -0800160 ],
Yi Kong53fcb9c2020-12-11 15:00:43 +0800161 pgo: {
162 sampling: true,
163 profile_file: "logging/liblog.profdata",
164 },
Dan Willemsenae0ef992015-09-16 15:54:14 -0700165}
Dan Albertb7f77e22016-09-23 15:43:23 -0700166
Dan Albertf7060b82016-10-05 13:47:31 -0700167ndk_headers {
Steven Moreland9b999ca2017-07-10 16:40:36 -0700168 name: "liblog_ndk_headers",
Mark Salyzynd5a36ed2016-12-21 23:15:24 +0000169 from: "include/android",
Dan Albertf7060b82016-10-05 13:47:31 -0700170 to: "android",
Mark Salyzynd5a36ed2016-12-21 23:15:24 +0000171 srcs: ["include/android/log.h"],
Dan Albert032495f2016-10-20 10:18:27 -0700172 license: "NOTICE",
Dan Albertf7060b82016-10-05 13:47:31 -0700173}
174
Dan Albertb7f77e22016-09-23 15:43:23 -0700175ndk_library {
Dan Willemsenfabc4062017-04-07 15:26:08 -0700176 name: "liblog",
Dan Albertb7f77e22016-09-23 15:43:23 -0700177 symbol_file: "liblog.map.txt",
178 first_version: "9",
Dan Albert522e3f02017-01-05 15:55:49 -0800179 unversioned_until: "current",
Dan Albertb7f77e22016-09-23 15:43:23 -0700180}
Pavel Grafovb2cb35c2021-04-21 18:07:01 +0100181
182rust_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}