Revert "Revert "Start auto-generating the stats log API.""
Test: builds successfully
This reverts commit 931945399859ab91545ba2c2a914f044092d5e2e.
Change-Id: I22bca4a32adf86040b9d72ad5b45999aba28f586
diff --git a/cmds/statsd/Android.mk b/cmds/statsd/Android.mk
index 4c95007..d9c37ef 100644
--- a/cmds/statsd/Android.mk
+++ b/cmds/statsd/Android.mk
@@ -14,22 +14,51 @@
LOCAL_PATH:= $(call my-dir)
-# ================
-# proto static lib
-# ================
-include $(CLEAR_VARS)
-LOCAL_MODULE := statsd_proto
-LOCAL_MODULE_TAGS := optional
+statsd_common_src := \
+ ../../core/java/android/os/IStatsCompanionService.aidl \
+ ../../core/java/android/os/IStatsManager.aidl \
+ src/stats_log.proto \
+ src/statsd_config.proto \
+ src/stats_events.proto \
+ src/condition/CombinationConditionTracker.cpp \
+ src/condition/condition_util.cpp \
+ src/condition/SimpleConditionTracker.cpp \
+ src/matchers/CombinationLogMatchingTracker.cpp \
+ src/matchers/matcher_util.cpp \
+ src/matchers/SimpleLogMatchingTracker.cpp \
+ src/metrics/CountAnomalyTracker.cpp \
+ src/metrics/CountMetricProducer.cpp \
+ src/metrics/MetricsManager.cpp \
+ src/metrics/metrics_manager_util.cpp \
+ src/AnomalyMonitor.cpp \
+ src/DropboxReader.cpp \
+ src/DropboxWriter.cpp \
+ src/KernelWakelockPuller.cpp \
+ src/LogEntryPrinter.cpp \
+ src/LogReader.cpp \
+ src/StatsLogProcessor.cpp \
+ src/StatsPullerManager.cpp \
+ src/StatsService.cpp \
+ src/stats_util.cpp \
+ src/UidMap.cpp
-LOCAL_SRC_FILES := $(call all-proto-files-under, src)
+statsd_common_c_includes := \
+ $(LOCAL_PATH)/src
-LOCAL_PROTOC_FLAGS :=
-LOCAL_PROTOC_OPTIMIZE_TYPE := lite-static
+statsd_common_aidl_includes := \
+ $(LOCAL_PATH)/../../core/java
-include $(BUILD_STATIC_LIBRARY)
-
-STATSD_PROTO_INCLUDES := $(local-generated-sources-dir)/src/$(LOCAL_PATH)
+statsd_common_shared_libraries := \
+ libbase \
+ libbinder \
+ libcutils \
+ libincident \
+ liblog \
+ libselinux \
+ libutils \
+ libservices \
+ libandroidfw
# =========
# statsd
@@ -40,9 +69,8 @@
LOCAL_MODULE := statsd
LOCAL_SRC_FILES := \
- ../../core/java/android/os/IStatsCompanionService.aidl \
- ../../core/java/android/os/IStatsManager.aidl \
- $(call all-cpp-files-under,src) \
+ $(statsd_common_src) \
+ src/main.cpp
LOCAL_CFLAGS += \
-Wall \
@@ -60,24 +88,12 @@
LOCAL_CFLAGS += \
-Os
endif
+LOCAL_PROTOC_OPTIMIZE_TYPE := lite-static
-LOCAL_AIDL_INCLUDES := $(LOCAL_PATH)/../../core/java
-LOCAL_C_INCLUDES += $(LOCAL_PATH)/src \
- STATSD_PROTO_INCLUDES
+LOCAL_AIDL_INCLUDES := $(statsd_common_c_includes)
+LOCAL_C_INCLUDES += $(statsd_common_c_includes)
-LOCAL_STATIC_LIBRARIES := statsd_proto
-
-LOCAL_SHARED_LIBRARIES := \
- libbase \
- libbinder \
- libcutils \
- libincident \
- liblog \
- libselinux \
- libutils \
- libservices \
- libandroidfw \
- libprotobuf-cpp-lite \
+LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries)
LOCAL_MODULE_CLASS := EXECUTABLES
@@ -85,6 +101,7 @@
include $(BUILD_EXECUTABLE)
+
# ==============
# statsd_test
# ==============
@@ -95,8 +112,8 @@
LOCAL_COMPATIBILITY_SUITE := device-tests
LOCAL_MODULE_TAGS := tests
-LOCAL_C_INCLUDES += $(LOCAL_PATH)/src \
- STATSD_PROTO_INCLUDES
+LOCAL_AIDL_INCLUDES := $(statsd_common_c_includes)
+LOCAL_C_INCLUDES += $(statsd_common_c_includes)
LOCAL_CFLAGS += \
-Wall \
@@ -107,38 +124,25 @@
-Wno-unused-parameter
LOCAL_SRC_FILES := \
- src/stats_log.proto \
- src/statsd_config.proto \
- ../../core/java/android/os/IStatsCompanionService.aidl \
- ../../core/java/android/os/IStatsManager.aidl \
- src/StatsService.cpp \
- src/AnomalyMonitor.cpp \
- src/stats_util.cpp \
- src/LogEntryPrinter.cpp \
- src/LogReader.cpp \
- src/matchers/matcher_util.cpp \
- src/condition/SimpleConditionTracker.cpp \
- src/condition/CombinationConditionTracker.cpp \
- src/matchers/SimpleLogMatchingTracker.cpp \
- src/matchers/CombinationLogMatchingTracker.cpp \
- src/metrics/metrics_manager_util.cpp \
- src/metrics/CountMetricProducer.cpp \
- src/metrics/CountAnomalyTracker.cpp \
- src/condition/condition_util.cpp \
- src/UidMap.cpp \
- $(call all-cpp-files-under, tests) \
+ $(statsd_common_src) \
+ tests/indexed_priority_queue_test.cpp \
+ tests/LogReader_test.cpp \
+ tests/MetricsManager_test.cpp \
+ tests/UidMap_test.cpp \
+ tests/LogEntryMatcher_test.cpp \
+ tests/AnomalyMonitor_test.cpp \
+ tests/ConditionTracker_test.cpp
LOCAL_STATIC_LIBRARIES := \
- libgmock \
- statsd_proto \
+ libgmock
-LOCAL_SHARED_LIBRARIES := \
- libbase \
- libbinder \
- libcutils \
- liblog \
- libselinux \
- libutils \
- libprotobuf-cpp-lite \
+LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries)
+
+LOCAL_PROTOC_OPTIMIZE_TYPE := lite
+
+statsd_common_src:=
+statsd_common_aidl_includes:=
+statsd_common_c_includes:=
include $(BUILD_NATIVE_TEST)
+