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