blob: ef631611647baed2d5de3ff969d7f2973718f716 [file] [log] [blame]
Yao Chend54f9dd2017-10-17 17:37:48 +00001//
Colin Cross05c9e5c2018-10-26 22:34:06 -07002// Copyright (C) 2017 The Android Open Source Project
Yao Chend54f9dd2017-10-17 17:37:48 +00003//
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// Build the library for use on the host
19// ==========================================================
20cc_library_host_shared {
21 name: "libstats_proto_host",
22 srcs: [
Stefan Lafonae2df012017-11-14 09:17:21 -080023 "src/atoms.proto",
Yao Chen9c1debe2018-02-19 14:39:19 -080024 "src/atom_field_options.proto",
Yao Chend54f9dd2017-10-17 17:37:48 +000025 ],
26
27 shared_libs: [
28 "libplatformprotos",
29 ],
30
31 proto: {
32 type: "full",
33 export_proto_headers: true,
Yao Chen9c1debe2018-02-19 14:39:19 -080034 include_dirs: [
35 "external/protobuf/src",
36 ],
Yao Chend54f9dd2017-10-17 17:37:48 +000037 },
Joe Onorato62c220b2017-11-18 20:32:56 -080038
39 export_shared_lib_headers: [
40 "libplatformprotos",
41 ]
42
Yao Chend54f9dd2017-10-17 17:37:48 +000043}
44
Colin Cross05c9e5c2018-10-26 22:34:06 -070045cc_defaults {
46 name: "statsd_defaults",
47 aidl: {
48 include_dirs: ["frameworks/base/core/java"],
49 },
50
51 srcs: [
52 ":statsd_aidl",
53 "src/statsd_config.proto",
54 "src/FieldValue.cpp",
55 "src/hash.cpp",
56 "src/stats_log_util.cpp",
57 "src/anomaly/AlarmMonitor.cpp",
58 "src/anomaly/AlarmTracker.cpp",
59 "src/anomaly/AnomalyTracker.cpp",
60 "src/anomaly/DurationAnomalyTracker.cpp",
61 "src/anomaly/subscriber_util.cpp",
62 "src/condition/CombinationConditionTracker.cpp",
63 "src/condition/condition_util.cpp",
64 "src/condition/SimpleConditionTracker.cpp",
65 "src/condition/ConditionWizard.cpp",
66 "src/condition/StateTracker.cpp",
67 "src/config/ConfigKey.cpp",
68 "src/config/ConfigListener.cpp",
69 "src/config/ConfigManager.cpp",
70 "src/external/Perfetto.cpp",
71 "src/external/StatsPuller.cpp",
72 "src/external/StatsCompanionServicePuller.cpp",
73 "src/external/SubsystemSleepStatePuller.cpp",
74 "src/external/ResourceHealthManagerPuller.cpp",
75 "src/external/ResourceThermalManagerPuller.cpp",
76 "src/external/StatsPullerManagerImpl.cpp",
77 "src/external/puller_util.cpp",
78 "src/logd/LogEvent.cpp",
79 "src/logd/LogListener.cpp",
80 "src/logd/LogReader.cpp",
81 "src/matchers/CombinationLogMatchingTracker.cpp",
82 "src/matchers/matcher_util.cpp",
83 "src/matchers/SimpleLogMatchingTracker.cpp",
84 "src/metrics/MetricProducer.cpp",
85 "src/metrics/EventMetricProducer.cpp",
86 "src/metrics/CountMetricProducer.cpp",
87 "src/metrics/DurationMetricProducer.cpp",
88 "src/metrics/duration_helper/OringDurationTracker.cpp",
89 "src/metrics/duration_helper/MaxDurationTracker.cpp",
90 "src/metrics/ValueMetricProducer.cpp",
91 "src/metrics/GaugeMetricProducer.cpp",
92 "src/metrics/MetricsManager.cpp",
93 "src/metrics/metrics_manager_util.cpp",
94 "src/packages/UidMap.cpp",
95 "src/perfetto/perfetto_config.proto",
96 "src/storage/StorageManager.cpp",
97 "src/StatsLogProcessor.cpp",
98 "src/StatsService.cpp",
99 "src/statscompanion_util.cpp",
100 "src/subscriber/IncidentdReporter.cpp",
101 "src/subscriber/SubscriberReporter.cpp",
102 "src/HashableDimensionKey.cpp",
103 "src/guardrail/StatsdStats.cpp",
104 "src/socket/StatsSocketListener.cpp",
105 ],
106
107 local_include_dirs: [
108 "src",
109 ],
110
111 static_libs: [
112 "libhealthhalutils",
113 "libplatformprotos",
114 ],
115
116 shared_libs: [
117 "libbase",
118 "libbinder",
119 "libincident",
120 "liblog",
121 "libutils",
122 "libservices",
123 "libprotoutil",
124 "libstatslog",
125 "libhardware",
126 "libhardware_legacy",
127 "libhidlbase",
128 "libhidltransport",
129 "libhwbinder",
130 "android.hardware.health@2.0",
131 "android.hardware.power@1.0",
132 "android.hardware.power@1.1",
133 "android.hardware.thermal@1.0",
134 "libpackagelistparser",
135 "libsysutils",
136 "libcutils",
137 ],
138}
139
140// =========
141// statsd
142// =========
143
144cc_binary {
145 name: "statsd",
146 defaults: ["statsd_defaults"],
147
148 srcs: ["src/main.cpp"],
149
150 cflags: [
151 "-Wall",
152 "-Wextra",
153 "-Werror",
154 "-Wno-unused-parameter",
155 // optimize for size (protobuf glop can get big)
156 "-Os",
157 // "-g",
158 // "-O0",
159 ],
160
161 product_variables: {
162 eng: {
163 // Enable sanitizer and allow very verbose printing on eng builds
164 cflags: ["-DVERY_VERBOSE_PRINTING"],
165 sanitize: {
166 address: true,
167 },
168 },
169 },
170
171 proto: {
172 type: "lite",
173 },
174
175 shared_libs: ["libgtest_prod"],
176
177 init_rc: ["statsd.rc"],
178}
179
180// ==============
181// statsd_test
182// ==============
183
184cc_test {
185 name: "statsd_test",
186 defaults: ["statsd_defaults"],
187 test_suites: ["device-tests"],
188
189 cflags: [
190 "-Wall",
191 "-Werror",
192 "-Wno-missing-field-initializers",
193 "-Wno-unused-variable",
194 "-Wno-unused-function",
195 "-Wno-unused-parameter",
196 ],
197
198 srcs: [
Colin Crosse7908d72018-10-26 23:28:02 -0700199 // atom_field_options.proto needs field_options.proto, but that is
200 // not included in libprotobuf-cpp-lite, so compile it here.
201 ":libprotobuf-internal-protos",
202
Colin Cross05c9e5c2018-10-26 22:34:06 -0700203 "src/atom_field_options.proto",
204 "src/atoms.proto",
205 "src/stats_log.proto",
206 "tests/AlarmMonitor_test.cpp",
207 "tests/anomaly/AlarmTracker_test.cpp",
208 "tests/anomaly/AnomalyTracker_test.cpp",
209 "tests/ConfigManager_test.cpp",
210 "tests/external/puller_util_test.cpp",
211 "tests/indexed_priority_queue_test.cpp",
212 "tests/LogEntryMatcher_test.cpp",
213 "tests/LogReader_test.cpp",
214 "tests/LogEvent_test.cpp",
215 "tests/MetricsManager_test.cpp",
216 "tests/StatsLogProcessor_test.cpp",
217 "tests/StatsService_test.cpp",
218 "tests/UidMap_test.cpp",
219 "tests/FieldValue_test.cpp",
220 "tests/condition/CombinationConditionTracker_test.cpp",
221 "tests/condition/SimpleConditionTracker_test.cpp",
222 "tests/condition/StateTracker_test.cpp",
223 "tests/metrics/OringDurationTracker_test.cpp",
224 "tests/metrics/MaxDurationTracker_test.cpp",
225 "tests/metrics/CountMetricProducer_test.cpp",
226 "tests/metrics/DurationMetricProducer_test.cpp",
227 "tests/metrics/EventMetricProducer_test.cpp",
228 "tests/metrics/ValueMetricProducer_test.cpp",
229 "tests/metrics/GaugeMetricProducer_test.cpp",
230 "tests/guardrail/StatsdStats_test.cpp",
231 "tests/metrics/metrics_test_helper.cpp",
232 "tests/statsd_test_util.cpp",
233 "tests/e2e/WakelockDuration_e2e_test.cpp",
234 "tests/e2e/MetricConditionLink_e2e_test.cpp",
235 "tests/e2e/Alarm_e2e_test.cpp",
236 "tests/e2e/Attribution_e2e_test.cpp",
237 "tests/e2e/GaugeMetric_e2e_push_test.cpp",
238 "tests/e2e/GaugeMetric_e2e_pull_test.cpp",
239 "tests/e2e/ValueMetric_pull_e2e_test.cpp",
240 "tests/e2e/DimensionInCondition_e2e_combination_AND_cond_test.cpp",
241 "tests/e2e/DimensionInCondition_e2e_combination_OR_cond_test.cpp",
242 "tests/e2e/DimensionInCondition_e2e_simple_cond_test.cpp",
243 "tests/e2e/Anomaly_count_e2e_test.cpp",
244 "tests/e2e/Anomaly_duration_sum_e2e_test.cpp",
245 "tests/e2e/ConfigTtl_e2e_test.cpp",
246 "tests/e2e/PartialBucket_e2e_test.cpp",
247 ],
248
249 static_libs: ["libgmock"],
250
251 proto: {
Colin Crosse7908d72018-10-26 23:28:02 -0700252 type: "lite",
Colin Cross05c9e5c2018-10-26 22:34:06 -0700253 include_dirs: ["external/protobuf/src"],
254 },
255
Colin Crosse7908d72018-10-26 23:28:02 -0700256 shared_libs: ["libprotobuf-cpp-lite"],
Colin Cross05c9e5c2018-10-26 22:34:06 -0700257
258}
259
260//#############################
261// statsd micro benchmark
262//#############################
263
264cc_benchmark {
265 name: "statsd_benchmark",
266 defaults: ["statsd_defaults"],
267
268 srcs: [
Colin Crosse7908d72018-10-26 23:28:02 -0700269 // atom_field_options.proto needs field_options.proto, but that is
270 // not included in libprotobuf-cpp-lite, so compile it here.
271 ":libprotobuf-internal-protos",
272
Colin Cross05c9e5c2018-10-26 22:34:06 -0700273 "src/atom_field_options.proto",
274 "src/atoms.proto",
275 "src/stats_log.proto",
276 "benchmark/main.cpp",
277 "benchmark/hello_world_benchmark.cpp",
278 "benchmark/log_event_benchmark.cpp",
279 "benchmark/stats_write_benchmark.cpp",
280 "benchmark/filter_value_benchmark.cpp",
281 "benchmark/get_dimensions_for_condition_benchmark.cpp",
282 "benchmark/metric_util.cpp",
283 "benchmark/duration_metric_benchmark.cpp",
284 ],
285
286 proto: {
Colin Crosse7908d72018-10-26 23:28:02 -0700287 type: "lite",
Colin Cross05c9e5c2018-10-26 22:34:06 -0700288 include_dirs: ["external/protobuf/src"],
289 },
290
291 cflags: [
292 "-Wall",
293 "-Werror",
294 "-Wno-unused-parameter",
295 "-Wno-unused-variable",
296 "-Wno-unused-function",
297
298 // Bug: http://b/29823425 Disable -Wvarargs for Clang update to r271374
299 "-Wno-varargs"
300 ],
301
302 shared_libs: [
303 "libgtest_prod",
304 "libstatslog",
Colin Crosse7908d72018-10-26 23:28:02 -0700305 "libprotobuf-cpp-lite",
Colin Cross05c9e5c2018-10-26 22:34:06 -0700306 ],
307}
Joe Onorato62c220b2017-11-18 20:32:56 -0800308
gopinath17593b02018-10-26 16:00:34 -0700309// ==== java proto device library (for test only) ==============================
310java_library {
311 name: "statsdprotolite",
312 no_framework_libs: true,
313 proto: {
314 type: "lite",
315 include_dirs: ["external/protobuf/src"],
316 },
317
318 srcs: [
319 "src/stats_log.proto",
320 "src/statsd_config.proto",
321 "src/perfetto/perfetto_config.proto",
322 "src/atoms.proto",
323 ],
324
325 static_libs: [
326 "platformprotoslite",
327 ],
328 // Protos have lots of MissingOverride and similar.
329 errorprone: {
330 javacflags: ["-XepDisableAllChecks"],
331 },
332}
333
334