blob: c86d65031b92e410766d6eaaf9695930d218b4d1 [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// =========================================================================
Tej Singhd78f4da2020-01-29 15:56:52 -080020cc_defaults {
21 name: "libstatssocket_defaults",
Muhammad Qureshia3dcefc2019-12-02 20:27:46 -080022 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 Qureshi2ebc2e32020-02-11 14:12:59 -080025 "stats_socket.c",
Muhammad Qureshia3dcefc2019-12-02 20:27:46 -080026 "statsd_writer.c",
27 ],
Muhammad Qureshia3dcefc2019-12-02 20:27:46 -080028 export_include_dirs: ["include"],
Ruchir Rastogie1cff242020-02-14 12:03:35 -080029 static_libs: [
30 "libcutils", // does not expose a stable C API
Muhammad Qureshia3dcefc2019-12-02 20:27:46 -080031 ],
Tej Singhd78f4da2020-01-29 15:56:52 -080032 cflags: [
33 "-Wall",
34 "-Werror",
35 ],
36}
37
38cc_library {
39 name: "libstatssocket",
40 defaults: [
41 "libstatssocket_defaults",
42 ],
43 host_supported: true,
44 target: {
45 // On android, libstatssocket should only be linked as a shared lib
46 android: {
47 static: {
48 enabled: false,
49 },
50 },
51 host: {
52 shared: {
53 enabled: false,
54 },
55 },
56 },
Tej Singh5d8f7702020-04-06 15:01:41 -070057 stl: "libc++_static",
Ruchir Rastogi5dbcae52019-12-19 15:44:58 -080058
59 // enumerate stable entry points for APEX use
60 stubs: {
61 symbol_file: "libstatssocket.map.txt",
62 versions: [
Tej Singha8fd39d2020-01-14 13:46:27 -080063 "30",
Ruchir Rastogi5dbcae52019-12-19 15:44:58 -080064 ],
Jeffrey Huangb0a85dc2020-02-12 14:22:01 -080065 },
66 apex_available: [
Muhammad Qureshi3a40ee52020-02-18 16:52:22 -080067 "com.android.os.statsd",
68 "test_com.android.os.statsd",
Jeffrey Huangb0a85dc2020-02-12 14:22:01 -080069 ],
Muhammad Qureshia3dcefc2019-12-02 20:27:46 -080070}
Ruchir Rastogi926fa882019-12-10 18:46:23 -080071
Tej Singhd78f4da2020-01-29 15:56:52 -080072//TODO (b/149842105): Figure out if there is a better solution for this.
73cc_test_library {
74 name: "libstatssocket_private",
75 defaults: [
76 "libstatssocket_defaults",
77 ],
78 visibility: [
79 "//frameworks/base/apex/statsd/tests/libstatspull",
80 "//frameworks/base/cmds/statsd",
81 ],
82}
83
Ruchir Rastogi926fa882019-12-10 18:46:23 -080084cc_library_headers {
85 name: "libstatssocket_headers",
86 export_include_dirs: ["include"],
87 host_supported: true,
88}
Ruchir Rastogi79dd3ea2019-12-12 17:16:59 -080089
90cc_benchmark {
91 name: "libstatssocket_benchmark",
92 srcs: [
93 "benchmark/main.cpp",
94 "benchmark/stats_event_benchmark.cpp",
95 ],
96 cflags: [
97 "-Wall",
98 "-Werror",
99 ],
100 static_libs: [
Tej Singhd78f4da2020-01-29 15:56:52 -0800101 "libstatssocket_private",
Ruchir Rastogi79dd3ea2019-12-12 17:16:59 -0800102 ],
103 shared_libs: [
104 "libcutils",
Ruchir Rastogi79dd3ea2019-12-12 17:16:59 -0800105 "libgtest_prod",
106 ],
107}
Ruchir Rastogi21c1f9c2020-01-07 09:36:04 -0800108
109cc_test {
110 name: "libstatssocket_test",
111 srcs: ["tests/stats_event_test.cpp"],
112 cflags: [
113 "-Wall",
114 "-Werror",
115 ],
116 static_libs: [
117 "libgmock",
Tej Singhd78f4da2020-01-29 15:56:52 -0800118 "libstatssocket_private",
Ruchir Rastogi21c1f9c2020-01-07 09:36:04 -0800119 ],
120 shared_libs: [
121 "libcutils",
Ruchir Rastogi21c1f9c2020-01-07 09:36:04 -0800122 "libutils",
123 ],
Tej Singh0fca7362020-02-04 14:13:20 -0800124 test_suites: ["device-tests"],
Ruchir Rastogi21c1f9c2020-01-07 09:36:04 -0800125}