Lorenzo Colitti | 84485a4 | 2018-12-18 19:16:12 +0900 | [diff] [blame] | 1 | cc_library_headers { |
| 2 | name: "libnetd_resolv_headers", |
| 3 | export_include_dirs: ["include"], |
| 4 | } |
| 5 | |
chenbruce | 2e2446c | 2019-06-28 16:37:36 +0800 | [diff] [blame] | 6 | //For the test to use |
| 7 | //TODO: 1. Need to Refactor ResolverStats related code(ex: ResolverController::getDnsInfo). |
| 8 | // Then removing this library header file. |
| 9 | // 2. Change the imports path in netd/TEST_MAPPING after migrating from |
| 10 | // system/netd/resolv to packages/modules/resolv. |
| 11 | cc_library_headers { |
| 12 | name: "libnetd_resolv_internal_headers", |
| 13 | export_include_dirs: ["."], |
| 14 | } |
| 15 | |
Luke Huang | 403c044 | 2019-02-25 15:33:42 +0800 | [diff] [blame] | 16 | aidl_interface { |
| 17 | name: "dnsresolver_aidl_interface", |
| 18 | local_include_dir: "binder", |
| 19 | srcs: [ |
| 20 | "binder/android/net/IDnsResolver.aidl", |
waynema | 3725518 | 2019-03-18 13:22:56 +0800 | [diff] [blame] | 21 | "binder/android/net/ResolverParamsParcel.aidl", |
Luke Huang | 403c044 | 2019-02-25 15:33:42 +0800 | [diff] [blame] | 22 | ], |
Hungming Chen | a32c8c1 | 2019-01-25 10:47:40 +0800 | [diff] [blame] | 23 | imports: [ |
| 24 | "netd_event_listener_interface", |
| 25 | ], |
Luke Huang | 598daad | 2019-05-02 18:10:15 +0800 | [diff] [blame] | 26 | backend: { |
| 27 | ndk: { |
| 28 | gen_log: true, |
| 29 | }, |
| 30 | }, |
Lorenzo Colitti | 5af19eb | 2019-05-22 15:34:53 +0900 | [diff] [blame] | 31 | api_dir: "aidl/dnsresolver", |
Luke Huang | 5aa6a99 | 2019-04-29 22:02:11 +0800 | [diff] [blame] | 32 | versions: [ |
| 33 | "1", |
| 34 | "2", |
| 35 | ], |
Luke Huang | 403c044 | 2019-02-25 15:33:42 +0800 | [diff] [blame] | 36 | } |
| 37 | |
Lorenzo Colitti | 8505af4 | 2018-12-19 20:30:41 +0900 | [diff] [blame] | 38 | cc_library { |
Bernie Innocenti | afaacf7 | 2018-08-30 07:34:37 +0900 | [diff] [blame] | 39 | name: "libnetd_resolv", |
Bernie Innocenti | 1e88674 | 2018-10-25 18:41:47 +0900 | [diff] [blame] | 40 | version_script: "libnetd_resolv.map.txt", |
Bernie Innocenti | afaacf7 | 2018-08-30 07:34:37 +0900 | [diff] [blame] | 41 | defaults: ["netd_defaults"], |
| 42 | srcs: [ |
Bernie Innocenti | 9c57593 | 2018-09-07 21:10:25 +0900 | [diff] [blame] | 43 | "getaddrinfo.cpp", |
| 44 | "gethnamaddr.cpp", |
| 45 | "sethostent.cpp", |
| 46 | "res_cache.cpp", |
| 47 | "res_comp.cpp", |
Bernie Innocenti | 9c57593 | 2018-09-07 21:10:25 +0900 | [diff] [blame] | 48 | "res_debug.cpp", |
| 49 | "res_init.cpp", |
| 50 | "res_mkquery.cpp", |
| 51 | "res_query.cpp", |
| 52 | "res_send.cpp", |
| 53 | "res_state.cpp", |
| 54 | "res_stats.cpp", |
Luke Huang | 7b26b20 | 2019-03-28 14:09:24 +0800 | [diff] [blame] | 55 | "Dns64Configuration.cpp", |
Mike Yu | 19108d5 | 2018-11-15 21:58:19 +0800 | [diff] [blame] | 56 | "DnsProxyListener.cpp", |
Luke Huang | 36796f3 | 2019-03-13 02:54:45 +0800 | [diff] [blame] | 57 | "DnsResolver.cpp", |
Luke Huang | 403c044 | 2019-02-25 15:33:42 +0800 | [diff] [blame] | 58 | "DnsResolverService.cpp", |
Mike Yu | bab3daa | 2018-10-19 22:11:43 +0800 | [diff] [blame] | 59 | "DnsTlsDispatcher.cpp", |
| 60 | "DnsTlsQueryMap.cpp", |
| 61 | "DnsTlsTransport.cpp", |
| 62 | "DnsTlsServer.cpp", |
| 63 | "DnsTlsSessionCache.cpp", |
| 64 | "DnsTlsSocket.cpp", |
Mike Yu | b601ff7 | 2018-11-01 20:07:00 +0800 | [diff] [blame] | 65 | "PrivateDnsConfiguration.cpp", |
Luke Huang | 7b26b20 | 2019-03-28 14:09:24 +0800 | [diff] [blame] | 66 | "ResolverController.cpp", |
Mike Yu | 39cc689 | 2018-12-14 16:18:27 +0800 | [diff] [blame] | 67 | "ResolverEventReporter.cpp", |
Bernie Innocenti | afaacf7 | 2018-08-30 07:34:37 +0900 | [diff] [blame] | 68 | ], |
Bernie Innocenti | 2a9244c | 2018-09-13 16:12:56 +0900 | [diff] [blame] | 69 | // Link everything statically (except for libc) to minimize our dependence |
| 70 | // on system ABIs |
| 71 | stl: "libc++_static", |
Bernie Innocenti | 9f05f5e | 2018-09-12 23:20:10 +0900 | [diff] [blame] | 72 | static_libs: [ |
waynema | 0e73c2e | 2019-07-31 15:04:08 +0800 | [diff] [blame] | 73 | "dnsresolver_aidl_interface-ndk_platform", |
Bernie Innocenti | 9f05f5e | 2018-09-12 23:20:10 +0900 | [diff] [blame] | 74 | "libbase", |
Mike Yu | b601ff7 | 2018-11-01 20:07:00 +0800 | [diff] [blame] | 75 | "libcrypto", |
Mike Yu | 19108d5 | 2018-11-15 21:58:19 +0800 | [diff] [blame] | 76 | "libcutils", |
Luke Huang | 598daad | 2019-05-02 18:10:15 +0800 | [diff] [blame] | 77 | "libjsoncpp", |
chenbruce | d8e992e | 2019-07-03 14:25:48 +0800 | [diff] [blame] | 78 | "liblog", //Used by libstatslog_resolv |
Mike Yu | bab3daa | 2018-10-19 22:11:43 +0800 | [diff] [blame] | 79 | "libnetdutils", |
Bernie Innocenti | 83a968f | 2019-06-27 14:35:53 +0900 | [diff] [blame] | 80 | "libprotobuf-cpp-lite", |
Mike Yu | bab3daa | 2018-10-19 22:11:43 +0800 | [diff] [blame] | 81 | "libssl", |
lifr | 9b87e36 | 2019-05-08 13:00:14 +0800 | [diff] [blame] | 82 | "libstatslog_resolv", |
| 83 | "libstatssocket", |
Mike Yu | 19108d5 | 2018-11-15 21:58:19 +0800 | [diff] [blame] | 84 | "libsysutils", |
Bernie Innocenti | 83a968f | 2019-06-27 14:35:53 +0900 | [diff] [blame] | 85 | "libutils", // Used by libstatslog_resolv |
Lorenzo Colitti | e2666e0 | 2019-05-23 19:12:26 +0900 | [diff] [blame] | 86 | "netd_event_listener_interface-V1-ndk_platform", |
waynema | a74195e | 2019-01-18 14:02:31 +0800 | [diff] [blame] | 87 | "server_configurable_flags", |
lifr | 9b87e36 | 2019-05-08 13:00:14 +0800 | [diff] [blame] | 88 | "stats_proto", |
Mike Yu | 39cc689 | 2018-12-14 16:18:27 +0800 | [diff] [blame] | 89 | ], |
| 90 | shared_libs: [ |
| 91 | "libbinder_ndk", |
Mike Yu | 19108d5 | 2018-11-15 21:58:19 +0800 | [diff] [blame] | 92 | ], |
Luke Huang | f4c98f2 | 2019-06-14 01:57:00 +0800 | [diff] [blame] | 93 | header_libs: [ |
| 94 | "libnetd_client_headers", |
Mike Yu | bab3daa | 2018-10-19 22:11:43 +0800 | [diff] [blame] | 95 | ], |
Bernie Innocenti | ac18b12 | 2018-10-01 23:10:18 +0900 | [diff] [blame] | 96 | export_include_dirs: ["include"], |
Bernie Innocenti | afaacf7 | 2018-08-30 07:34:37 +0900 | [diff] [blame] | 97 | // TODO: pie in the sky: make this code clang-tidy clean |
Bernie Innocenti | 9f05f5e | 2018-09-12 23:20:10 +0900 | [diff] [blame] | 98 | tidy: false, |
| 99 | product_variables: { |
| 100 | debuggable: { |
| 101 | cppflags: [ |
| 102 | "-DRESOLV_ALLOW_VERBOSE_LOGGING=1", |
waynema | 0e73c2e | 2019-07-31 15:04:08 +0800 | [diff] [blame] | 103 | "-DRESOLV_INJECT_CA_CERTIFICATE=1", |
Bernie Innocenti | 9f05f5e | 2018-09-12 23:20:10 +0900 | [diff] [blame] | 104 | ], |
| 105 | }, |
| 106 | }, |
Bernie Innocenti | afaacf7 | 2018-08-30 07:34:37 +0900 | [diff] [blame] | 107 | } |
Mike Yu | c52739e | 2018-10-19 21:06:32 +0800 | [diff] [blame] | 108 | |
lifr | 9b87e36 | 2019-05-08 13:00:14 +0800 | [diff] [blame] | 109 | cc_library_static { |
| 110 | name: "stats_proto", |
| 111 | defaults: ["netd_defaults"], |
| 112 | proto: { |
| 113 | export_proto_headers: true, |
| 114 | type: "lite", |
| 115 | }, |
| 116 | srcs: [ |
| 117 | "stats.proto", |
| 118 | ], |
| 119 | } |
| 120 | |
| 121 | genrule { |
| 122 | name: "statslog_resolv.h", |
| 123 | tools: ["stats-log-api-gen"], |
| 124 | cmd: "$(location stats-log-api-gen) --header $(genDir)/statslog_resolv.h --module resolv --namespace android,net,stats", |
| 125 | out: [ |
| 126 | "statslog_resolv.h", |
| 127 | ], |
| 128 | } |
| 129 | |
| 130 | genrule { |
| 131 | name: "statslog_resolv.cpp", |
| 132 | tools: ["stats-log-api-gen"], |
| 133 | cmd: "$(location stats-log-api-gen) --cpp $(genDir)/statslog_resolv.cpp --module resolv --namespace android,net,stats --importHeader statslog_resolv.h", |
| 134 | out: [ |
| 135 | "statslog_resolv.cpp", |
| 136 | ], |
| 137 | } |
| 138 | |
| 139 | cc_library_static { |
| 140 | name: "libstatslog_resolv", |
| 141 | generated_sources: ["statslog_resolv.cpp"], |
| 142 | generated_headers: ["statslog_resolv.h"], |
| 143 | defaults: ["netd_defaults"], |
| 144 | export_generated_headers: ["statslog_resolv.h"], |
| 145 | static_libs: [ |
| 146 | "libcutils", |
lifr | 9b87e36 | 2019-05-08 13:00:14 +0800 | [diff] [blame] | 147 | "libstatssocket", |
lifr | 9b87e36 | 2019-05-08 13:00:14 +0800 | [diff] [blame] | 148 | ], |
| 149 | } |
| 150 | |
Mike Yu | c52739e | 2018-10-19 21:06:32 +0800 | [diff] [blame] | 151 | cc_test { |
Ken Chen | b9fa206 | 2018-11-13 21:51:13 +0800 | [diff] [blame] | 152 | name: "resolv_integration_test", |
| 153 | test_suites: ["device-tests"], |
Bernie Innocenti | 45d9baa | 2019-06-19 16:28:05 +0900 | [diff] [blame] | 154 | require_root: true, |
Ken Chen | b9fa206 | 2018-11-13 21:51:13 +0800 | [diff] [blame] | 155 | defaults: ["netd_defaults"], |
Lorenzo Colitti | d8b956a | 2019-06-26 21:30:59 +0900 | [diff] [blame] | 156 | tidy: false, // cuts test build time by > 1m30s |
Ken Chen | b9fa206 | 2018-11-13 21:51:13 +0800 | [diff] [blame] | 157 | srcs: [ |
chenbruce | b43ec75 | 2019-07-24 20:19:41 +0800 | [diff] [blame] | 158 | "tests/dns_responder/dns_responder.cpp", |
Luke Huang | 403c044 | 2019-02-25 15:33:42 +0800 | [diff] [blame] | 159 | "dnsresolver_binder_test.cpp", |
Luke Huang | fde8248 | 2019-06-04 01:04:53 +0800 | [diff] [blame] | 160 | "resolver_test.cpp", |
Ken Chen | b9fa206 | 2018-11-13 21:51:13 +0800 | [diff] [blame] | 161 | ], |
chenbruce | 2e2446c | 2019-06-28 16:37:36 +0800 | [diff] [blame] | 162 | header_libs: [ |
| 163 | "libnetd_resolv_headers", |
Ken Chen | b9fa206 | 2018-11-13 21:51:13 +0800 | [diff] [blame] | 164 | ], |
| 165 | shared_libs: [ |
Lorenzo Colitti | eb9aeec | 2019-06-26 19:53:55 +0900 | [diff] [blame] | 166 | "libbpf_android", |
Ken Chen | b9fa206 | 2018-11-13 21:51:13 +0800 | [diff] [blame] | 167 | "libbase", |
| 168 | "libbinder", |
| 169 | "libcrypto", |
Ken Chen | b9fa206 | 2018-11-13 21:51:13 +0800 | [diff] [blame] | 170 | "libnetd_client", |
| 171 | "libssl", |
| 172 | "libutils", |
Ken Chen | b9fa206 | 2018-11-13 21:51:13 +0800 | [diff] [blame] | 173 | ], |
| 174 | static_libs: [ |
waynema | 0e73c2e | 2019-07-31 15:04:08 +0800 | [diff] [blame] | 175 | "dnsresolver_aidl_interface-cpp", |
Luke Huang | 7b26b20 | 2019-03-28 14:09:24 +0800 | [diff] [blame] | 176 | "libgmock", |
Ken Chen | b9fa206 | 2018-11-13 21:51:13 +0800 | [diff] [blame] | 177 | "libnetd_test_dnsresponder", |
Hungming Chen | a32c8c1 | 2019-01-25 10:47:40 +0800 | [diff] [blame] | 178 | "libnetd_test_metrics_listener", |
Hungming Chen | d52f6b1 | 2019-07-24 16:01:47 +0800 | [diff] [blame] | 179 | "libnetd_test_resolv_utils", |
Ken Chen | b9fa206 | 2018-11-13 21:51:13 +0800 | [diff] [blame] | 180 | "libnetd_test_tun_interface", |
Lorenzo Colitti | eb9aeec | 2019-06-26 19:53:55 +0900 | [diff] [blame] | 181 | "libnetd_test_utils", |
Ken Chen | b9fa206 | 2018-11-13 21:51:13 +0800 | [diff] [blame] | 182 | "libnetdutils", |
Lorenzo Colitti | 800d3f7 | 2019-05-22 12:16:50 +0900 | [diff] [blame] | 183 | "netd_aidl_interface-V2-cpp", |
| 184 | "netd_event_listener_interface-V1-cpp", |
Ken Chen | b9fa206 | 2018-11-13 21:51:13 +0800 | [diff] [blame] | 185 | ], |
| 186 | compile_multilib: "both", |
| 187 | sanitize: { |
| 188 | address: true, |
Lorenzo Colitti | e3419ce | 2019-04-29 10:13:05 +0900 | [diff] [blame] | 189 | recover: ["all"], |
Ken Chen | b9fa206 | 2018-11-13 21:51:13 +0800 | [diff] [blame] | 190 | }, |
| 191 | } |
| 192 | |
| 193 | cc_test { |
| 194 | name: "resolv_unit_test", |
Bernie Innocenti | 4d4071f | 2019-04-03 06:07:02 +0000 | [diff] [blame] | 195 | test_suites: ["device-tests"], |
chenbruce | 609db9d | 2019-06-26 23:30:33 +0800 | [diff] [blame] | 196 | require_root: true, |
| 197 | //TODO: drop root privileges and make it be an real unit test. |
Mike Yu | c52739e | 2018-10-19 21:06:32 +0800 | [diff] [blame] | 198 | defaults: ["netd_defaults"], |
| 199 | srcs: [ |
| 200 | "dns_tls_test.cpp", |
nuccachen | 0efcc80 | 2018-11-28 18:19:39 +0800 | [diff] [blame] | 201 | "libnetd_resolv_test.cpp", |
Mike Yu | d1ec254 | 2019-06-06 17:17:53 +0800 | [diff] [blame] | 202 | "res_cache_test.cpp", |
Mike Yu | c52739e | 2018-10-19 21:06:32 +0800 | [diff] [blame] | 203 | ], |
Mike Yu | c52739e | 2018-10-19 21:06:32 +0800 | [diff] [blame] | 204 | shared_libs: [ |
| 205 | "libbase", |
Mike Yu | b601ff7 | 2018-11-01 20:07:00 +0800 | [diff] [blame] | 206 | "libcrypto", |
Luke Huang | e126fbe | 2019-07-20 17:36:30 +0800 | [diff] [blame] | 207 | "libcutils", |
Mike Yu | bab3daa | 2018-10-19 22:11:43 +0800 | [diff] [blame] | 208 | "libssl", |
Mike Yu | c52739e | 2018-10-19 21:06:32 +0800 | [diff] [blame] | 209 | ], |
nuccachen | 0efcc80 | 2018-11-28 18:19:39 +0800 | [diff] [blame] | 210 | static_libs: [ |
Hungming Chen | 3264747 | 2019-07-05 14:04:51 +0800 | [diff] [blame] | 211 | "dnsresolver_aidl_interface-V2-cpp", |
Luke Huang | e126fbe | 2019-07-20 17:36:30 +0800 | [diff] [blame] | 212 | "libgmock", |
Lorenzo Colitti | 8505af4 | 2018-12-19 20:30:41 +0900 | [diff] [blame] | 213 | "libnetd_resolv", |
nuccachen | 0efcc80 | 2018-11-28 18:19:39 +0800 | [diff] [blame] | 214 | "libnetd_test_dnsresponder", |
Hungming Chen | d52f6b1 | 2019-07-24 16:01:47 +0800 | [diff] [blame] | 215 | "libnetd_test_resolv_utils", |
Lorenzo Colitti | dae6667 | 2018-12-19 21:13:03 +0900 | [diff] [blame] | 216 | "libnetdutils", |
lifr | 9498178 | 2019-05-17 21:15:19 +0800 | [diff] [blame] | 217 | "libprotobuf-cpp-lite", |
waynema | a74195e | 2019-01-18 14:02:31 +0800 | [diff] [blame] | 218 | "server_configurable_flags", |
lifr | 9498178 | 2019-05-17 21:15:19 +0800 | [diff] [blame] | 219 | "stats_proto", |
nuccachen | 0efcc80 | 2018-11-28 18:19:39 +0800 | [diff] [blame] | 220 | ], |
Mike Yu | c52739e | 2018-10-19 21:06:32 +0800 | [diff] [blame] | 221 | } |