platform_system_core/logd/Android.bp
Tom Cherry 3d8b739f94 Remove include/private/android_logger.h
Users should depend on liblog or liblog_headers for this include.

Test: treehugger
Change-Id: I10dca8638082b2231e2c0713644f103c4c7e9b3f
2020-09-16 11:32:47 -07:00

205 lines
4.3 KiB
Text

// Copyright (C) 2017 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// This is what we want to do:
// event_logtags = $(shell
// sed -n
// "s/^\([0-9]*\)[ \t]*$1[ \t].*/-D`echo $1 | tr a-z A-Z`_LOG_TAG=\1/p"
// $(LOCAL_PATH)/$2/event.logtags)
// event_flag := $(call event_logtags,auditd)
// event_flag += $(call event_logtags,logd)
// event_flag += $(call event_logtags,tag_def)
// so make sure we do not regret hard-coding it as follows:
event_flag = [
"-DAUDITD_LOG_TAG=1003",
"-DCHATTY_LOG_TAG=1004",
"-DTAG_DEF_LOG_TAG=1005",
"-DLIBLOG_LOG_TAG=1006",
]
cc_defaults {
name: "logd_defaults",
shared_libs: [
"libbase",
"libz",
],
static_libs: ["libzstd"],
cflags: [
"-Wextra",
"-Wthread-safety",
] + event_flag,
lto: {
thin: true,
},
cpp_std: "experimental",
}
cc_library_static {
name: "liblogd",
defaults: ["logd_defaults"],
host_supported: true,
srcs: [
"ChattyLogBuffer.cpp",
"CompressionEngine.cpp",
"LogReaderList.cpp",
"LogReaderThread.cpp",
"LogBufferElement.cpp",
"LogSize.cpp",
"LogStatistics.cpp",
"LogTags.cpp",
"PruneList.cpp",
"SerializedFlushToState.cpp",
"SerializedLogBuffer.cpp",
"SerializedLogChunk.cpp",
"SimpleLogBuffer.cpp",
],
static_libs: ["liblog"],
logtags: ["event.logtags"],
export_include_dirs: ["."],
}
cc_binary {
name: "logd",
defaults: ["logd_defaults"],
init_rc: ["logd.rc"],
srcs: [
"main.cpp",
"LogPermissions.cpp",
"CommandListener.cpp",
"LogListener.cpp",
"LogReader.cpp",
"LogAudit.cpp",
"LogKlog.cpp",
"libaudit.cpp",
],
static_libs: [
"liblog",
"liblogd",
],
shared_libs: [
"libsysutils",
"libcutils",
"libpackagelistparser",
"libprocessgroup",
"libcap",
],
}
cc_binary {
name: "auditctl",
srcs: [
"auditctl.cpp",
"libaudit.cpp",
],
shared_libs: ["libbase"],
cflags: [
"-Wextra",
],
}
prebuilt_etc {
name: "logtagd.rc",
src: "logtagd.rc",
sub_dir: "init",
}
// -----------------------------------------------------------------------------
// Unit tests.
// -----------------------------------------------------------------------------
cc_defaults {
name: "logd-unit-test-defaults",
cflags: [
"-fstack-protector-all",
"-g",
"-Wall",
"-Wextra",
"-Werror",
"-fno-builtin",
] + event_flag,
srcs: [
"ChattyLogBufferTest.cpp",
"logd_test.cpp",
"LogBufferTest.cpp",
"SerializedLogChunkTest.cpp",
"SerializedFlushToStateTest.cpp",
],
static_libs: [
"libbase",
"libcutils",
"liblog",
"liblogd",
"libselinux",
"libz",
"libzstd",
],
}
// Build tests for the logger. Run with:
// adb shell /data/nativetest/logd-unit-tests/logd-unit-tests
cc_test {
name: "logd-unit-tests",
host_supported: true,
defaults: ["logd-unit-test-defaults"],
}
cc_test {
name: "CtsLogdTestCases",
defaults: ["logd-unit-test-defaults"],
multilib: {
lib32: {
suffix: "32",
},
lib64: {
suffix: "64",
},
},
test_suites: [
"cts",
"device-tests",
"vts10",
],
}
cc_binary {
name: "replay_messages",
defaults: ["logd_defaults"],
host_supported: true,
srcs: [
"ReplayMessages.cpp",
],
static_libs: [
"libbase",
"libcutils",
"liblog",
"liblogd",
"libselinux",
"libz",
"libzstd",
],
}