blob: 50d5dabe15e5f226bf29145446900a6a8cc917e3 [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 },
Luke Huang5aa6a992019-04-29 22:02:11 +080031 versions: [
32 "1",
33 "2",
Luke Huang0fc985f2019-11-14 19:18:14 +080034 "3",
Luke Huang5aa6a992019-04-29 22:02:11 +080035 ],
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",
Jooyung Han41fa73d2019-11-27 15:41:44 +090041 stubs: {
42 versions: [
43 "1",
44 ],
45 symbol_file: "libnetd_resolv.map.txt",
46 },
Bernie Innocentiafaacf72018-08-30 07:34:37 +090047 defaults: ["netd_defaults"],
48 srcs: [
Bernie Innocenti9c575932018-09-07 21:10:25 +090049 "getaddrinfo.cpp",
50 "gethnamaddr.cpp",
51 "sethostent.cpp",
52 "res_cache.cpp",
53 "res_comp.cpp",
Bernie Innocenti9c575932018-09-07 21:10:25 +090054 "res_debug.cpp",
55 "res_init.cpp",
56 "res_mkquery.cpp",
57 "res_query.cpp",
58 "res_send.cpp",
Bernie Innocenti9c575932018-09-07 21:10:25 +090059 "res_stats.cpp",
Mike Yu021c3e12019-10-08 17:29:34 +080060 "util.cpp",
Luke Huang7b26b202019-03-28 14:09:24 +080061 "Dns64Configuration.cpp",
Mike Yu19108d52018-11-15 21:58:19 +080062 "DnsProxyListener.cpp",
Mike Yu939e3692019-10-29 17:28:34 +080063 "DnsQueryLog.cpp",
Luke Huang36796f32019-03-13 02:54:45 +080064 "DnsResolver.cpp",
Luke Huang403c0442019-02-25 15:33:42 +080065 "DnsResolverService.cpp",
Mike Yue655b1d2019-08-28 17:49:59 +080066 "DnsStats.cpp",
Mike Yubab3daa2018-10-19 22:11:43 +080067 "DnsTlsDispatcher.cpp",
68 "DnsTlsQueryMap.cpp",
69 "DnsTlsTransport.cpp",
70 "DnsTlsServer.cpp",
71 "DnsTlsSessionCache.cpp",
72 "DnsTlsSocket.cpp",
Mike Yub601ff72018-11-01 20:07:00 +080073 "PrivateDnsConfiguration.cpp",
Luke Huang7b26b202019-03-28 14:09:24 +080074 "ResolverController.cpp",
Mike Yu39cc6892018-12-14 16:18:27 +080075 "ResolverEventReporter.cpp",
Bernie Innocentiafaacf72018-08-30 07:34:37 +090076 ],
Tobias Thierer469b6332019-08-28 20:25:33 +010077 // Link most things statically to minimize our dependence on system ABIs.
Bernie Innocenti2a9244c2018-09-13 16:12:56 +090078 stl: "libc++_static",
Bernie Innocenti9f05f5e2018-09-12 23:20:10 +090079 static_libs: [
Jeongik Cha9af2c7e2019-10-15 17:06:40 +090080 "dnsresolver_aidl_interface-unstable-ndk_platform",
Bernie Innocenti9f05f5e2018-09-12 23:20:10 +090081 "libbase",
Mike Yu19108d52018-11-15 21:58:19 +080082 "libcutils",
Luke Huang598daad2019-05-02 18:10:15 +080083 "libjsoncpp",
chenbruced8e992e2019-07-03 14:25:48 +080084 "liblog", //Used by libstatslog_resolv
Mike Yubab3daa2018-10-19 22:11:43 +080085 "libnetdutils",
Bernie Innocenti83a968f2019-06-27 14:35:53 +090086 "libprotobuf-cpp-lite",
lifr9b87e362019-05-08 13:00:14 +080087 "libstatslog_resolv",
88 "libstatssocket",
Mike Yu19108d52018-11-15 21:58:19 +080089 "libsysutils",
Luke Huang0fc985f2019-11-14 19:18:14 +080090 "libutils", // Used by libstatslog_resolv
Jeongik Cha9af2c7e2019-10-15 17:06:40 +090091 "netd_event_listener_interface-ndk_platform",
waynemaa74195e2019-01-18 14:02:31 +080092 "server_configurable_flags",
lifr9b87e362019-05-08 13:00:14 +080093 "stats_proto",
Mike Yu39cc6892018-12-14 16:18:27 +080094 ],
Tobias Thierer469b6332019-08-28 20:25:33 +010095 // libcrypto needs to be used as a shared library because it performs an
96 // integrity check (against a checksum) that is not supported for static
97 // libs. See http://b/141248879
98 // We're also adding libssl here to treat it consistently.
Mike Yu39cc6892018-12-14 16:18:27 +080099 shared_libs: [
100 "libbinder_ndk",
Tobias Thierer469b6332019-08-28 20:25:33 +0100101 "libcrypto",
102 "libssl",
Mike Yu19108d52018-11-15 21:58:19 +0800103 ],
Luke Huangf4c98f22019-06-14 01:57:00 +0800104 header_libs: [
105 "libnetd_client_headers",
Mike Yubab3daa2018-10-19 22:11:43 +0800106 ],
Bernie Innocentiac18b122018-10-01 23:10:18 +0900107 export_include_dirs: ["include"],
chenbruce99cbfd82019-09-05 15:08:13 +0800108
Bernie Innocenti9f05f5e2018-09-12 23:20:10 +0900109 product_variables: {
110 debuggable: {
111 cppflags: [
112 "-DRESOLV_ALLOW_VERBOSE_LOGGING=1",
waynema0e73c2e2019-07-31 15:04:08 +0800113 "-DRESOLV_INJECT_CA_CERTIFICATE=1",
Bernie Innocenti9f05f5e2018-09-12 23:20:10 +0900114 ],
115 },
116 },
Bernie Innocentiafaacf72018-08-30 07:34:37 +0900117}
Mike Yuc52739e2018-10-19 21:06:32 +0800118
lifr9b87e362019-05-08 13:00:14 +0800119cc_library_static {
120 name: "stats_proto",
121 defaults: ["netd_defaults"],
122 proto: {
123 export_proto_headers: true,
124 type: "lite",
125 },
126 srcs: [
127 "stats.proto",
128 ],
129}
130
131genrule {
132 name: "statslog_resolv.h",
133 tools: ["stats-log-api-gen"],
134 cmd: "$(location stats-log-api-gen) --header $(genDir)/statslog_resolv.h --module resolv --namespace android,net,stats",
135 out: [
136 "statslog_resolv.h",
137 ],
138}
139
140genrule {
141 name: "statslog_resolv.cpp",
142 tools: ["stats-log-api-gen"],
143 cmd: "$(location stats-log-api-gen) --cpp $(genDir)/statslog_resolv.cpp --module resolv --namespace android,net,stats --importHeader statslog_resolv.h",
144 out: [
145 "statslog_resolv.cpp",
146 ],
147}
148
149cc_library_static {
150 name: "libstatslog_resolv",
151 generated_sources: ["statslog_resolv.cpp"],
152 generated_headers: ["statslog_resolv.h"],
153 defaults: ["netd_defaults"],
154 export_generated_headers: ["statslog_resolv.h"],
155 static_libs: [
156 "libcutils",
lifr9b87e362019-05-08 13:00:14 +0800157 "libstatssocket",
lifr9b87e362019-05-08 13:00:14 +0800158 ],
159}
160
Luke Huangf8215372019-11-22 11:53:41 +0800161// TODO: Move this test to tests/
Ken Chenb9fa2062018-11-13 21:51:13 +0800162cc_test {
163 name: "resolv_unit_test",
Bernie Innocenti4d4071f2019-04-03 06:07:02 +0000164 test_suites: ["device-tests"],
chenbruce609db9d2019-06-26 23:30:33 +0800165 require_root: true,
166 //TODO: drop root privileges and make it be an real unit test.
Mike Yuc52739e2018-10-19 21:06:32 +0800167 defaults: ["netd_defaults"],
168 srcs: [
waynemae9302592019-08-15 14:50:58 +0800169 "resolv_cache_unit_test.cpp",
chenbruce98f19c22019-11-20 14:58:20 +0800170 "resolv_callback_unit_test.cpp",
waynemae9302592019-08-15 14:50:58 +0800171 "resolv_tls_unit_test.cpp",
172 "resolv_unit_test.cpp",
Mike Yue655b1d2019-08-28 17:49:59 +0800173 "DnsStatsTest.cpp",
Mike Yuc52739e2018-10-19 21:06:32 +0800174 ],
Mike Yuc52739e2018-10-19 21:06:32 +0800175 shared_libs: [
176 "libbase",
Mike Yub601ff72018-11-01 20:07:00 +0800177 "libcrypto",
Luke Huange126fbe2019-07-20 17:36:30 +0800178 "libcutils",
Mike Yubab3daa2018-10-19 22:11:43 +0800179 "libssl",
Sehee Parkd975bf32019-08-07 13:21:16 +0900180 "libbinder_ndk",
Mike Yuc52739e2018-10-19 21:06:32 +0800181 ],
nuccachen0efcc802018-11-28 18:19:39 +0800182 static_libs: [
Jeongik Cha9af2c7e2019-10-15 17:06:40 +0900183 "dnsresolver_aidl_interface-cpp",
184 "dnsresolver_aidl_interface-ndk_platform",
185 "netd_event_listener_interface-ndk_platform",
Luke Huange126fbe2019-07-20 17:36:30 +0800186 "libgmock",
Sehee Parkd975bf32019-08-07 13:21:16 +0900187 "liblog",
Lorenzo Colitti8505af42018-12-19 20:30:41 +0900188 "libnetd_resolv",
nuccachen0efcc802018-11-28 18:19:39 +0800189 "libnetd_test_dnsresponder",
Hungming Chend52f6b12019-07-24 16:01:47 +0800190 "libnetd_test_resolv_utils",
Lorenzo Colittidae66672018-12-19 21:13:03 +0900191 "libnetdutils",
lifr94981782019-05-17 21:15:19 +0800192 "libprotobuf-cpp-lite",
chenbruce98f19c22019-11-20 14:58:20 +0800193 "libstatslog_resolv",
194 "libstatssocket",
195 "libsysutils",
196 "libutils",
waynemaa74195e2019-01-18 14:02:31 +0800197 "server_configurable_flags",
lifr94981782019-05-17 21:15:19 +0800198 "stats_proto",
nuccachen0efcc802018-11-28 18:19:39 +0800199 ],
Mike Yuc52739e2018-10-19 21:06:32 +0800200}