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