blob: 893ef2878aedb813392c93c3c8c8461c207f278c [file] [log] [blame]
Muhammad Qureshia3dcefc2019-12-02 20:27:46 -08001//
2// Copyright (C) 2018 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
17// =========================================================================
18// Native library to write stats log to statsd socket on Android R and later
19// =========================================================================
20cc_library {
21 name: "libstatssocket",
22 srcs: [
Muhammad Qureshi962cc232019-11-06 15:15:23 -080023 "stats_buffer_writer.c",
Muhammad Qureshia3dcefc2019-12-02 20:27:46 -080024 "stats_event.c",
Muhammad Qureshi962cc232019-11-06 15:15:23 -080025 // TODO(b/145573568): Remove stats_event_list once stats_event
26 // migration is complete.
Muhammad Qureshia3dcefc2019-12-02 20:27:46 -080027 "stats_event_list.c",
Muhammad Qureshi2ebc2e32020-02-11 14:12:59 -080028 "stats_socket.c",
Muhammad Qureshia3dcefc2019-12-02 20:27:46 -080029 "statsd_writer.c",
30 ],
31 host_supported: true,
32 cflags: [
33 "-Wall",
34 "-Werror",
35 "-DLIBLOG_LOG_TAG=1006",
36 "-DWRITE_TO_STATSD=1",
37 "-DWRITE_TO_LOGD=0",
38 ],
39 export_include_dirs: ["include"],
40 shared_libs: [
41 "libcutils",
42 "liblog",
43 ],
Ruchir Rastogi5dbcae52019-12-19 15:44:58 -080044
45 // enumerate stable entry points for APEX use
46 stubs: {
47 symbol_file: "libstatssocket.map.txt",
48 versions: [
Tej Singha8fd39d2020-01-14 13:46:27 -080049 "30",
Ruchir Rastogi5dbcae52019-12-19 15:44:58 -080050 ],
Jeffrey Huangb0a85dc2020-02-12 14:22:01 -080051 },
52 apex_available: [
53 "com.android.os.statsd",
54 "test_com.android.os.statsd",
55 //TODO(b/149340100): Remove this once libstatssocket is only linked as shared.
56 "//apex_available:platform",
57 ],
Muhammad Qureshia3dcefc2019-12-02 20:27:46 -080058}
Ruchir Rastogi926fa882019-12-10 18:46:23 -080059
60cc_library_headers {
61 name: "libstatssocket_headers",
62 export_include_dirs: ["include"],
63 host_supported: true,
64}
Ruchir Rastogi79dd3ea2019-12-12 17:16:59 -080065
66cc_benchmark {
67 name: "libstatssocket_benchmark",
68 srcs: [
69 "benchmark/main.cpp",
70 "benchmark/stats_event_benchmark.cpp",
71 ],
72 cflags: [
73 "-Wall",
74 "-Werror",
75 ],
76 static_libs: [
77 "libstatssocket",
78 ],
79 shared_libs: [
80 "libcutils",
81 "liblog",
82 "libgtest_prod",
83 ],
84}
Ruchir Rastogi21c1f9c2020-01-07 09:36:04 -080085
86cc_test {
87 name: "libstatssocket_test",
88 srcs: ["tests/stats_event_test.cpp"],
89 cflags: [
90 "-Wall",
91 "-Werror",
92 ],
93 static_libs: [
94 "libgmock",
95 "libstatssocket",
96 ],
97 shared_libs: [
98 "libcutils",
99 "liblog",
100 "libutils",
101 ],
Tej Singh0fca7362020-02-04 14:13:20 -0800102 test_suites: ["device-tests"],
Ruchir Rastogi21c1f9c2020-01-07 09:36:04 -0800103}