1// 2// Copyright (C) 2017 The Android Open Source Project 3// 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 host executable: stats-log-api-gen 19// ========================================================== 20cc_binary_host { 21 name: "stats-log-api-gen", 22 srcs: [ 23 "Collation.cpp", 24 "atoms_info_writer.cpp", 25 "java_writer.cpp", 26 "java_writer_q.cpp", 27 "main.cpp", 28 "native_writer.cpp", 29 "native_writer_q.cpp", 30 "utils.cpp", 31 ], 32 cflags: [ 33 "-DSTATS_SCHEMA_LEGACY", 34 "-Wall", 35 "-Werror", 36 ], 37 38 shared_libs: [ 39 "libstats_proto_host", 40 "libprotobuf-cpp-full", 41 "libbase", 42 ], 43 44 proto: { 45 type: "full", 46 }, 47} 48 49// ========================================================== 50// Build the host test executable: stats-log-api-gen 51// ========================================================== 52cc_test_host { 53 name: "stats-log-api-gen-test", 54 cflags: [ 55 "-Wall", 56 "-Wextra", 57 "-Werror", 58 "-g", 59 "-DUNIT_TEST", 60 ], 61 srcs: [ 62 "Collation.cpp", 63 "test_collation.cpp", 64 "test.proto", 65 ], 66 67 static_libs: [ 68 "libgmock_host", 69 ], 70 71 shared_libs: [ 72 "libstats_proto_host", 73 "libprotobuf-cpp-full", 74 ], 75 76 proto: { 77 type: "full", 78 include_dirs: [ 79 "external/protobuf/src", 80 ], 81 }, 82} 83 84// ========================================================== 85// Native library 86// ========================================================== 87genrule { 88 name: "statslog.h", 89 tools: ["stats-log-api-gen"], 90 cmd: "$(location stats-log-api-gen) --header $(genDir)/statslog.h", 91 out: [ 92 "statslog.h", 93 ], 94} 95 96genrule { 97 name: "statslog.cpp", 98 tools: ["stats-log-api-gen"], 99 cmd: "$(location stats-log-api-gen) --cpp $(genDir)/statslog.cpp", 100 out: [ 101 "statslog.cpp", 102 ], 103} 104 105cc_library { 106 name: "libstatslog", 107 host_supported: true, 108 generated_sources: [ 109 "statslog.cpp", 110 ], 111 generated_headers: [ 112 "statslog.h" 113 ], 114 cflags: [ 115 "-Wall", 116 "-Werror", 117 ], 118 export_generated_headers: [ 119 "statslog.h" 120 ], 121 shared_libs: [ 122 "liblog", 123 "libcutils", 124 ], 125 static_libs: ["libstatssocket"], 126} 127 128