Home | History | Annotate | Download | only in metricsd
      1 # 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 
     15 LOCAL_PATH := $(call my-dir)
     16 
     17 metrics_cpp_extension := .cc
     18 libmetrics_sources := \
     19   c_metrics_library.cc \
     20   metrics_library.cc \
     21   timer.cc
     22 
     23 metrics_client_sources := \
     24   metrics_client.cc
     25 
     26 metrics_collector_common := \
     27   collectors/averaged_statistics_collector.cc \
     28   collectors/cpu_usage_collector.cc \
     29   collectors/disk_usage_collector.cc \
     30   metrics_collector.cc \
     31   metrics_collector_service_impl.cc \
     32   persistent_integer.cc
     33 
     34 metricsd_common := \
     35   persistent_integer.cc \
     36   uploader/bn_metricsd_impl.cc \
     37   uploader/crash_counters.cc \
     38   uploader/metrics_hashes.cc \
     39   uploader/metrics_log_base.cc \
     40   uploader/metrics_log.cc \
     41   uploader/metricsd_service_runner.cc \
     42   uploader/sender_http.cc \
     43   uploader/system_profile_cache.cc \
     44   uploader/upload_service.cc
     45 
     46 metrics_collector_tests_sources := \
     47   collectors/averaged_statistics_collector_test.cc \
     48   collectors/cpu_usage_collector_test.cc \
     49   metrics_collector_test.cc \
     50   metrics_library_test.cc \
     51   persistent_integer_test.cc \
     52   timer_test.cc
     53 
     54 metricsd_tests_sources := \
     55   uploader/metrics_hashes_unittest.cc \
     56   uploader/metrics_log_base_unittest.cc \
     57   uploader/mock/sender_mock.cc \
     58   uploader/upload_service_test.cc
     59 
     60 metrics_CFLAGS := -Wall \
     61   -Wno-char-subscripts \
     62   -Wno-missing-field-initializers \
     63   -Wno-unused-parameter \
     64   -Werror \
     65   -fvisibility=default
     66 metrics_CPPFLAGS := -Wno-non-virtual-dtor \
     67   -Wno-sign-promo \
     68   -Wno-strict-aliasing \
     69   -fvisibility=default
     70 metrics_includes := external/gtest/include \
     71   $(LOCAL_PATH)/include
     72 libmetrics_shared_libraries := libchrome libbinder libbrillo libutils
     73 metrics_collector_shared_libraries := $(libmetrics_shared_libraries) \
     74   libbrillo-binder \
     75   libbrillo-http \
     76   libmetrics \
     77   librootdev \
     78   libweaved
     79 
     80 metrics_collector_static_libraries := libmetricscollectorservice
     81 
     82 metricsd_shared_libraries := \
     83   libbinder \
     84   libbrillo \
     85   libbrillo-binder \
     86   libbrillo-http \
     87   libchrome \
     88   libprotobuf-cpp-lite \
     89   libupdate_engine_client \
     90   libutils
     91 
     92 # Static proxy library for the metricsd binder interface.
     93 # ========================================================
     94 include $(CLEAR_VARS)
     95 LOCAL_MODULE := metricsd_binder_proxy
     96 LOCAL_SHARED_LIBRARIES := libbinder libutils
     97 LOCAL_SRC_FILES := aidl/android/brillo/metrics/IMetricsd.aidl
     98 include $(BUILD_STATIC_LIBRARY)
     99 
    100 # Static library for the metrics_collector binder interface.
    101 # ==========================================================
    102 include $(CLEAR_VARS)
    103 LOCAL_MODULE := libmetricscollectorservice
    104 LOCAL_CLANG := true
    105 LOCAL_SHARED_LIBRARIES := libbinder libbrillo-binder libchrome libutils
    106 LOCAL_CPP_EXTENSION := $(metrics_cpp_extension)
    107 LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
    108 LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
    109 LOCAL_SRC_FILES := \
    110   aidl/android/brillo/metrics/IMetricsCollectorService.aidl \
    111   metrics_collector_service_client.cc
    112 include $(BUILD_STATIC_LIBRARY)
    113 
    114 # Shared library for metrics.
    115 # ========================================================
    116 include $(CLEAR_VARS)
    117 LOCAL_MODULE := libmetrics
    118 LOCAL_C_INCLUDES := $(metrics_includes)
    119 LOCAL_CFLAGS := $(metrics_CFLAGS)
    120 LOCAL_CLANG := true
    121 LOCAL_CPP_EXTENSION := $(metrics_cpp_extension)
    122 LOCAL_CPPFLAGS := $(metrics_CPPFLAGS)
    123 LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
    124 LOCAL_SHARED_LIBRARIES := $(libmetrics_shared_libraries)
    125 LOCAL_SRC_FILES := $(libmetrics_sources)
    126 LOCAL_STATIC_LIBRARIES := metricsd_binder_proxy
    127 include $(BUILD_SHARED_LIBRARY)
    128 
    129 # CLI client for metrics.
    130 # ========================================================
    131 include $(CLEAR_VARS)
    132 LOCAL_MODULE := metrics_client
    133 LOCAL_C_INCLUDES := $(metrics_includes)
    134 LOCAL_CFLAGS := $(metrics_CFLAGS)
    135 LOCAL_CLANG := true
    136 LOCAL_CPP_EXTENSION := $(metrics_cpp_extension)
    137 LOCAL_CPPFLAGS := $(metrics_CPPFLAGS)
    138 LOCAL_SHARED_LIBRARIES := $(libmetrics_shared_libraries) \
    139   libmetrics
    140 LOCAL_SRC_FILES := $(metrics_client_sources)
    141 LOCAL_STATIC_LIBRARIES := metricsd_binder_proxy
    142 include $(BUILD_EXECUTABLE)
    143 
    144 # Protobuf library for metricsd.
    145 # ========================================================
    146 include $(CLEAR_VARS)
    147 LOCAL_MODULE := metricsd_protos
    148 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
    149 generated_sources_dir := $(call local-generated-sources-dir)
    150 LOCAL_EXPORT_C_INCLUDE_DIRS += \
    151     $(generated_sources_dir)/proto/system/core/metricsd
    152 LOCAL_SRC_FILES :=  $(call all-proto-files-under,uploader/proto)
    153 include $(BUILD_STATIC_LIBRARY)
    154 
    155 # metrics_collector daemon.
    156 # ========================================================
    157 include $(CLEAR_VARS)
    158 LOCAL_MODULE := metrics_collector
    159 LOCAL_C_INCLUDES := $(metrics_includes)
    160 LOCAL_CFLAGS := $(metrics_CFLAGS)
    161 LOCAL_CLANG := true
    162 LOCAL_CPP_EXTENSION := $(metrics_cpp_extension)
    163 LOCAL_CPPFLAGS := $(metrics_CPPFLAGS)
    164 LOCAL_INIT_RC := metrics_collector.rc
    165 LOCAL_REQUIRED_MODULES := metrics.json
    166 LOCAL_SHARED_LIBRARIES := $(metrics_collector_shared_libraries)
    167 LOCAL_SRC_FILES := $(metrics_collector_common) \
    168   metrics_collector_main.cc
    169 LOCAL_STATIC_LIBRARIES := metricsd_binder_proxy \
    170   $(metrics_collector_static_libraries)
    171 include $(BUILD_EXECUTABLE)
    172 
    173 # metricsd daemon.
    174 # ========================================================
    175 include $(CLEAR_VARS)
    176 LOCAL_MODULE := metricsd
    177 LOCAL_C_INCLUDES := $(metrics_includes)
    178 LOCAL_CFLAGS := $(metrics_CFLAGS)
    179 LOCAL_CLANG := true
    180 LOCAL_CPP_EXTENSION := $(metrics_cpp_extension)
    181 LOCAL_CPPFLAGS := $(metrics_CPPFLAGS)
    182 LOCAL_INIT_RC := metricsd.rc
    183 LOCAL_REQUIRED_MODULES := \
    184   metrics_collector
    185 LOCAL_SHARED_LIBRARIES := $(metricsd_shared_libraries)
    186 LOCAL_STATIC_LIBRARIES := metricsd_protos metricsd_binder_proxy
    187 LOCAL_SRC_FILES := $(metricsd_common) \
    188   metricsd_main.cc
    189 include $(BUILD_EXECUTABLE)
    190 
    191 # Unit tests for metricsd.
    192 # ========================================================
    193 include $(CLEAR_VARS)
    194 LOCAL_MODULE := metricsd_tests
    195 LOCAL_CFLAGS := $(metrics_CFLAGS)
    196 LOCAL_CLANG := true
    197 LOCAL_CPP_EXTENSION := $(metrics_cpp_extension)
    198 LOCAL_CPPFLAGS := $(metrics_CPPFLAGS) -Wno-sign-compare
    199 LOCAL_SHARED_LIBRARIES := $(metricsd_shared_libraries)
    200 LOCAL_SRC_FILES := $(metricsd_tests_sources) $(metricsd_common)
    201 LOCAL_STATIC_LIBRARIES := libBionicGtestMain libgmock metricsd_protos metricsd_binder_proxy
    202 ifdef BRILLO
    203 LOCAL_MODULE_TAGS := eng
    204 endif
    205 include $(BUILD_NATIVE_TEST)
    206 
    207 # Unit tests for metrics_collector.
    208 # ========================================================
    209 include $(CLEAR_VARS)
    210 LOCAL_MODULE := metrics_collector_tests
    211 LOCAL_CFLAGS := $(metrics_CFLAGS)
    212 LOCAL_CLANG := true
    213 LOCAL_CPP_EXTENSION := $(metrics_cpp_extension)
    214 LOCAL_CPPFLAGS := $(metrics_CPPFLAGS) -Wno-sign-compare
    215 LOCAL_SHARED_LIBRARIES := $(metrics_collector_shared_libraries)
    216 LOCAL_SRC_FILES := $(metrics_collector_tests_sources) \
    217   $(metrics_collector_common)
    218 LOCAL_STATIC_LIBRARIES := libBionicGtestMain libgmock metricsd_binder_proxy \
    219   $(metrics_collector_static_libraries)
    220 ifdef BRILLO
    221 LOCAL_MODULE_TAGS := eng
    222 endif
    223 include $(BUILD_NATIVE_TEST)
    224 
    225 # Weave schema files
    226 # ========================================================
    227 include $(CLEAR_VARS)
    228 LOCAL_MODULE := metrics.json
    229 LOCAL_MODULE_CLASS := ETC
    230 LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/weaved/traits
    231 LOCAL_SRC_FILES := etc/weaved/traits/$(LOCAL_MODULE)
    232 include $(BUILD_PREBUILT)
    233