• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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    host_supported: true,
90    ramdisk_available: true,
91    vendor_ramdisk_available: true,
92    recovery_available: true,
93    native_bridge_supported: true,
94    srcs: liblog_sources,
95
96    target: {
97        android: {
98            version_script: "liblog.map.txt",
99            srcs: liblog_target_sources,
100            // AddressSanitizer runtime library depends on liblog.
101            sanitize: {
102                address: false,
103            },
104        },
105        android_arm: {
106            // TODO: This is to work around b/24465209. Remove after root cause is fixed
107            pack_relocations: false,
108            ldflags: ["-Wl,--hash-style=both"],
109        },
110        windows: {
111            enabled: true,
112        },
113        not_windows: {
114            srcs: ["event_tag_map.cpp"],
115        },
116        linux_bionic: {
117            enabled: true,
118        },
119    },
120
121    header_libs: [
122        "libbase_headers",
123        "libcutils_headers",
124        "liblog_headers",
125    ],
126    export_header_lib_headers: ["liblog_headers"],
127
128    cflags: [
129        "-Wall",
130        "-Werror",
131        "-Wextra",
132        "-Wexit-time-destructors",
133        // This is what we want to do:
134        //  liblog_cflags := $(shell \
135        //   sed -n \
136        //       's/^\([0-9]*\)[ \t]*liblog[ \t].*/-DLIBLOG_LOG_TAG=\1/p' \
137        //       $(LOCAL_PATH)/event.logtags)
138        // so make sure we do not regret hard-coding it as follows:
139        "-DLIBLOG_LOG_TAG=1006",
140        "-DSNET_EVENT_LOG_TAG=1397638484",
141        "-DANDROID_DEBUGGABLE=0",
142    ],
143    logtags: ["event.logtags"],
144    compile_multilib: "both",
145    afdo: true,
146    product_variables: {
147        debuggable: {
148            cflags: [
149                "-UANDROID_DEBUGGABLE",
150                "-DANDROID_DEBUGGABLE=1",
151            ],
152        },
153    },
154}
155
156cc_library {
157    name: "liblog",
158    defaults: ["liblog.defaults"],
159
160    llndk: {
161        symbol_file: "liblog.map.txt",
162        override_export_include_dirs: ["include_vndk"],
163    },
164
165    stubs: {
166        symbol_file: "liblog.map.txt",
167        versions: [
168            "29",
169            "30",
170        ],
171    },
172
173}
174
175// liblog_for_runtime_apex is a static liblog which is exclusively for
176// the runtime APEX. See b/151051671
177cc_library_static {
178    name: "liblog_for_runtime_apex",
179    defaults: ["liblog.defaults"],
180    apex_available: [
181        "//apex_available:platform",
182        "com.android.runtime",
183        // DO NOT add more apex names here
184    ],
185    visibility: [
186        "//bionic/linker",
187        "//frameworks/libs/native_bridge_support/linker",
188        "//system/apex/libs/libapexutil",
189        "//system/core/debuggerd",
190        "//system/linkerconfig",
191    ],
192}
193
194ndk_headers {
195    name: "liblog_ndk_headers",
196    from: "include/android",
197    to: "android",
198    srcs: ["include/android/log.h"],
199    license: "NOTICE",
200}
201
202ndk_library {
203    name: "liblog",
204    symbol_file: "liblog.map.txt",
205    first_version: "9",
206    unversioned_until: "current",
207    export_header_libs: [
208        "liblog_ndk_headers",
209    ],
210}
211
212rust_bindgen {
213    name: "liblog_event_list_bindgen",
214    wrapper_src: "rust/liblog_wrapper.h",
215    crate_name: "log_event_list_bindgen",
216    visibility: ["//system/logging/rust"],
217    source_stem: "bindings",
218
219    bindgen_flags: [
220        "--size_t-is-usize",
221        "--allowlist-function=create_android_logger",
222        "--allowlist-function=android_log_destroy",
223        "--allowlist-function=android_log_write_int32",
224        "--allowlist-function=android_log_write_string8_len",
225        "--allowlist-function=android_log_write_list",
226        "--allowlist-function=__android_log_security",
227        "--allowlist-type=log_id",
228    ],
229}
230
231rust_test {
232    name: "liblog_event_list_bindgen_test",
233    srcs: [":liblog_event_list_bindgen"],
234    crate_name: "log_event_list_bindgen_test",
235    test_suites: ["general-tests"],
236    auto_gen_config: true,
237    clippy_lints: "none",
238    lints: "none",
239}
240