Joe Onorato | 1754d74 | 2016-11-21 17:51:35 -0800 | [diff] [blame] | 1 | # Copyright (C) 2016 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) |
Yi Jin | 0a3406f | 2017-06-22 19:23:11 -0700 | [diff] [blame] | 16 | |
Yi Jin | 3c034c9 | 2017-12-22 17:36:47 -0800 | [diff] [blame] | 17 | # proto files used in incidentd to generate cppstream proto headers. |
| 18 | PROTO_FILES:= frameworks/base/core/proto/android/util/log.proto |
| 19 | |
Yi Jin | 0a3406f | 2017-06-22 19:23:11 -0700 | [diff] [blame] | 20 | # ========= # |
| 21 | # incidentd # |
| 22 | # ========= # |
| 23 | |
Joe Onorato | 1754d74 | 2016-11-21 17:51:35 -0800 | [diff] [blame] | 24 | include $(CLEAR_VARS) |
| 25 | |
| 26 | LOCAL_MODULE := incidentd |
| 27 | |
| 28 | LOCAL_SRC_FILES := \ |
Yi Jin | c23fad2 | 2017-09-15 17:24:59 -0700 | [diff] [blame] | 29 | src/PrivacyBuffer.cpp \ |
Joe Onorato | 1754d74 | 2016-11-21 17:51:35 -0800 | [diff] [blame] | 30 | src/FdBuffer.cpp \ |
| 31 | src/IncidentService.cpp \ |
Yi Jin | 99c248f | 2017-08-25 18:11:58 -0700 | [diff] [blame] | 32 | src/Privacy.cpp \ |
Joe Onorato | 1754d74 | 2016-11-21 17:51:35 -0800 | [diff] [blame] | 33 | src/Reporter.cpp \ |
| 34 | src/Section.cpp \ |
Yi Jin | b592e3b | 2018-02-01 15:17:04 -0800 | [diff] [blame] | 35 | src/incidentd_util.cpp \ |
Joe Onorato | 1754d74 | 2016-11-21 17:51:35 -0800 | [diff] [blame] | 36 | src/main.cpp \ |
Yi Jin | f860184 | 2017-08-15 22:01:41 -0700 | [diff] [blame] | 37 | src/report_directory.cpp |
Joe Onorato | 1754d74 | 2016-11-21 17:51:35 -0800 | [diff] [blame] | 38 | |
| 39 | LOCAL_CFLAGS += \ |
| 40 | -Wall -Werror -Wno-missing-field-initializers -Wno-unused-variable -Wunused-parameter |
| 41 | |
| 42 | ifeq (debug,) |
| 43 | LOCAL_CFLAGS += \ |
| 44 | -g -O0 |
| 45 | else |
| 46 | # optimize for size (protobuf glop can get big) |
| 47 | LOCAL_CFLAGS += \ |
| 48 | -Os |
| 49 | endif |
| 50 | |
Yi Jin | f860184 | 2017-08-15 22:01:41 -0700 | [diff] [blame] | 51 | LOCAL_C_INCLUDES += $(LOCAL_PATH)/src |
| 52 | |
Joe Onorato | 1754d74 | 2016-11-21 17:51:35 -0800 | [diff] [blame] | 53 | LOCAL_SHARED_LIBRARIES := \ |
| 54 | libbase \ |
| 55 | libbinder \ |
| 56 | libcutils \ |
| 57 | libincident \ |
| 58 | liblog \ |
Yi Jin | 329130b | 2018-02-09 16:47:47 -0800 | [diff] [blame] | 59 | libprotobuf-cpp-lite \ |
Yi Jin | c23fad2 | 2017-09-15 17:24:59 -0700 | [diff] [blame] | 60 | libprotoutil \ |
Joe Onorato | 1754d74 | 2016-11-21 17:51:35 -0800 | [diff] [blame] | 61 | libselinux \ |
| 62 | libservices \ |
| 63 | libutils |
| 64 | |
Yi Jin | f860184 | 2017-08-15 22:01:41 -0700 | [diff] [blame] | 65 | LOCAL_MODULE_CLASS := EXECUTABLES |
Yi Jin | 3c034c9 | 2017-12-22 17:36:47 -0800 | [diff] [blame] | 66 | |
Yi Jin | f860184 | 2017-08-15 22:01:41 -0700 | [diff] [blame] | 67 | gen_src_dir := $(local-generated-sources-dir) |
| 68 | |
Yi Jin | 3c034c9 | 2017-12-22 17:36:47 -0800 | [diff] [blame] | 69 | # generate section_list.cpp |
| 70 | GEN_LIST := $(gen_src_dir)/src/section_list.cpp |
| 71 | $(GEN_LIST): $(HOST_OUT_EXECUTABLES)/incident-section-gen |
| 72 | $(GEN_LIST): PRIVATE_CUSTOM_TOOL = \ |
Yi Jin | f860184 | 2017-08-15 22:01:41 -0700 | [diff] [blame] | 73 | $(HOST_OUT_EXECUTABLES)/incident-section-gen incidentd > $@ |
Yi Jin | 3c034c9 | 2017-12-22 17:36:47 -0800 | [diff] [blame] | 74 | $(GEN_LIST): $(HOST_OUT_EXECUTABLES)/incident-section-gen |
Yi Jin | f860184 | 2017-08-15 22:01:41 -0700 | [diff] [blame] | 75 | $(transform-generated-source) |
Yi Jin | 3c034c9 | 2017-12-22 17:36:47 -0800 | [diff] [blame] | 76 | LOCAL_GENERATED_SOURCES += $(GEN_LIST) |
| 77 | GEN_LIST:= |
| 78 | |
| 79 | # generate cppstream proto, add proto files to PROTO_FILES |
| 80 | GEN_PROTO := $(gen_src_dir)/proto.timestamp |
| 81 | $(GEN_PROTO): $(HOST_OUT_EXECUTABLES)/aprotoc $(HOST_OUT_EXECUTABLES)/protoc-gen-cppstream $(PROTO_FILES) |
| 82 | $(GEN_PROTO): PRIVATE_GEN_SRC_DIR := $(gen_src_dir) |
| 83 | $(GEN_PROTO): PRIVATE_CUSTOM_TOOL = \ |
| 84 | $(HOST_OUT_EXECUTABLES)/aprotoc --plugin=protoc-gen-cppstream=$(HOST_OUT_EXECUTABLES)/protoc-gen-cppstream \ |
| 85 | --cppstream_out=$(PRIVATE_GEN_SRC_DIR) -Iexternal/protobuf/src -I . \ |
| 86 | $(PROTO_FILES) \ |
| 87 | && touch $@ |
| 88 | $(GEN_PROTO): $(HOST_OUT_EXECUTABLES)/aprotoc |
| 89 | $(transform-generated-source) |
| 90 | LOCAL_GENERATED_SOURCES += $(GEN_PROTO) |
| 91 | GEN_PROTO:= |
Yi Jin | f860184 | 2017-08-15 22:01:41 -0700 | [diff] [blame] | 92 | |
| 93 | gen_src_dir:= |
Yi Jin | f860184 | 2017-08-15 22:01:41 -0700 | [diff] [blame] | 94 | |
Joe Onorato | 1754d74 | 2016-11-21 17:51:35 -0800 | [diff] [blame] | 95 | LOCAL_INIT_RC := incidentd.rc |
Joe Onorato | 1754d74 | 2016-11-21 17:51:35 -0800 | [diff] [blame] | 96 | |
| 97 | include $(BUILD_EXECUTABLE) |
Yi Jin | 0a3406f | 2017-06-22 19:23:11 -0700 | [diff] [blame] | 98 | |
| 99 | # ============== # |
| 100 | # incidentd_test # |
| 101 | # ============== # |
| 102 | |
| 103 | include $(CLEAR_VARS) |
| 104 | |
| 105 | LOCAL_MODULE := incidentd_test |
| 106 | LOCAL_COMPATIBILITY_SUITE := device-tests |
| 107 | LOCAL_MODULE_TAGS := tests |
| 108 | |
| 109 | LOCAL_CFLAGS := -Werror -Wall -Wno-unused-variable -Wunused-parameter |
| 110 | |
| 111 | LOCAL_C_INCLUDES += $(LOCAL_PATH)/src |
| 112 | |
| 113 | LOCAL_SRC_FILES := \ |
Yi Jin | c23fad2 | 2017-09-15 17:24:59 -0700 | [diff] [blame] | 114 | src/PrivacyBuffer.cpp \ |
Yi Jin | 0a3406f | 2017-06-22 19:23:11 -0700 | [diff] [blame] | 115 | src/FdBuffer.cpp \ |
Yi Jin | 99c248f | 2017-08-25 18:11:58 -0700 | [diff] [blame] | 116 | src/Privacy.cpp \ |
Yi Jin | 0a3406f | 2017-06-22 19:23:11 -0700 | [diff] [blame] | 117 | src/Reporter.cpp \ |
| 118 | src/Section.cpp \ |
Yi Jin | b592e3b | 2018-02-01 15:17:04 -0800 | [diff] [blame] | 119 | src/incidentd_util.cpp \ |
Yi Jin | add11e9 | 2017-07-30 16:10:07 -0700 | [diff] [blame] | 120 | src/report_directory.cpp \ |
Yi Jin | f860184 | 2017-08-15 22:01:41 -0700 | [diff] [blame] | 121 | tests/section_list.cpp \ |
Yi Jin | c23fad2 | 2017-09-15 17:24:59 -0700 | [diff] [blame] | 122 | tests/PrivacyBuffer_test.cpp \ |
Yi Jin | 0a3406f | 2017-06-22 19:23:11 -0700 | [diff] [blame] | 123 | tests/FdBuffer_test.cpp \ |
Yi Jin | add11e9 | 2017-07-30 16:10:07 -0700 | [diff] [blame] | 124 | tests/Reporter_test.cpp \ |
Yi Jin | 0a3406f | 2017-06-22 19:23:11 -0700 | [diff] [blame] | 125 | tests/Section_test.cpp \ |
| 126 | |
| 127 | LOCAL_STATIC_LIBRARIES := \ |
| 128 | libgmock \ |
| 129 | |
| 130 | LOCAL_SHARED_LIBRARIES := \ |
| 131 | libbase \ |
| 132 | libbinder \ |
| 133 | libcutils \ |
| 134 | libincident \ |
| 135 | liblog \ |
Yi Jin | 437aa6e | 2018-01-10 11:34:26 -0800 | [diff] [blame] | 136 | libprotobuf-cpp-lite \ |
Yi Jin | c23fad2 | 2017-09-15 17:24:59 -0700 | [diff] [blame] | 137 | libprotoutil \ |
Yi Jin | 0a3406f | 2017-06-22 19:23:11 -0700 | [diff] [blame] | 138 | libselinux \ |
| 139 | libservices \ |
| 140 | libutils \ |
| 141 | |
Yi Jin | 5e4ce2c | 2017-11-13 21:06:26 -0800 | [diff] [blame] | 142 | LOCAL_TEST_DATA := $(call find-test-data-in-subdirs, $(LOCAL_PATH), *, testdata) |
Yi Jin | 0a3406f | 2017-06-22 19:23:11 -0700 | [diff] [blame] | 143 | |
Yi Jin | 3c034c9 | 2017-12-22 17:36:47 -0800 | [diff] [blame] | 144 | LOCAL_MODULE_CLASS := NATIVE_TESTS |
| 145 | gen_src_dir := $(local-generated-sources-dir) |
| 146 | # generate cppstream proto for testing |
| 147 | GEN_PROTO := $(gen_src_dir)/log.proto.timestamp |
| 148 | $(GEN_PROTO): $(HOST_OUT_EXECUTABLES)/aprotoc $(HOST_OUT_EXECUTABLES)/protoc-gen-cppstream $(PROTO_FILES) |
| 149 | $(GEN_PROTO): PRIVATE_GEN_SRC_DIR := $(gen_src_dir) |
| 150 | $(GEN_PROTO): PRIVATE_CUSTOM_TOOL = \ |
| 151 | $(HOST_OUT_EXECUTABLES)/aprotoc --plugin=protoc-gen-cppstream=$(HOST_OUT_EXECUTABLES)/protoc-gen-cppstream \ |
| 152 | --cppstream_out=$(PRIVATE_GEN_SRC_DIR) -Iexternal/protobuf/src -I . \ |
| 153 | $(PROTO_FILES) \ |
| 154 | && touch $@ |
| 155 | $(GEN_PROTO): $(HOST_OUT_EXECUTABLES)/aprotoc |
| 156 | $(transform-generated-source) |
| 157 | LOCAL_GENERATED_SOURCES += $(GEN_PROTO) |
| 158 | GEN_PROTO:= |
| 159 | |
| 160 | gen_src_dir:= |
| 161 | |
Yi Jin | 0a3406f | 2017-06-22 19:23:11 -0700 | [diff] [blame] | 162 | include $(BUILD_NATIVE_TEST) |