blob: a8e2af9e9c2ab0ae282112d765957c90d61a0bd0 [file] [log] [blame]
Lorenzo Colitti84485a42018-12-18 19:16:12 +09001cc_library_headers {
2 name: "libnetd_resolv_headers",
3 export_include_dirs: ["include"],
4}
5
chenbruce2e2446c2019-06-28 16:37:36 +08006//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.
11cc_library_headers {
12 name: "libnetd_resolv_internal_headers",
13 export_include_dirs: ["."],
14}
15
Luke Huang403c0442019-02-25 15:33:42 +080016aidl_interface {
17 name: "dnsresolver_aidl_interface",
18 local_include_dir: "binder",
19 srcs: [
20 "binder/android/net/IDnsResolver.aidl",
waynema37255182019-03-18 13:22:56 +080021 "binder/android/net/ResolverParamsParcel.aidl",
Luke Huang403c0442019-02-25 15:33:42 +080022 ],
Hungming Chena32c8c12019-01-25 10:47:40 +080023 imports: [
24 "netd_event_listener_interface",
25 ],
Luke Huang598daad2019-05-02 18:10:15 +080026 backend: {
27 ndk: {
28 gen_log: true,
29 },
30 },
Lorenzo Colitti5af19eb2019-05-22 15:34:53 +090031 api_dir: "aidl/dnsresolver",
Luke Huang5aa6a992019-04-29 22:02:11 +080032 versions: [
33 "1",
34 "2",
35 ],
Luke Huang403c0442019-02-25 15:33:42 +080036}
37
Lorenzo Colitti8505af42018-12-19 20:30:41 +090038cc_library {
Bernie Innocentiafaacf72018-08-30 07:34:37 +090039 name: "libnetd_resolv",
Bernie Innocenti1e886742018-10-25 18:41:47 +090040 version_script: "libnetd_resolv.map.txt",
Bernie Innocentiafaacf72018-08-30 07:34:37 +090041 defaults: ["netd_defaults"],
42 srcs: [
Bernie Innocenti9c575932018-09-07 21:10:25 +090043 "getaddrinfo.cpp",
44 "gethnamaddr.cpp",
45 "sethostent.cpp",
46 "res_cache.cpp",
47 "res_comp.cpp",
Bernie Innocenti9c575932018-09-07 21:10:25 +090048 "res_debug.cpp",
49 "res_init.cpp",
50 "res_mkquery.cpp",
51 "res_query.cpp",
52 "res_send.cpp",
Bernie Innocenti9c575932018-09-07 21:10:25 +090053 "res_stats.cpp",
Mike Yu021c3e12019-10-08 17:29:34 +080054 "util.cpp",
Luke Huang7b26b202019-03-28 14:09:24 +080055 "Dns64Configuration.cpp",
Mike Yu19108d52018-11-15 21:58:19 +080056 "DnsProxyListener.cpp",
Luke Huang36796f32019-03-13 02:54:45 +080057 "DnsResolver.cpp",
Luke Huang403c0442019-02-25 15:33:42 +080058 "DnsResolverService.cpp",
Mike Yue655b1d2019-08-28 17:49:59 +080059 "DnsStats.cpp",
Mike Yubab3daa2018-10-19 22:11:43 +080060 "DnsTlsDispatcher.cpp",
61 "DnsTlsQueryMap.cpp",
62 "DnsTlsTransport.cpp",
63 "DnsTlsServer.cpp",
64 "DnsTlsSessionCache.cpp",
65 "DnsTlsSocket.cpp",
Mike Yub601ff72018-11-01 20:07:00 +080066 "PrivateDnsConfiguration.cpp",
Luke Huang7b26b202019-03-28 14:09:24 +080067 "ResolverController.cpp",
Mike Yu39cc6892018-12-14 16:18:27 +080068 "ResolverEventReporter.cpp",
Bernie Innocentiafaacf72018-08-30 07:34:37 +090069 ],
Tobias Thierer469b6332019-08-28 20:25:33 +010070 // Link most things statically to minimize our dependence on system ABIs.
Bernie Innocenti2a9244c2018-09-13 16:12:56 +090071 stl: "libc++_static",
Bernie Innocenti9f05f5e2018-09-12 23:20:10 +090072 static_libs: [
Jeongik Cha9af2c7e2019-10-15 17:06:40 +090073 "dnsresolver_aidl_interface-unstable-ndk_platform",
Bernie Innocenti9f05f5e2018-09-12 23:20:10 +090074 "libbase",
Mike Yu19108d52018-11-15 21:58:19 +080075 "libcutils",
Luke Huang598daad2019-05-02 18:10:15 +080076 "libjsoncpp",
chenbruced8e992e2019-07-03 14:25:48 +080077 "liblog", //Used by libstatslog_resolv
Mike Yubab3daa2018-10-19 22:11:43 +080078 "libnetdutils",
Bernie Innocenti83a968f2019-06-27 14:35:53 +090079 "libprotobuf-cpp-lite",
lifr9b87e362019-05-08 13:00:14 +080080 "libstatslog_resolv",
81 "libstatssocket",
Mike Yu19108d52018-11-15 21:58:19 +080082 "libsysutils",
Bernie Innocenti83a968f2019-06-27 14:35:53 +090083 "libutils", // Used by libstatslog_resolv
Jeongik Cha9af2c7e2019-10-15 17:06:40 +090084 "netd_event_listener_interface-ndk_platform",
waynemaa74195e2019-01-18 14:02:31 +080085 "server_configurable_flags",
lifr9b87e362019-05-08 13:00:14 +080086 "stats_proto",
Mike Yu39cc6892018-12-14 16:18:27 +080087 ],
Tobias Thierer469b6332019-08-28 20:25:33 +010088 // libcrypto needs to be used as a shared library because it performs an
89 // integrity check (against a checksum) that is not supported for static
90 // libs. See http://b/141248879
91 // We're also adding libssl here to treat it consistently.
Mike Yu39cc6892018-12-14 16:18:27 +080092 shared_libs: [
93 "libbinder_ndk",
Tobias Thierer469b6332019-08-28 20:25:33 +010094 "libcrypto",
95 "libssl",
Mike Yu19108d52018-11-15 21:58:19 +080096 ],
Luke Huangf4c98f22019-06-14 01:57:00 +080097 header_libs: [
98 "libnetd_client_headers",
Mike Yubab3daa2018-10-19 22:11:43 +080099 ],
Bernie Innocentiac18b122018-10-01 23:10:18 +0900100 export_include_dirs: ["include"],
chenbruce99cbfd82019-09-05 15:08:13 +0800101
Bernie Innocenti9f05f5e2018-09-12 23:20:10 +0900102 product_variables: {
103 debuggable: {
104 cppflags: [
105 "-DRESOLV_ALLOW_VERBOSE_LOGGING=1",
waynema0e73c2e2019-07-31 15:04:08 +0800106 "-DRESOLV_INJECT_CA_CERTIFICATE=1",
Bernie Innocenti9f05f5e2018-09-12 23:20:10 +0900107 ],
108 },
109 },
Bernie Innocentiafaacf72018-08-30 07:34:37 +0900110}
Mike Yuc52739e2018-10-19 21:06:32 +0800111
lifr9b87e362019-05-08 13:00:14 +0800112cc_library_static {
113 name: "stats_proto",
114 defaults: ["netd_defaults"],
115 proto: {
116 export_proto_headers: true,
117 type: "lite",
118 },
119 srcs: [
120 "stats.proto",
121 ],
122}
123
124genrule {
125 name: "statslog_resolv.h",
126 tools: ["stats-log-api-gen"],
127 cmd: "$(location stats-log-api-gen) --header $(genDir)/statslog_resolv.h --module resolv --namespace android,net,stats",
128 out: [
129 "statslog_resolv.h",
130 ],
131}
132
133genrule {
134 name: "statslog_resolv.cpp",
135 tools: ["stats-log-api-gen"],
136 cmd: "$(location stats-log-api-gen) --cpp $(genDir)/statslog_resolv.cpp --module resolv --namespace android,net,stats --importHeader statslog_resolv.h",
137 out: [
138 "statslog_resolv.cpp",
139 ],
140}
141
142cc_library_static {
143 name: "libstatslog_resolv",
144 generated_sources: ["statslog_resolv.cpp"],
145 generated_headers: ["statslog_resolv.h"],
146 defaults: ["netd_defaults"],
147 export_generated_headers: ["statslog_resolv.h"],
148 static_libs: [
149 "libcutils",
lifr9b87e362019-05-08 13:00:14 +0800150 "libstatssocket",
lifr9b87e362019-05-08 13:00:14 +0800151 ],
152}
153
Mike Yuc52739e2018-10-19 21:06:32 +0800154cc_test {
Ken Chenb9fa2062018-11-13 21:51:13 +0800155 name: "resolv_integration_test",
156 test_suites: ["device-tests"],
Bernie Innocenti45d9baa2019-06-19 16:28:05 +0900157 require_root: true,
Ken Chenb9fa2062018-11-13 21:51:13 +0800158 defaults: ["netd_defaults"],
Lorenzo Colittid8b956a2019-06-26 21:30:59 +0900159 tidy: false, // cuts test build time by > 1m30s
Ken Chenb9fa2062018-11-13 21:51:13 +0800160 srcs: [
chenbruceb43ec752019-07-24 20:19:41 +0800161 "tests/dns_responder/dns_responder.cpp",
Luke Huang403c0442019-02-25 15:33:42 +0800162 "dnsresolver_binder_test.cpp",
waynemae9302592019-08-15 14:50:58 +0800163 "resolv_integration_test.cpp",
Ken Chenb9fa2062018-11-13 21:51:13 +0800164 ],
chenbruce2e2446c2019-06-28 16:37:36 +0800165 header_libs: [
166 "libnetd_resolv_headers",
Ken Chenb9fa2062018-11-13 21:51:13 +0800167 ],
168 shared_libs: [
Lorenzo Colittieb9aeec2019-06-26 19:53:55 +0900169 "libbpf_android",
Ken Chenb9fa2062018-11-13 21:51:13 +0800170 "libbinder",
171 "libcrypto",
Yi Kong584262c2019-08-25 00:46:02 -0700172 "liblog",
Ken Chenb9fa2062018-11-13 21:51:13 +0800173 "libnetd_client",
174 "libssl",
175 "libutils",
Ken Chenb9fa2062018-11-13 21:51:13 +0800176 ],
177 static_libs: [
Jeongik Cha9af2c7e2019-10-15 17:06:40 +0900178 "dnsresolver_aidl_interface-unstable-cpp",
Yi Kong584262c2019-08-25 00:46:02 -0700179 "libbase",
Luke Huang7b26b202019-03-28 14:09:24 +0800180 "libgmock",
Ken Chenb9fa2062018-11-13 21:51:13 +0800181 "libnetd_test_dnsresponder",
Hungming Chena32c8c12019-01-25 10:47:40 +0800182 "libnetd_test_metrics_listener",
Hungming Chend52f6b12019-07-24 16:01:47 +0800183 "libnetd_test_resolv_utils",
Ken Chenb9fa2062018-11-13 21:51:13 +0800184 "libnetd_test_tun_interface",
Lorenzo Colittieb9aeec2019-06-26 19:53:55 +0900185 "libnetd_test_utils",
Ken Chenb9fa2062018-11-13 21:51:13 +0800186 "libnetdutils",
Jeongik Cha9af2c7e2019-10-15 17:06:40 +0900187 "netd_aidl_interface-cpp",
188 "netd_event_listener_interface-cpp",
Ken Chenb9fa2062018-11-13 21:51:13 +0800189 ],
190 compile_multilib: "both",
191 sanitize: {
192 address: true,
Lorenzo Colittie3419ce2019-04-29 10:13:05 +0900193 recover: ["all"],
Ken Chenb9fa2062018-11-13 21:51:13 +0800194 },
195}
196
197cc_test {
198 name: "resolv_unit_test",
Bernie Innocenti4d4071f2019-04-03 06:07:02 +0000199 test_suites: ["device-tests"],
chenbruce609db9d2019-06-26 23:30:33 +0800200 require_root: true,
201 //TODO: drop root privileges and make it be an real unit test.
Mike Yuc52739e2018-10-19 21:06:32 +0800202 defaults: ["netd_defaults"],
203 srcs: [
waynemae9302592019-08-15 14:50:58 +0800204 "resolv_cache_unit_test.cpp",
205 "resolv_tls_unit_test.cpp",
206 "resolv_unit_test.cpp",
Mike Yue655b1d2019-08-28 17:49:59 +0800207 "DnsStatsTest.cpp",
Mike Yuc52739e2018-10-19 21:06:32 +0800208 ],
Mike Yuc52739e2018-10-19 21:06:32 +0800209 shared_libs: [
210 "libbase",
Mike Yub601ff72018-11-01 20:07:00 +0800211 "libcrypto",
Luke Huange126fbe2019-07-20 17:36:30 +0800212 "libcutils",
Mike Yubab3daa2018-10-19 22:11:43 +0800213 "libssl",
Sehee Parkd975bf32019-08-07 13:21:16 +0900214 "libbinder_ndk",
Mike Yuc52739e2018-10-19 21:06:32 +0800215 ],
nuccachen0efcc802018-11-28 18:19:39 +0800216 static_libs: [
Jeongik Cha9af2c7e2019-10-15 17:06:40 +0900217 "dnsresolver_aidl_interface-cpp",
218 "dnsresolver_aidl_interface-ndk_platform",
219 "netd_event_listener_interface-ndk_platform",
Luke Huange126fbe2019-07-20 17:36:30 +0800220 "libgmock",
Sehee Parkd975bf32019-08-07 13:21:16 +0900221 "liblog",
Lorenzo Colitti8505af42018-12-19 20:30:41 +0900222 "libnetd_resolv",
nuccachen0efcc802018-11-28 18:19:39 +0800223 "libnetd_test_dnsresponder",
Hungming Chend52f6b12019-07-24 16:01:47 +0800224 "libnetd_test_resolv_utils",
Lorenzo Colittidae66672018-12-19 21:13:03 +0900225 "libnetdutils",
lifr94981782019-05-17 21:15:19 +0800226 "libprotobuf-cpp-lite",
waynemaa74195e2019-01-18 14:02:31 +0800227 "server_configurable_flags",
lifr94981782019-05-17 21:15:19 +0800228 "stats_proto",
nuccachen0efcc802018-11-28 18:19:39 +0800229 ],
Mike Yuc52739e2018-10-19 21:06:32 +0800230}