blob: 00d73c8ce40781511b5f962991c05097d27ab847 [file] [log] [blame]
Bob Badour07160d82021-02-22 16:09:08 -08001package {
2 default_applicable_licenses: ["packages_modules_DnsResolver_license"],
3}
4
5// Added automatically by a large-scale-change that took the approach of
6// 'apply every license found to every target'. While this makes sure we respect
7// every license restriction, it may not be entirely correct.
8//
9// e.g. GPL in an MIT project might only apply to the contrib/ directory.
10//
11// Please consider splitting the single license below into multiple licenses,
12// taking care not to lose any license_kind information, and overriding the
13// default license using the 'licenses: [...]' property on targets as needed.
14//
15// For unused files, consider creating a 'fileGroup' with "//visibility:private"
16// to attach the license to, and including a comment whether the files may be
17// used in the current project.
18// See: http://go/android-license-faq
19license {
20 name: "packages_modules_DnsResolver_license",
21 visibility: [":__subpackages__"],
22 license_kinds: [
23 "SPDX-license-identifier-Apache-2.0",
24 "SPDX-license-identifier-BSD",
25 "SPDX-license-identifier-ISC",
26 "SPDX-license-identifier-MIT",
27 ],
28 license_text: [
29 "NOTICE",
30 ],
31}
32
Lorenzo Colitti84485a42018-12-18 19:16:12 +090033cc_library_headers {
34 name: "libnetd_resolv_headers",
35 export_include_dirs: ["include"],
36}
37
Bernie Innocenti86890c92020-01-08 21:00:39 +090038// Used only by dns_responder_client_ndk.cpp for ResolverStats.h
39// TODO: refactor stats to use a Parcel and eliminate this dependency
chenbruce2e2446c2019-06-28 16:37:36 +080040cc_library_headers {
41 name: "libnetd_resolv_internal_headers",
42 export_include_dirs: ["."],
43}
44
Luke Huang27616fe2020-05-26 17:31:15 +080045cc_library_headers {
46 name: "dnsproxyd_protocol_headers",
47 export_include_dirs: ["include/dnsproxyd_protocol"],
Remi NGUYEN VAN35e9af02020-11-27 18:59:19 +090048 apex_available: [
49 "//apex_available:platform",
50 "com.android.tethering",
51 ],
Luke Huang27616fe2020-05-26 17:31:15 +080052}
53
Luke Huang403c0442019-02-25 15:33:42 +080054aidl_interface {
55 name: "dnsresolver_aidl_interface",
56 local_include_dir: "binder",
57 srcs: [
58 "binder/android/net/IDnsResolver.aidl",
chenbrucefd837fa2019-10-29 18:35:36 +080059 "binder/android/net/ResolverHostsParcel.aidl",
Ken Chena6ac2a62020-04-07 17:25:56 +080060 "binder/android/net/ResolverOptionsParcel.aidl",
waynema37255182019-03-18 13:22:56 +080061 "binder/android/net/ResolverParamsParcel.aidl",
paulhub6d71b62020-11-17 00:29:29 +080062 // New AIDL classes should go into android.net.resolv.aidl so they can be clearly identified
63 "binder/android/net/resolv/aidl/**/*.aidl",
Luke Huang403c0442019-02-25 15:33:42 +080064 ],
Hungming Chena32c8c12019-01-25 10:47:40 +080065 imports: [
66 "netd_event_listener_interface",
67 ],
Luke Huang598daad2019-05-02 18:10:15 +080068 backend: {
chenbruce66ba90d2020-02-25 14:53:39 +080069 java: {
70 apex_available: [
Jiyong Park27b9a8a2020-04-07 16:37:01 +090071 "//apex_available:platform",
chenbruce76035f62020-03-16 00:12:59 +080072 "com.android.bluetooth.updatable",
chenbruce66ba90d2020-02-25 14:53:39 +080073 "com.android.wifi",
74 ],
75 },
Luke Huang598daad2019-05-02 18:10:15 +080076 ndk: {
77 gen_log: true,
Jiyong Parkf29f09b2020-04-08 23:39:45 +090078 apex_available: [
79 "com.android.resolv",
80 ],
Jooyung Han105a9bc2020-04-16 18:48:33 +090081 min_sdk_version: "29",
Luke Huang598daad2019-05-02 18:10:15 +080082 },
83 },
Luke Huang5aa6a992019-04-29 22:02:11 +080084 versions: [
85 "1",
86 "2",
Luke Huang0fc985f2019-11-14 19:18:14 +080087 "3",
Luke Huange1ddf092020-04-08 01:41:02 +080088 "4",
Lorenzo Colittia126c242020-05-21 18:07:40 +090089 "5",
Ken Chenb52a7812020-06-19 17:19:07 +080090 "6",
paulhub6d71b62020-11-17 00:29:29 +080091 "7",
Luke Huang5aa6a992019-04-29 22:02:11 +080092 ],
Luke Huang403c0442019-02-25 15:33:42 +080093}
94
Luke Huang45b761c2020-03-20 22:30:43 +080095cc_defaults {
96 name: "resolv_test_defaults",
97 // Note that, static link liblog and libbase is a hard requirement for resolv related tests
98 // because libbase is not compatible between Q and R for general platform build due
99 // to its log revelant functions changing. And most of resolv related tests must be able to run
100 // in Q.
101 static_libs: [
102 "libbase",
103 "liblog",
104 ],
105}
106
Luke Huang0b6c4932020-03-27 17:40:07 +0800107cc_defaults {
108 // This is necessary to have the coverage tests run on cf_x86_phone.
109 // Because the test_suite target is 64 bit and the test infra is running the 64 bit test
110 // suite on cf_x86_phone (32-bit) for coverage.
111 // See b/147785146 for details.
112 // TODO: Remove this target after coverage test switched to 64-bit device.
113 name: "resolv_test_mts_coverage_defaults",
114 test_config_template: ":resolv_test_config_template",
115 compile_multilib: "both",
116 multilib: {
117 lib32: {
118 suffix: "32",
119 },
120 lib64: {
121 suffix: "64",
122 },
123 },
124}
125
Lorenzo Colitti8505af42018-12-19 20:30:41 +0900126cc_library {
Bernie Innocentiafaacf72018-08-30 07:34:37 +0900127 name: "libnetd_resolv",
Bernie Innocenti1e886742018-10-25 18:41:47 +0900128 version_script: "libnetd_resolv.map.txt",
Jooyung Han41fa73d2019-11-27 15:41:44 +0900129 stubs: {
130 versions: [
131 "1",
132 ],
133 symbol_file: "libnetd_resolv.map.txt",
134 },
Bernie Innocentiafaacf72018-08-30 07:34:37 +0900135 defaults: ["netd_defaults"],
136 srcs: [
Bernie Innocenti9c575932018-09-07 21:10:25 +0900137 "getaddrinfo.cpp",
138 "gethnamaddr.cpp",
139 "sethostent.cpp",
140 "res_cache.cpp",
141 "res_comp.cpp",
Bernie Innocenti9c575932018-09-07 21:10:25 +0900142 "res_debug.cpp",
Bernie Innocenti9c575932018-09-07 21:10:25 +0900143 "res_mkquery.cpp",
144 "res_query.cpp",
145 "res_send.cpp",
Bernie Innocenti9c575932018-09-07 21:10:25 +0900146 "res_stats.cpp",
Mike Yu021c3e12019-10-08 17:29:34 +0800147 "util.cpp",
Luke Huang7b26b202019-03-28 14:09:24 +0800148 "Dns64Configuration.cpp",
Mike Yu19108d52018-11-15 21:58:19 +0800149 "DnsProxyListener.cpp",
Mike Yu939e3692019-10-29 17:28:34 +0800150 "DnsQueryLog.cpp",
Luke Huang36796f32019-03-13 02:54:45 +0800151 "DnsResolver.cpp",
Luke Huang403c0442019-02-25 15:33:42 +0800152 "DnsResolverService.cpp",
Mike Yue655b1d2019-08-28 17:49:59 +0800153 "DnsStats.cpp",
Mike Yubab3daa2018-10-19 22:11:43 +0800154 "DnsTlsDispatcher.cpp",
155 "DnsTlsQueryMap.cpp",
156 "DnsTlsTransport.cpp",
157 "DnsTlsServer.cpp",
158 "DnsTlsSessionCache.cpp",
159 "DnsTlsSocket.cpp",
Luke Huangf40df9c2020-04-21 08:51:48 +0800160 "Experiments.cpp",
Mike Yub601ff72018-11-01 20:07:00 +0800161 "PrivateDnsConfiguration.cpp",
Luke Huang7b26b202019-03-28 14:09:24 +0800162 "ResolverController.cpp",
Mike Yu39cc6892018-12-14 16:18:27 +0800163 "ResolverEventReporter.cpp",
Bernie Innocentiafaacf72018-08-30 07:34:37 +0900164 ],
Tobias Thierer469b6332019-08-28 20:25:33 +0100165 // Link most things statically to minimize our dependence on system ABIs.
Bernie Innocenti2a9244c2018-09-13 16:12:56 +0900166 stl: "libc++_static",
Bernie Innocenti9f05f5e2018-09-12 23:20:10 +0900167 static_libs: [
Maciej Żenczykowski3d809362020-06-03 11:49:26 -0700168 "dnsresolver_aidl_interface-unstable-ndk_platform",
Bernie Innocenti9f05f5e2018-09-12 23:20:10 +0900169 "libbase",
Mike Yu19108d52018-11-15 21:58:19 +0800170 "libcutils",
Mike Yubab3daa2018-10-19 22:11:43 +0800171 "libnetdutils",
Bernie Innocenti83a968f2019-06-27 14:35:53 +0900172 "libprotobuf-cpp-lite",
lifr9b87e362019-05-08 13:00:14 +0800173 "libstatslog_resolv",
Muhammad Qureshi10b3d272019-12-03 15:25:19 -0800174 "libstatspush_compat",
Mike Yu19108d52018-11-15 21:58:19 +0800175 "libsysutils",
Jeongik Cha144af032020-08-14 23:13:11 +0900176 "netd_event_listener_interface-unstable-ndk_platform",
waynemaa74195e2019-01-18 14:02:31 +0800177 "server_configurable_flags",
lifr9b87e362019-05-08 13:00:14 +0800178 "stats_proto",
Mike Yu39cc6892018-12-14 16:18:27 +0800179 ],
Tobias Thierer469b6332019-08-28 20:25:33 +0100180 // libcrypto needs to be used as a shared library because it performs an
181 // integrity check (against a checksum) that is not supported for static
182 // libs. See http://b/141248879
183 // We're also adding libssl here to treat it consistently.
Jiyong Parkdd938dd2020-03-09 14:35:37 +0900184 // liblog is added as a shared library because it provides stable C API
185 // from the platform; we don't need to include it in this module by
186 // statically linking to it. Doing so is even dangerous because the socket
187 // protocol to logd implemented in the library isn't guaranteed to be
188 // stable. See b/151051671
Mike Yu39cc6892018-12-14 16:18:27 +0800189 shared_libs: [
190 "libbinder_ndk",
Tobias Thierer469b6332019-08-28 20:25:33 +0100191 "libcrypto",
Jiyong Parkdd938dd2020-03-09 14:35:37 +0900192 "liblog", //Used by libstatslog_resolv
Tobias Thierer469b6332019-08-28 20:25:33 +0100193 "libssl",
Mike Yu19108d52018-11-15 21:58:19 +0800194 ],
Luke Huangf4c98f22019-06-14 01:57:00 +0800195 header_libs: [
Luke Huang27616fe2020-05-26 17:31:15 +0800196 "libnetdbinder_utils_headers",
Mike Yubab3daa2018-10-19 22:11:43 +0800197 ],
Ruchir Rastogicf96e8b2020-02-26 10:36:18 -0800198 runtime_libs: [
199 // Causes the linkerconfig to create a namespace link from resolv to the
200 // libstatssocket library within the statsd apex
201 "libstatssocket",
202 ],
Bernie Innocentiac18b122018-10-01 23:10:18 +0900203 export_include_dirs: ["include"],
chenbruce99cbfd82019-09-05 15:08:13 +0800204
Bernie Innocenti9f05f5e2018-09-12 23:20:10 +0900205 product_variables: {
206 debuggable: {
207 cppflags: [
208 "-DRESOLV_ALLOW_VERBOSE_LOGGING=1",
209 ],
210 },
211 },
Ken Chen4961dfe2019-11-15 09:03:29 +0800212 header_abi_checker: {
213 enabled: true,
214 symbol_file: "libnetd_resolv.map.txt",
215 },
Ken Chenf5573fd2020-01-14 01:51:05 +0800216 sanitize: {
217 cfi: true,
Ken Chenf5573fd2020-01-14 01:51:05 +0800218 },
Jiyong Parkf29f09b2020-04-08 23:39:45 +0900219 apex_available: ["com.android.resolv"],
Jooyung Han105a9bc2020-04-16 18:48:33 +0900220 min_sdk_version: "29",
Bernie Innocentiafaacf72018-08-30 07:34:37 +0900221}
Mike Yuc52739e2018-10-19 21:06:32 +0800222
lifr9b87e362019-05-08 13:00:14 +0800223cc_library_static {
224 name: "stats_proto",
225 defaults: ["netd_defaults"],
226 proto: {
227 export_proto_headers: true,
228 type: "lite",
229 },
230 srcs: [
231 "stats.proto",
232 ],
Jiyong Parkf29f09b2020-04-08 23:39:45 +0900233 apex_available: ["com.android.resolv"],
Jooyung Han105a9bc2020-04-16 18:48:33 +0900234 min_sdk_version: "29",
lifr9b87e362019-05-08 13:00:14 +0800235}
236
237genrule {
238 name: "statslog_resolv.h",
239 tools: ["stats-log-api-gen"],
240 cmd: "$(location stats-log-api-gen) --header $(genDir)/statslog_resolv.h --module resolv --namespace android,net,stats",
241 out: [
242 "statslog_resolv.h",
243 ],
244}
245
246genrule {
247 name: "statslog_resolv.cpp",
248 tools: ["stats-log-api-gen"],
Muhammad Qureshi10b3d272019-12-03 15:25:19 -0800249 cmd: "$(location stats-log-api-gen) --cpp $(genDir)/statslog_resolv.cpp --module resolv --namespace android,net,stats --importHeader statslog_resolv.h --supportQ",
lifr9b87e362019-05-08 13:00:14 +0800250 out: [
251 "statslog_resolv.cpp",
252 ],
253}
254
255cc_library_static {
256 name: "libstatslog_resolv",
257 generated_sources: ["statslog_resolv.cpp"],
258 generated_headers: ["statslog_resolv.h"],
259 defaults: ["netd_defaults"],
260 export_generated_headers: ["statslog_resolv.h"],
261 static_libs: [
262 "libcutils",
Muhammad Qureshi10b3d272019-12-03 15:25:19 -0800263 "libgtest_prod", // Used by libstatspush_compat
264 "libstatspush_compat",
lifr9b87e362019-05-08 13:00:14 +0800265 ],
Jiyong Parkf29f09b2020-04-08 23:39:45 +0900266 apex_available: ["com.android.resolv"],
Jooyung Han105a9bc2020-04-16 18:48:33 +0900267 min_sdk_version: "29",
lifr9b87e362019-05-08 13:00:14 +0800268}
269
Luke Huang6b7ff612020-03-25 15:23:41 +0800270filegroup {
271 name: "resolv_test_config_template",
272 srcs: [
273 "resolv_test_config_template.xml",
274 ],
275}
276
Luke Huangf8215372019-11-22 11:53:41 +0800277// TODO: Move this test to tests/
Ken Chenb9fa2062018-11-13 21:51:13 +0800278cc_test {
279 name: "resolv_unit_test",
Luke Huange1ddf092020-04-08 01:41:02 +0800280 test_suites: [
Luke Huang46799392020-07-08 16:58:33 +0800281 "general-tests",
Kimberly Kreiderc4260f52020-12-15 10:54:30 -0800282 "mts-dnsresolver",
Luke Huange1ddf092020-04-08 01:41:02 +0800283 ],
chenbruce609db9d2019-06-26 23:30:33 +0800284 require_root: true,
Luke Huang0b6c4932020-03-27 17:40:07 +0800285 // TODO: Drop root privileges and make it be an real unit test.
286 // TODO: Remove resolv_test_mts_coverage_defaults after mts coverage switched to 64-bit device.
Luke Huange1ddf092020-04-08 01:41:02 +0800287 defaults: [
288 "netd_defaults",
289 "resolv_test_defaults",
290 "resolv_test_mts_coverage_defaults",
291 ],
Mike Yuc52739e2018-10-19 21:06:32 +0800292 srcs: [
waynemae9302592019-08-15 14:50:58 +0800293 "resolv_cache_unit_test.cpp",
chenbruce98f19c22019-11-20 14:58:20 +0800294 "resolv_callback_unit_test.cpp",
waynemae9302592019-08-15 14:50:58 +0800295 "resolv_tls_unit_test.cpp",
296 "resolv_unit_test.cpp",
Mike Yu39df0b12019-10-31 16:12:23 +0800297 "DnsQueryLogTest.cpp",
Luke Huangf40df9c2020-04-21 08:51:48 +0800298 "DnsStatsTest.cpp",
299 "ExperimentsTest.cpp",
Bernie Innocentiac6c9a42020-11-27 21:57:41 +0900300 "OperationLimiterTest.cpp",
Mike Yu0ee1dc92020-11-09 14:56:54 +0800301 "PrivateDnsConfigurationTest.cpp",
Mike Yuc52739e2018-10-19 21:06:32 +0800302 ],
Mike Yuc52739e2018-10-19 21:06:32 +0800303 shared_libs: [
Mike Yub601ff72018-11-01 20:07:00 +0800304 "libcrypto",
Sehee Parkd975bf32019-08-07 13:21:16 +0900305 "libbinder_ndk",
Luke Huang0b564a22020-03-19 11:33:59 +0800306 "libssl",
Mike Yuc52739e2018-10-19 21:06:32 +0800307 ],
nuccachen0efcc802018-11-28 18:19:39 +0800308 static_libs: [
Luke Huangf871e4f2020-05-27 18:54:13 +0800309 "dnsresolver_aidl_interface-unstable-ndk_platform",
Luke Huangeb618ef2020-05-26 14:17:02 +0800310 "netd_aidl_interface-ndk_platform",
Jeongik Cha144af032020-08-14 23:13:11 +0900311 "netd_event_listener_interface-unstable-ndk_platform",
Luke Huang0b564a22020-03-19 11:33:59 +0800312 "libcutils",
Luke Huange126fbe2019-07-20 17:36:30 +0800313 "libgmock",
Lorenzo Colitti8505af42018-12-19 20:30:41 +0900314 "libnetd_resolv",
Luke Huang39757932020-04-17 19:04:21 +0800315 "libnetd_test_dnsresponder_ndk",
Hungming Chend52f6b12019-07-24 16:01:47 +0800316 "libnetd_test_resolv_utils",
Lorenzo Colittidae66672018-12-19 21:13:03 +0900317 "libnetdutils",
lifr94981782019-05-17 21:15:19 +0800318 "libprotobuf-cpp-lite",
chenbruce98f19c22019-11-20 14:58:20 +0800319 "libstatslog_resolv",
Muhammad Qureshi2361d132020-01-19 07:06:45 -0800320 "libstatspush_compat",
chenbruce98f19c22019-11-20 14:58:20 +0800321 "libsysutils",
322 "libutils",
Luke Huang977e46e2019-07-04 15:33:07 +0800323 "resolv_stats_test_utils",
waynemaa74195e2019-01-18 14:02:31 +0800324 "server_configurable_flags",
lifr94981782019-05-17 21:15:19 +0800325 "stats_proto",
nuccachen0efcc802018-11-28 18:19:39 +0800326 ],
Mike Yuc52739e2018-10-19 21:06:32 +0800327}