blob: 49a26f8c32c9de59bf964baa632d159647095ebb [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// ========================================================
Jiyong Parkdcfb40b2022-08-19 13:07:25 +090087cc_defaults {
88 name: "liblog.defaults",
Elliott Hughese3beec12024-06-18 18:20:14 +000089 defaults: ["bug_24465209_workaround"],
Dan Willemsenae0ef992015-09-16 15:54:14 -070090 host_supported: true,
Yifan Hong2ab0b8e2020-01-21 18:17:19 -080091 ramdisk_available: true,
Yifan Hong38869942020-10-23 17:42:37 -070092 vendor_ramdisk_available: true,
Jiyong Parkf8c5bd32018-04-27 21:48:43 +090093 recovery_available: true,
dimitry23b61922019-05-06 14:01:58 +020094 native_bridge_supported: true,
Mark Salyzyn5f9e16a2016-03-01 13:45:42 -080095 srcs: liblog_sources,
96
Dan Willemsenae0ef992015-09-16 15:54:14 -070097 target: {
Dan Willemsenae0ef992015-09-16 15:54:14 -070098 android: {
Tom Cherry366cbbc2019-01-17 11:38:31 -080099 version_script: "liblog.map.txt",
Dan Willemsenae0ef992015-09-16 15:54:14 -0700100 srcs: liblog_target_sources,
101 // AddressSanitizer runtime library depends on liblog.
Colin Cross3723b332016-04-07 13:30:22 -0700102 sanitize: {
Evgenii Stepanovf1c4ff52016-11-29 15:02:30 -0800103 address: false,
Colin Cross3723b332016-04-07 13:30:22 -0700104 },
Dan Willemsenae0ef992015-09-16 15:54:14 -0700105 },
Dan Willemsenae0ef992015-09-16 15:54:14 -0700106 windows: {
Dan Willemsenfe3b1432015-11-30 15:35:09 -0800107 enabled: true,
Dan Willemsenae0ef992015-09-16 15:54:14 -0700108 },
109 not_windows: {
Mark Salyzyn6280b212016-11-21 12:00:03 -0800110 srcs: ["event_tag_map.cpp"],
Dan Willemsenae0ef992015-09-16 15:54:14 -0700111 },
Dan Willemsen7b8edc62016-11-29 13:39:55 -0800112 linux_bionic: {
113 enabled: true,
114 },
Dan Willemsenae0ef992015-09-16 15:54:14 -0700115 },
116
Tom Cherryca030432019-12-20 16:06:34 -0800117 header_libs: [
118 "libbase_headers",
Tom Cherryd6b96932020-09-17 09:38:42 -0700119 "libcutils_headers",
Tom Cherryca030432019-12-20 16:06:34 -0800120 "liblog_headers",
121 ],
Steven Moreland9b999ca2017-07-10 16:40:36 -0700122 export_header_lib_headers: ["liblog_headers"],
Vijay Venkatramane15a3b12017-01-25 18:52:17 +0000123
Dan Willemsenae0ef992015-09-16 15:54:14 -0700124 cflags: [
Tom Cherryb78cd022019-09-30 12:58:55 -0700125 "-Wall",
Dan Willemsenae0ef992015-09-16 15:54:14 -0700126 "-Werror",
Tom Cherryb78cd022019-09-30 12:58:55 -0700127 "-Wextra",
Elliott Hughesf5c76cd2021-03-04 16:17:53 -0800128 "-Wexit-time-destructors",
Dan Willemsenae0ef992015-09-16 15:54:14 -0700129 // 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:
Mark Salyzyn77c24e12016-09-12 14:51:48 -0700135 "-DLIBLOG_LOG_TAG=1006",
Mark Salyzyn248bae72016-03-25 15:50:46 -0700136 "-DSNET_EVENT_LOG_TAG=1397638484",
Spandan Dasb6ea9fe2022-09-08 20:00:25 +0000137 "-DANDROID_DEBUGGABLE=0",
Dan Willemsenae0ef992015-09-16 15:54:14 -0700138 ],
Dan Willemsen53067202016-06-01 15:32:35 -0700139 logtags: ["event.logtags"],
Dan Willemsenae0ef992015-09-16 15:54:14 -0700140 compile_multilib: "both",
Jiyong Parkdcfb40b2022-08-19 13:07:25 +0900141 afdo: true,
Alessandra Lorof2e9cce2022-09-02 15:40:36 +0000142 product_variables: {
143 debuggable: {
Spandan Dasb6ea9fe2022-09-08 20:00:25 +0000144 cflags: [
145 "-UANDROID_DEBUGGABLE",
146 "-DANDROID_DEBUGGABLE=1",
147 ],
148 },
149 },
Jiyong Parkdcfb40b2022-08-19 13:07:25 +0900150}
151
152cc_library {
153 name: "liblog",
154 defaults: ["liblog.defaults"],
Liz Kammerb44816a2022-08-19 15:52:47 -0400155
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",
Spandan Dasb6ea9fe2022-09-08 20:00:25 +0000163 versions: [
164 "29",
165 "30",
166 ],
Liz Kammerb44816a2022-08-19 15:52:47 -0400167 },
168
Jiyong Parkdcfb40b2022-08-19 13:07:25 +0900169}
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"],
Jeffrey Huang7ff19582020-02-13 12:31:07 -0800176 apex_available: [
Jeffrey Huang7ff19582020-02-13 12:31:07 -0800177 "//apex_available:platform",
Jiyong Park0db97252020-03-09 14:35:57 +0900178 "com.android.runtime",
179 // DO NOT add more apex names here
Jeffrey Huang7ff19582020-02-13 12:31:07 -0800180 ],
Jiyong Parkdcfb40b2022-08-19 13:07:25 +0900181 visibility: [
182 "//bionic/linker",
dimitry1dc029d2024-02-07 16:56:50 +0100183 "//frameworks/libs/native_bridge_support/android_api/linker",
Jiyong Parkdcfb40b2022-08-19 13:07:25 +0900184 "//system/apex/libs/libapexutil",
185 "//system/core/debuggerd",
186 "//system/linkerconfig",
187 ],
Dan Willemsenae0ef992015-09-16 15:54:14 -0700188}
Dan Albertb7f77e22016-09-23 15:43:23 -0700189
Dan Albertf7060b82016-10-05 13:47:31 -0700190ndk_headers {
Steven Moreland9b999ca2017-07-10 16:40:36 -0700191 name: "liblog_ndk_headers",
Mark Salyzynd5a36ed2016-12-21 23:15:24 +0000192 from: "include/android",
Dan Albertf7060b82016-10-05 13:47:31 -0700193 to: "android",
Dan Albert96815e72024-04-25 20:45:03 +0000194 srcs: [
195 "include/android/log.h",
196 "include/android/log_macros.h",
197 ],
Dan Albert032495f2016-10-20 10:18:27 -0700198 license: "NOTICE",
Dan Albertf7060b82016-10-05 13:47:31 -0700199}
200
Dan Albertb7f77e22016-09-23 15:43:23 -0700201ndk_library {
Dan Willemsenfabc4062017-04-07 15:26:08 -0700202 name: "liblog",
Dan Albertb7f77e22016-09-23 15:43:23 -0700203 symbol_file: "liblog.map.txt",
204 first_version: "9",
Dan Albert522e3f02017-01-05 15:55:49 -0800205 unversioned_until: "current",
Dan Albertb7f77e22016-09-23 15:43:23 -0700206}
Pavel Grafovb2cb35c2021-04-21 18:07:01 +0100207
208rust_bindgen {
209 name: "liblog_event_list_bindgen",
210 wrapper_src: "rust/liblog_wrapper.h",
211 crate_name: "log_event_list_bindgen",
Matthew Maurer8e06e632022-07-29 09:08:26 -0700212 visibility: ["//system/logging/rust"],
Pavel Grafovb2cb35c2021-04-21 18:07:01 +0100213 source_stem: "bindings",
214
215 bindgen_flags: [
Pavel Grafovb2cb35c2021-04-21 18:07:01 +0100216 "--allowlist-function=create_android_logger",
217 "--allowlist-function=android_log_destroy",
218 "--allowlist-function=android_log_write_int32",
Marcin Radomskid8f62dc2023-06-07 13:58:02 +0000219 "--allowlist-function=android_log_write_int64",
220 "--allowlist-function=android_log_write_float32",
Pavel Grafovb2cb35c2021-04-21 18:07:01 +0100221 "--allowlist-function=android_log_write_string8_len",
222 "--allowlist-function=android_log_write_list",
Marcin Radomskid8f62dc2023-06-07 13:58:02 +0000223 "--allowlist-function=android_log_write_list_begin",
224 "--allowlist-function=android_log_write_list_end",
Pavel Grafovb2cb35c2021-04-21 18:07:01 +0100225 "--allowlist-function=__android_log_security",
226 "--allowlist-type=log_id",
227 ],
Markus Vill9b308492023-11-23 13:25:57 +0100228 vendor_available: true,
229 product_available: true,
Pavel Grafovb2cb35c2021-04-21 18:07:01 +0100230}
Joel Galenson7c2d7bd2021-08-23 13:47:04 -0700231
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}