blob: bb262b486f7c821a64819a9128c5286152ded5d4 [file] [log] [blame]
Bertrand SIMONNETed6ca6f2015-07-28 15:46:36 -07001# Copyright (C) 2015 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15LOCAL_PATH := $(call my-dir)
16
17metrics_cpp_extension := .cc
18libmetrics_sources := \
19 c_metrics_library.cc \
20 metrics_library.cc \
Samuel Tan1c4d8f12015-09-15 11:40:47 -070021 timer.cc
Bertrand SIMONNETed6ca6f2015-07-28 15:46:36 -070022
23metrics_client_sources := \
24 metrics_client.cc
25
Bertrand SIMONNET608e4282015-11-12 17:52:17 -080026metrics_collector_common := \
Bertrand SIMONNET7a964052015-09-29 11:07:24 -070027 collectors/averaged_statistics_collector.cc \
Bertrand SIMONNET0ada2ca2015-11-02 14:08:44 -080028 collectors/cpu_usage_collector.cc \
Bertrand SIMONNET5658dc52015-09-18 13:38:10 -070029 collectors/disk_usage_collector.cc \
Bertrand SIMONNET608e4282015-11-12 17:52:17 -080030 metrics_collector.cc \
Todd Poynor4b50bf32016-01-05 17:27:36 -080031 metrics_collector_service_impl.cc \
Bertrand SIMONNET6b8629a2015-11-18 13:46:33 -080032 persistent_integer.cc
Bertrand SIMONNET608e4282015-11-12 17:52:17 -080033
34metricsd_common := \
Bertrand SIMONNETed6ca6f2015-07-28 15:46:36 -070035 persistent_integer.cc \
Bertrand SIMONNET6b8629a2015-11-18 13:46:33 -080036 uploader/bn_metricsd_impl.cc \
37 uploader/crash_counters.cc \
Bertrand SIMONNET12531862015-08-31 11:11:57 -070038 uploader/metrics_hashes.cc \
Bertrand SIMONNET12531862015-08-31 11:11:57 -070039 uploader/metrics_log_base.cc \
Bertrand SIMONNET12531862015-08-31 11:11:57 -070040 uploader/metrics_log.cc \
Bertrand SIMONNETb6c77af2015-12-08 17:46:00 -080041 uploader/metricsd_service_runner.cc \
Bertrand SIMONNET12531862015-08-31 11:11:57 -070042 uploader/sender_http.cc \
43 uploader/system_profile_cache.cc \
Bertrand SIMONNET6b8629a2015-11-18 13:46:33 -080044 uploader/upload_service.cc
Bertrand SIMONNET59890e22015-10-02 16:45:18 -070045
Bertrand SIMONNET608e4282015-11-12 17:52:17 -080046metrics_collector_tests_sources := \
Bertrand SIMONNET59890e22015-10-02 16:45:18 -070047 collectors/averaged_statistics_collector_test.cc \
Bertrand SIMONNET0ada2ca2015-11-02 14:08:44 -080048 collectors/cpu_usage_collector_test.cc \
Bertrand SIMONNET608e4282015-11-12 17:52:17 -080049 metrics_collector_test.cc \
Bertrand SIMONNET59890e22015-10-02 16:45:18 -070050 metrics_library_test.cc \
51 persistent_integer_test.cc \
Bertrand SIMONNET6b8629a2015-11-18 13:46:33 -080052 timer_test.cc
Bertrand SIMONNET608e4282015-11-12 17:52:17 -080053
54metricsd_tests_sources := \
Bertrand SIMONNET59890e22015-10-02 16:45:18 -070055 uploader/metrics_hashes_unittest.cc \
56 uploader/metrics_log_base_unittest.cc \
57 uploader/mock/sender_mock.cc \
Bertrand SIMONNET6b8629a2015-11-18 13:46:33 -080058 uploader/upload_service_test.cc
Bertrand SIMONNET12531862015-08-31 11:11:57 -070059
Bertrand SIMONNETed6ca6f2015-07-28 15:46:36 -070060metrics_CFLAGS := -Wall \
Bertrand SIMONNETed6ca6f2015-07-28 15:46:36 -070061 -Wno-char-subscripts \
62 -Wno-missing-field-initializers \
Bertrand SIMONNETed6ca6f2015-07-28 15:46:36 -070063 -Wno-unused-parameter \
64 -Werror \
65 -fvisibility=default
66metrics_CPPFLAGS := -Wno-non-virtual-dtor \
67 -Wno-sign-promo \
68 -Wno-strict-aliasing \
69 -fvisibility=default
70metrics_includes := external/gtest/include \
71 $(LOCAL_PATH)/include
Bertrand SIMONNET6b8629a2015-11-18 13:46:33 -080072libmetrics_shared_libraries := libchrome libbinder libbrillo libutils
Bertrand SIMONNET608e4282015-11-12 17:52:17 -080073metrics_collector_shared_libraries := $(libmetrics_shared_libraries) \
Todd Poynor694553d2015-12-03 11:05:45 -080074 libbrillo-binder \
Bertrand SIMONNET608e4282015-11-12 17:52:17 -080075 libbrillo-http \
Bertrand SIMONNET59890e22015-10-02 16:45:18 -070076 libmetrics \
Bertrand SIMONNET59890e22015-10-02 16:45:18 -070077 librootdev \
Bertrand SIMONNET6b8629a2015-11-18 13:46:33 -080078 libweaved
Bertrand SIMONNETed6ca6f2015-07-28 15:46:36 -070079
Todd Poynor694553d2015-12-03 11:05:45 -080080metrics_collector_static_libraries := libmetricscollectorservice
81
Bertrand SIMONNET608e4282015-11-12 17:52:17 -080082metricsd_shared_libraries := \
Bertrand SIMONNET6b8629a2015-11-18 13:46:33 -080083 libbinder \
Bertrand SIMONNET608e4282015-11-12 17:52:17 -080084 libbrillo \
Bertrand SIMONNETb6c77af2015-12-08 17:46:00 -080085 libbrillo-binder \
Bertrand SIMONNET608e4282015-11-12 17:52:17 -080086 libbrillo-http \
87 libchrome \
88 libprotobuf-cpp-lite \
89 libupdate_engine_client \
Bertrand SIMONNET6b8629a2015-11-18 13:46:33 -080090 libutils
91
Todd Poynor694553d2015-12-03 11:05:45 -080092# Static proxy library for the metricsd binder interface.
Bertrand SIMONNET6b8629a2015-11-18 13:46:33 -080093# ========================================================
94include $(CLEAR_VARS)
95LOCAL_MODULE := metricsd_binder_proxy
96LOCAL_SHARED_LIBRARIES := libbinder libutils
97LOCAL_SRC_FILES := aidl/android/brillo/metrics/IMetricsd.aidl
98include $(BUILD_STATIC_LIBRARY)
Bertrand SIMONNET608e4282015-11-12 17:52:17 -080099
Todd Poynor694553d2015-12-03 11:05:45 -0800100# Static library for the metrics_collector binder interface.
101# ==========================================================
102include $(CLEAR_VARS)
103LOCAL_MODULE := libmetricscollectorservice
Todd Poynorb77ae452016-01-04 14:11:25 -0800104LOCAL_CLANG := true
Todd Poynor694553d2015-12-03 11:05:45 -0800105LOCAL_SHARED_LIBRARIES := libbinder libbrillo-binder libchrome libutils
106LOCAL_CPP_EXTENSION := $(metrics_cpp_extension)
107LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
108LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
109LOCAL_SRC_FILES := \
110 aidl/android/brillo/metrics/IMetricsCollectorService.aidl \
Todd Poynor694553d2015-12-03 11:05:45 -0800111 metrics_collector_service_client.cc
Todd Poynor694553d2015-12-03 11:05:45 -0800112include $(BUILD_STATIC_LIBRARY)
113
Bertrand SIMONNETed6ca6f2015-07-28 15:46:36 -0700114# Shared library for metrics.
115# ========================================================
116include $(CLEAR_VARS)
117LOCAL_MODULE := libmetrics
118LOCAL_C_INCLUDES := $(metrics_includes)
119LOCAL_CFLAGS := $(metrics_CFLAGS)
Bertrand SIMONNETebbe35c2015-09-08 10:13:35 -0700120LOCAL_CLANG := true
Bertrand SIMONNETed6ca6f2015-07-28 15:46:36 -0700121LOCAL_CPP_EXTENSION := $(metrics_cpp_extension)
122LOCAL_CPPFLAGS := $(metrics_CPPFLAGS)
123LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
Bertrand SIMONNET59890e22015-10-02 16:45:18 -0700124LOCAL_SHARED_LIBRARIES := $(libmetrics_shared_libraries)
Bertrand SIMONNETed6ca6f2015-07-28 15:46:36 -0700125LOCAL_SRC_FILES := $(libmetrics_sources)
Bertrand SIMONNET6b8629a2015-11-18 13:46:33 -0800126LOCAL_STATIC_LIBRARIES := metricsd_binder_proxy
Bertrand SIMONNETed6ca6f2015-07-28 15:46:36 -0700127include $(BUILD_SHARED_LIBRARY)
128
129# CLI client for metrics.
130# ========================================================
131include $(CLEAR_VARS)
132LOCAL_MODULE := metrics_client
133LOCAL_C_INCLUDES := $(metrics_includes)
134LOCAL_CFLAGS := $(metrics_CFLAGS)
Bertrand SIMONNETebbe35c2015-09-08 10:13:35 -0700135LOCAL_CLANG := true
Bertrand SIMONNETed6ca6f2015-07-28 15:46:36 -0700136LOCAL_CPP_EXTENSION := $(metrics_cpp_extension)
137LOCAL_CPPFLAGS := $(metrics_CPPFLAGS)
Bertrand SIMONNET59890e22015-10-02 16:45:18 -0700138LOCAL_SHARED_LIBRARIES := $(libmetrics_shared_libraries) \
Bertrand SIMONNETed6ca6f2015-07-28 15:46:36 -0700139 libmetrics
140LOCAL_SRC_FILES := $(metrics_client_sources)
Bertrand SIMONNET6b8629a2015-11-18 13:46:33 -0800141LOCAL_STATIC_LIBRARIES := metricsd_binder_proxy
Bertrand SIMONNETed6ca6f2015-07-28 15:46:36 -0700142include $(BUILD_EXECUTABLE)
143
Bertrand SIMONNET608e4282015-11-12 17:52:17 -0800144# Protobuf library for metricsd.
Bertrand SIMONNETed6ca6f2015-07-28 15:46:36 -0700145# ========================================================
146include $(CLEAR_VARS)
Bertrand SIMONNET608e4282015-11-12 17:52:17 -0800147LOCAL_MODULE := metricsd_protos
Bertrand SIMONNETed6ca6f2015-07-28 15:46:36 -0700148LOCAL_MODULE_CLASS := STATIC_LIBRARIES
149generated_sources_dir := $(call local-generated-sources-dir)
150LOCAL_EXPORT_C_INCLUDE_DIRS += \
151 $(generated_sources_dir)/proto/system/core/metricsd
152LOCAL_SRC_FILES := $(call all-proto-files-under,uploader/proto)
Bertrand SIMONNETed6ca6f2015-07-28 15:46:36 -0700153include $(BUILD_STATIC_LIBRARY)
154
Bertrand SIMONNET608e4282015-11-12 17:52:17 -0800155# metrics_collector daemon.
Bertrand SIMONNETed6ca6f2015-07-28 15:46:36 -0700156# ========================================================
157include $(CLEAR_VARS)
Bertrand SIMONNET608e4282015-11-12 17:52:17 -0800158LOCAL_MODULE := metrics_collector
Alex Vakulenko26aef372015-10-27 11:46:37 -0700159LOCAL_C_INCLUDES := $(metrics_includes)
Bertrand SIMONNETed6ca6f2015-07-28 15:46:36 -0700160LOCAL_CFLAGS := $(metrics_CFLAGS)
Bertrand SIMONNET608e4282015-11-12 17:52:17 -0800161LOCAL_CLANG := true
Bertrand SIMONNETed6ca6f2015-07-28 15:46:36 -0700162LOCAL_CPP_EXTENSION := $(metrics_cpp_extension)
163LOCAL_CPPFLAGS := $(metrics_CPPFLAGS)
Bertrand SIMONNET608e4282015-11-12 17:52:17 -0800164LOCAL_INIT_RC := metrics_collector.rc
Alex Vakulenko9fc597b2015-12-09 12:34:18 -0800165LOCAL_REQUIRED_MODULES := metrics.json
Bertrand SIMONNET608e4282015-11-12 17:52:17 -0800166LOCAL_SHARED_LIBRARIES := $(metrics_collector_shared_libraries)
167LOCAL_SRC_FILES := $(metrics_collector_common) \
Todd Poynor4b50bf32016-01-05 17:27:36 -0800168 metrics_collector_main.cc
Todd Poynor694553d2015-12-03 11:05:45 -0800169LOCAL_STATIC_LIBRARIES := metricsd_binder_proxy \
170 $(metrics_collector_static_libraries)
Bertrand SIMONNETed6ca6f2015-07-28 15:46:36 -0700171include $(BUILD_EXECUTABLE)
Bertrand SIMONNET0a94a3b2015-08-11 11:45:05 -0700172
Bertrand SIMONNET608e4282015-11-12 17:52:17 -0800173# metricsd daemon.
Bertrand SIMONNET12531862015-08-31 11:11:57 -0700174# ========================================================
175include $(CLEAR_VARS)
Bertrand SIMONNET608e4282015-11-12 17:52:17 -0800176LOCAL_MODULE := metricsd
177LOCAL_C_INCLUDES := $(metrics_includes)
Bertrand SIMONNET12531862015-08-31 11:11:57 -0700178LOCAL_CFLAGS := $(metrics_CFLAGS)
Bertrand SIMONNET608e4282015-11-12 17:52:17 -0800179LOCAL_CLANG := true
180LOCAL_CPP_EXTENSION := $(metrics_cpp_extension)
181LOCAL_CPPFLAGS := $(metrics_CPPFLAGS)
182LOCAL_INIT_RC := metricsd.rc
183LOCAL_REQUIRED_MODULES := \
184 metrics_collector
Bertrand SIMONNET608e4282015-11-12 17:52:17 -0800185LOCAL_SHARED_LIBRARIES := $(metricsd_shared_libraries)
Bertrand SIMONNET6b8629a2015-11-18 13:46:33 -0800186LOCAL_STATIC_LIBRARIES := metricsd_protos metricsd_binder_proxy
Bertrand SIMONNET608e4282015-11-12 17:52:17 -0800187LOCAL_SRC_FILES := $(metricsd_common) \
188 metricsd_main.cc
189include $(BUILD_EXECUTABLE)
190
191# Unit tests for metricsd.
192# ========================================================
193include $(CLEAR_VARS)
194LOCAL_MODULE := metricsd_tests
195LOCAL_CFLAGS := $(metrics_CFLAGS)
196LOCAL_CLANG := true
Bertrand SIMONNET12531862015-08-31 11:11:57 -0700197LOCAL_CPP_EXTENSION := $(metrics_cpp_extension)
198LOCAL_CPPFLAGS := $(metrics_CPPFLAGS) -Wno-sign-compare
Bertrand SIMONNET6b8629a2015-11-18 13:46:33 -0800199LOCAL_SHARED_LIBRARIES := $(metricsd_shared_libraries)
Bertrand SIMONNET608e4282015-11-12 17:52:17 -0800200LOCAL_SRC_FILES := $(metricsd_tests_sources) $(metricsd_common)
Bertrand SIMONNET6b8629a2015-11-18 13:46:33 -0800201LOCAL_STATIC_LIBRARIES := libBionicGtestMain libgmock metricsd_protos metricsd_binder_proxy
Bertrand SIMONNET30c174b2016-01-19 17:58:40 -0800202ifdef BRILLO
Jorge Lucangeli Obes1e7592c2016-02-04 14:17:46 -0800203LOCAL_MODULE_TAGS := eng
Bertrand SIMONNET30c174b2016-01-19 17:58:40 -0800204endif
Bertrand SIMONNET608e4282015-11-12 17:52:17 -0800205include $(BUILD_NATIVE_TEST)
Bertrand SIMONNET12531862015-08-31 11:11:57 -0700206
Bertrand SIMONNET608e4282015-11-12 17:52:17 -0800207# Unit tests for metrics_collector.
208# ========================================================
209include $(CLEAR_VARS)
210LOCAL_MODULE := metrics_collector_tests
211LOCAL_CFLAGS := $(metrics_CFLAGS)
212LOCAL_CLANG := true
213LOCAL_CPP_EXTENSION := $(metrics_cpp_extension)
214LOCAL_CPPFLAGS := $(metrics_CPPFLAGS) -Wno-sign-compare
Bertrand SIMONNET608e4282015-11-12 17:52:17 -0800215LOCAL_SHARED_LIBRARIES := $(metrics_collector_shared_libraries)
216LOCAL_SRC_FILES := $(metrics_collector_tests_sources) \
217 $(metrics_collector_common)
Todd Poynor694553d2015-12-03 11:05:45 -0800218LOCAL_STATIC_LIBRARIES := libBionicGtestMain libgmock metricsd_binder_proxy \
219 $(metrics_collector_static_libraries)
Bertrand SIMONNET30c174b2016-01-19 17:58:40 -0800220ifdef BRILLO
Jorge Lucangeli Obes1e7592c2016-02-04 14:17:46 -0800221LOCAL_MODULE_TAGS := eng
Bertrand SIMONNET30c174b2016-01-19 17:58:40 -0800222endif
Bertrand SIMONNET12531862015-08-31 11:11:57 -0700223include $(BUILD_NATIVE_TEST)
Bertrand SIMONNET59890e22015-10-02 16:45:18 -0700224
225# Weave schema files
226# ========================================================
227include $(CLEAR_VARS)
228LOCAL_MODULE := metrics.json
229LOCAL_MODULE_CLASS := ETC
Alex Vakulenko9fc597b2015-12-09 12:34:18 -0800230LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/weaved/traits
231LOCAL_SRC_FILES := etc/weaved/traits/$(LOCAL_MODULE)
Bertrand SIMONNET59890e22015-10-02 16:45:18 -0700232include $(BUILD_PREBUILT)