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 | ], |
Chih-Hung Hsieh | ca189f4 | 2017-11-10 15:06:53 -0800 | [diff] [blame] | 26 | cflags: [ |
| 27 | "-Wall", |
| 28 | "-Werror", |
| 29 | ], |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 30 | |
| 31 | shared_libs: [ |
| 32 | "libstats_proto_host", |
| 33 | "libprotobuf-cpp-full", |
Tej Singh | 1f431f3 | 2019-03-07 19:08:52 -0800 | [diff] [blame] | 34 | "libbase", |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 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", |
Yao Chen | 9c1debe | 2018-02-19 14:39:19 -0800 | [diff] [blame] | 66 | "libprotobuf-cpp-full", |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 67 | ], |
| 68 | |
| 69 | proto: { |
| 70 | type: "full", |
Yao Chen | 9c1debe | 2018-02-19 14:39:19 -0800 | [diff] [blame] | 71 | include_dirs: [ |
| 72 | "external/protobuf/src", |
| 73 | ], |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 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 | |
Mitch Phillips | 6bbc91b | 2019-10-21 13:32:14 -0700 | [diff] [blame^] | 98 | cc_library { |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 99 | name: "libstatslog", |
Jack He | 34a892d | 2018-12-20 00:42:31 -0800 | [diff] [blame] | 100 | host_supported: true, |
Yao Chen | d54f9dd | 2017-10-17 17:37:48 +0000 | [diff] [blame] | 101 | generated_sources: ["statslog.cpp"], |
| 102 | generated_headers: ["statslog.h"], |
Yao Chen | 88e8810 | 2018-05-02 09:23:05 -0700 | [diff] [blame] | 103 | cflags: [ |
| 104 | "-Wall", |
| 105 | "-Werror", |
| 106 | ], |
| 107 | export_generated_headers: ["statslog.h"], |
| 108 | shared_libs: [ |
| 109 | "liblog", |
Yao Chen | cf3829a | 2018-06-05 14:20:35 -0700 | [diff] [blame] | 110 | "libcutils", |
Yao Chen | 88e8810 | 2018-05-02 09:23:05 -0700 | [diff] [blame] | 111 | ], |
| 112 | static_libs: ["libstatssocket"], |
Jack He | 34a892d | 2018-12-20 00:42:31 -0800 | [diff] [blame] | 113 | target: { |
| 114 | android: { |
| 115 | shared_libs: [ |
| 116 | "libutils", |
| 117 | ], |
| 118 | }, |
| 119 | host: { |
| 120 | static_libs: [ |
| 121 | "libutils", |
| 122 | ], |
| 123 | }, |
| 124 | }, |
Yao Chen | 88e8810 | 2018-05-02 09:23:05 -0700 | [diff] [blame] | 125 | } |