Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 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 | |
| 27 | shared_libs: [ |
| 28 | "libstats_proto_host", |
| 29 | "libprotobuf-cpp-full", |
| 30 | ], |
| 31 | |
| 32 | proto: { |
| 33 | type: "full", |
| 34 | }, |
| 35 | } |
| 36 | |
| 37 | // ========================================================== |
| 38 | // Build the host test executable: stats-log-api-gen |
| 39 | // ========================================================== |
| 40 | cc_test_host { |
| 41 | name: "stats-log-api-gen-test", |
| 42 | cflags: [ |
| 43 | "-Wall", |
| 44 | "-Wextra", |
| 45 | "-Werror", |
| 46 | "-g", |
| 47 | "-DUNIT_TEST", |
| 48 | ], |
| 49 | srcs: [ |
| 50 | "Collation.cpp", |
| 51 | "test_collation.cpp", |
| 52 | "test.proto", |
| 53 | ], |
| 54 | |
| 55 | static_libs: [ |
| 56 | "libgmock_host", |
| 57 | ], |
| 58 | |
| 59 | shared_libs: [ |
| 60 | "libstats_proto_host", |
| 61 | ], |
| 62 | |
| 63 | proto: { |
| 64 | type: "full", |
| 65 | }, |
| 66 | } |
| 67 | |
| 68 | // ========================================================== |
| 69 | // Native library |
| 70 | // ========================================================== |
| 71 | genrule { |
| 72 | name: "statslog.h", |
| 73 | tools: ["stats-log-api-gen"], |
| 74 | cmd: "$(location stats-log-api-gen) --header $(genDir)/statslog.h", |
| 75 | out: [ |
| 76 | "statslog.h", |
| 77 | ], |
| 78 | } |
| 79 | |
| 80 | genrule { |
| 81 | name: "statslog.cpp", |
| 82 | tools: ["stats-log-api-gen"], |
| 83 | cmd: "$(location stats-log-api-gen) --cpp $(genDir)/statslog.cpp", |
| 84 | out: [ |
| 85 | "statslog.cpp", |
| 86 | ], |
| 87 | } |
| 88 | |
| 89 | cc_library_shared { |
| 90 | name: "libstatslog", |
| 91 | generated_sources: ["statslog.cpp"], |
| 92 | generated_headers: ["statslog.h"], |
| 93 | export_generated_headers: ["statslog.h"], |
| 94 | shared_libs: [ |
| 95 | "liblog", |
| 96 | ], |
| 97 | } |
| 98 | |