blob: 049c5202954cf9c6b4c0fa4561407619417f5f15 [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",
Remi NGUYEN VANb5fb4ca2021-03-23 11:18:05 +000047 sdk_version: "29",
48 min_sdk_version: "29",
Luke Huang27616fe2020-05-26 17:31:15 +080049 export_include_dirs: ["include/dnsproxyd_protocol"],
Remi NGUYEN VAN35e9af02020-11-27 18:59:19 +090050 apex_available: [
51 "//apex_available:platform",
52 "com.android.tethering",
53 ],
Luke Huang27616fe2020-05-26 17:31:15 +080054}
55
Lorenzo Colitti5322e032021-08-06 13:19:04 +090056dnsresolver_aidl_interface_lateststable_version = "V9"
Jeongik Chae8fe5a52021-03-05 21:18:33 +090057
58cc_library_static {
Jiyong Parkf5e650b2021-08-04 12:48:08 +090059 name: "dnsresolver_aidl_interface-lateststable-ndk",
Jeongik Chae8fe5a52021-03-05 21:18:33 +090060 whole_static_libs: [
Jiyong Parkf5e650b2021-08-04 12:48:08 +090061 "dnsresolver_aidl_interface-" + dnsresolver_aidl_interface_lateststable_version + "-ndk",
Jeongik Chae8fe5a52021-03-05 21:18:33 +090062 ],
63 apex_available: [
64 "com.android.resolv",
65 ],
66 min_sdk_version: "29",
67}
68
Luke Huang403c0442019-02-25 15:33:42 +080069aidl_interface {
70 name: "dnsresolver_aidl_interface",
71 local_include_dir: "binder",
72 srcs: [
73 "binder/android/net/IDnsResolver.aidl",
chenbrucefd837fa2019-10-29 18:35:36 +080074 "binder/android/net/ResolverHostsParcel.aidl",
Ken Chena6ac2a62020-04-07 17:25:56 +080075 "binder/android/net/ResolverOptionsParcel.aidl",
waynema37255182019-03-18 13:22:56 +080076 "binder/android/net/ResolverParamsParcel.aidl",
paulhub6d71b62020-11-17 00:29:29 +080077 // New AIDL classes should go into android.net.resolv.aidl so they can be clearly identified
78 "binder/android/net/resolv/aidl/**/*.aidl",
Luke Huang403c0442019-02-25 15:33:42 +080079 ],
Hungming Chena32c8c12019-01-25 10:47:40 +080080 imports: [
81 "netd_event_listener_interface",
82 ],
Luke Huang598daad2019-05-02 18:10:15 +080083 backend: {
chenbruce66ba90d2020-02-25 14:53:39 +080084 java: {
85 apex_available: [
chenbruce76035f62020-03-16 00:12:59 +080086 "com.android.bluetooth.updatable",
Remi NGUYEN VANcbc998a2021-03-22 11:17:46 +000087 "com.android.tethering",
chenbruce66ba90d2020-02-25 14:53:39 +080088 "com.android.wifi",
89 ],
Remi NGUYEN VANb5fb4ca2021-03-23 11:18:05 +000090 min_sdk_version: "30",
chenbruce66ba90d2020-02-25 14:53:39 +080091 },
Luke Huang598daad2019-05-02 18:10:15 +080092 ndk: {
93 gen_log: true,
Jiyong Parkf29f09b2020-04-08 23:39:45 +090094 apex_available: [
95 "com.android.resolv",
96 ],
Jooyung Han105a9bc2020-04-16 18:48:33 +090097 min_sdk_version: "29",
Luke Huang598daad2019-05-02 18:10:15 +080098 },
99 },
Luke Huang5aa6a992019-04-29 22:02:11 +0800100 versions: [
101 "1",
102 "2",
Luke Huang0fc985f2019-11-14 19:18:14 +0800103 "3",
Luke Huange1ddf092020-04-08 01:41:02 +0800104 "4",
Lorenzo Colittia126c242020-05-21 18:07:40 +0900105 "5",
Ken Chenb52a7812020-06-19 17:19:07 +0800106 "6",
paulhub6d71b62020-11-17 00:29:29 +0800107 "7",
lucasline7c54de2021-03-25 16:33:21 +0800108 "8",
Luke Huangb87af052021-08-06 17:57:29 +0800109 "9",
Luke Huang5aa6a992019-04-29 22:02:11 +0800110 ],
lucaslinc6615602021-03-25 16:27:02 +0800111 dumpapi: {
112 no_license: true,
113 },
Luke Huang403c0442019-02-25 15:33:42 +0800114}
115
Luke Huang45b761c2020-03-20 22:30:43 +0800116cc_defaults {
117 name: "resolv_test_defaults",
Ken Chen0c422ff2021-06-23 12:10:20 +0800118 cflags: [
119 // networkCreatePhysical and networkCreateVpn were deprecated from netd_aidl_interface v6.
120 "-Wno-error=deprecated-declarations",
121 ],
Luke Huang45b761c2020-03-20 22:30:43 +0800122 // Note that, static link liblog and libbase is a hard requirement for resolv related tests
123 // because libbase is not compatible between Q and R for general platform build due
124 // to its log revelant functions changing. And most of resolv related tests must be able to run
125 // in Q.
126 static_libs: [
127 "libbase",
128 "liblog",
129 ],
Luke Huang5b6e3ec2021-05-19 18:59:05 +0800130 // This field is required to make test compatible with Q devices.
131 min_sdk_version: "29",
Luke Huang45b761c2020-03-20 22:30:43 +0800132}
133
Luke Huang0b6c4932020-03-27 17:40:07 +0800134cc_defaults {
135 // This is necessary to have the coverage tests run on cf_x86_phone.
136 // Because the test_suite target is 64 bit and the test infra is running the 64 bit test
137 // suite on cf_x86_phone (32-bit) for coverage.
138 // See b/147785146 for details.
139 // TODO: Remove this target after coverage test switched to 64-bit device.
140 name: "resolv_test_mts_coverage_defaults",
141 test_config_template: ":resolv_test_config_template",
142 compile_multilib: "both",
143 multilib: {
144 lib32: {
145 suffix: "32",
146 },
147 lib64: {
148 suffix: "64",
149 },
150 },
151}
152
Lorenzo Colitti8505af42018-12-19 20:30:41 +0900153cc_library {
Bernie Innocentiafaacf72018-08-30 07:34:37 +0900154 name: "libnetd_resolv",
Bernie Innocenti1e886742018-10-25 18:41:47 +0900155 version_script: "libnetd_resolv.map.txt",
Jooyung Han41fa73d2019-11-27 15:41:44 +0900156 stubs: {
157 versions: [
158 "1",
159 ],
160 symbol_file: "libnetd_resolv.map.txt",
161 },
Bernie Innocentiafaacf72018-08-30 07:34:37 +0900162 defaults: ["netd_defaults"],
163 srcs: [
Bernie Innocenti9c575932018-09-07 21:10:25 +0900164 "getaddrinfo.cpp",
165 "gethnamaddr.cpp",
166 "sethostent.cpp",
167 "res_cache.cpp",
168 "res_comp.cpp",
Bernie Innocenti9c575932018-09-07 21:10:25 +0900169 "res_debug.cpp",
Bernie Innocenti9c575932018-09-07 21:10:25 +0900170 "res_mkquery.cpp",
171 "res_query.cpp",
172 "res_send.cpp",
Bernie Innocenti9c575932018-09-07 21:10:25 +0900173 "res_stats.cpp",
Mike Yu021c3e12019-10-08 17:29:34 +0800174 "util.cpp",
Luke Huang7b26b202019-03-28 14:09:24 +0800175 "Dns64Configuration.cpp",
Mike Yu19108d52018-11-15 21:58:19 +0800176 "DnsProxyListener.cpp",
Mike Yu939e3692019-10-29 17:28:34 +0800177 "DnsQueryLog.cpp",
Luke Huang36796f32019-03-13 02:54:45 +0800178 "DnsResolver.cpp",
Luke Huang403c0442019-02-25 15:33:42 +0800179 "DnsResolverService.cpp",
Mike Yue655b1d2019-08-28 17:49:59 +0800180 "DnsStats.cpp",
Mike Yubab3daa2018-10-19 22:11:43 +0800181 "DnsTlsDispatcher.cpp",
182 "DnsTlsQueryMap.cpp",
183 "DnsTlsTransport.cpp",
184 "DnsTlsServer.cpp",
185 "DnsTlsSessionCache.cpp",
186 "DnsTlsSocket.cpp",
Luke Huangf40df9c2020-04-21 08:51:48 +0800187 "Experiments.cpp",
Mike Yub601ff72018-11-01 20:07:00 +0800188 "PrivateDnsConfiguration.cpp",
Luke Huang7b26b202019-03-28 14:09:24 +0800189 "ResolverController.cpp",
Mike Yu39cc6892018-12-14 16:18:27 +0800190 "ResolverEventReporter.cpp",
Bernie Innocentiafaacf72018-08-30 07:34:37 +0900191 ],
Tobias Thierer469b6332019-08-28 20:25:33 +0100192 // Link most things statically to minimize our dependence on system ABIs.
Bernie Innocenti2a9244c2018-09-13 16:12:56 +0900193 stl: "libc++_static",
Bernie Innocenti9f05f5e2018-09-12 23:20:10 +0900194 static_libs: [
Jiyong Parkf5e650b2021-08-04 12:48:08 +0900195 "dnsresolver_aidl_interface-lateststable-ndk",
Bernie Innocenti9f05f5e2018-09-12 23:20:10 +0900196 "libbase",
Mike Yu19108d52018-11-15 21:58:19 +0800197 "libcutils",
Mike Yubab3daa2018-10-19 22:11:43 +0800198 "libnetdutils",
Luke Huang2fe9c732021-07-06 01:48:02 +0800199 "libdoh_ffi",
Bernie Innocenti83a968f2019-06-27 14:35:53 +0900200 "libprotobuf-cpp-lite",
lifr9b87e362019-05-08 13:00:14 +0800201 "libstatslog_resolv",
Muhammad Qureshi10b3d272019-12-03 15:25:19 -0800202 "libstatspush_compat",
Mike Yu19108d52018-11-15 21:58:19 +0800203 "libsysutils",
Jiyong Parkf5e650b2021-08-04 12:48:08 +0900204 "netd_event_listener_interface-lateststable-ndk",
waynemaa74195e2019-01-18 14:02:31 +0800205 "server_configurable_flags",
lifr9b87e362019-05-08 13:00:14 +0800206 "stats_proto",
Mike Yu39cc6892018-12-14 16:18:27 +0800207 ],
Tobias Thierer469b6332019-08-28 20:25:33 +0100208 // libcrypto needs to be used as a shared library because it performs an
209 // integrity check (against a checksum) that is not supported for static
210 // libs. See http://b/141248879
211 // We're also adding libssl here to treat it consistently.
Jiyong Parkdd938dd2020-03-09 14:35:37 +0900212 // liblog is added as a shared library because it provides stable C API
213 // from the platform; we don't need to include it in this module by
214 // statically linking to it. Doing so is even dangerous because the socket
215 // protocol to logd implemented in the library isn't guaranteed to be
216 // stable. See b/151051671
Mike Yu39cc6892018-12-14 16:18:27 +0800217 shared_libs: [
218 "libbinder_ndk",
Tobias Thierer469b6332019-08-28 20:25:33 +0100219 "libcrypto",
Jiyong Parkdd938dd2020-03-09 14:35:37 +0900220 "liblog", //Used by libstatslog_resolv
Tobias Thierer469b6332019-08-28 20:25:33 +0100221 "libssl",
Mike Yu19108d52018-11-15 21:58:19 +0800222 ],
Luke Huangf4c98f22019-06-14 01:57:00 +0800223 header_libs: [
Luke Huang27616fe2020-05-26 17:31:15 +0800224 "libnetdbinder_utils_headers",
Mike Yubab3daa2018-10-19 22:11:43 +0800225 ],
Ruchir Rastogicf96e8b2020-02-26 10:36:18 -0800226 runtime_libs: [
227 // Causes the linkerconfig to create a namespace link from resolv to the
228 // libstatssocket library within the statsd apex
229 "libstatssocket",
230 ],
Bernie Innocentiac18b122018-10-01 23:10:18 +0900231 export_include_dirs: ["include"],
chenbruce99cbfd82019-09-05 15:08:13 +0800232
Bernie Innocenti9f05f5e2018-09-12 23:20:10 +0900233 product_variables: {
234 debuggable: {
235 cppflags: [
236 "-DRESOLV_ALLOW_VERBOSE_LOGGING=1",
237 ],
238 },
239 },
Ken Chen4961dfe2019-11-15 09:03:29 +0800240 header_abi_checker: {
241 enabled: true,
242 symbol_file: "libnetd_resolv.map.txt",
243 },
Ken Chenf5573fd2020-01-14 01:51:05 +0800244 sanitize: {
245 cfi: true,
Ken Chenf5573fd2020-01-14 01:51:05 +0800246 },
Jiyong Parkf29f09b2020-04-08 23:39:45 +0900247 apex_available: ["com.android.resolv"],
Jooyung Han105a9bc2020-04-16 18:48:33 +0900248 min_sdk_version: "29",
Bernie Innocentiafaacf72018-08-30 07:34:37 +0900249}
Mike Yuc52739e2018-10-19 21:06:32 +0800250
lifr9b87e362019-05-08 13:00:14 +0800251cc_library_static {
252 name: "stats_proto",
253 defaults: ["netd_defaults"],
254 proto: {
255 export_proto_headers: true,
256 type: "lite",
257 },
258 srcs: [
259 "stats.proto",
260 ],
Jiyong Parkf29f09b2020-04-08 23:39:45 +0900261 apex_available: ["com.android.resolv"],
Jooyung Han105a9bc2020-04-16 18:48:33 +0900262 min_sdk_version: "29",
lifr9b87e362019-05-08 13:00:14 +0800263}
264
265genrule {
266 name: "statslog_resolv.h",
267 tools: ["stats-log-api-gen"],
Muhammad Qureshibf66b112020-12-10 10:24:18 -0800268 cmd: "$(location stats-log-api-gen) --header $(genDir)/statslog_resolv.h --module resolv" +
269 " --namespace android,net,stats --minApiLevel 29",
lifr9b87e362019-05-08 13:00:14 +0800270 out: [
271 "statslog_resolv.h",
272 ],
273}
274
275genrule {
276 name: "statslog_resolv.cpp",
277 tools: ["stats-log-api-gen"],
Muhammad Qureshibf66b112020-12-10 10:24:18 -0800278 cmd: "$(location stats-log-api-gen) --cpp $(genDir)/statslog_resolv.cpp --module resolv" +
279 " --namespace android,net,stats --importHeader statslog_resolv.h --minApiLevel 29",
lifr9b87e362019-05-08 13:00:14 +0800280 out: [
281 "statslog_resolv.cpp",
282 ],
283}
284
285cc_library_static {
286 name: "libstatslog_resolv",
287 generated_sources: ["statslog_resolv.cpp"],
288 generated_headers: ["statslog_resolv.h"],
289 defaults: ["netd_defaults"],
290 export_generated_headers: ["statslog_resolv.h"],
291 static_libs: [
292 "libcutils",
Muhammad Qureshi10b3d272019-12-03 15:25:19 -0800293 "libstatspush_compat",
lifr9b87e362019-05-08 13:00:14 +0800294 ],
Yifan Hong028d2d62021-04-26 16:24:34 -0700295 header_libs: [
296 "libgtest_prod_headers", // Used by libstatspush_compat
297 ],
Jiyong Parkf29f09b2020-04-08 23:39:45 +0900298 apex_available: ["com.android.resolv"],
Jooyung Han105a9bc2020-04-16 18:48:33 +0900299 min_sdk_version: "29",
lifr9b87e362019-05-08 13:00:14 +0800300}
301
Luke Huang6b7ff612020-03-25 15:23:41 +0800302filegroup {
Luke Huangac1ce2f2021-04-25 17:45:55 +0000303 name: "resolv_rust_test_config_template",
304 srcs: [
305 "resolv_rust_test_config_template.xml",
306 ],
307}
308
309filegroup {
Luke Huang6b7ff612020-03-25 15:23:41 +0800310 name: "resolv_test_config_template",
311 srcs: [
312 "resolv_test_config_template.xml",
313 ],
314}
315
Pirama Arumuga Nainar6d14bb32021-03-09 14:11:05 -0800316filegroup {
317 name: "resolv_unit_test_files",
Mike Yuc52739e2018-10-19 21:06:32 +0800318 srcs: [
Mike Yu39df0b12019-10-31 16:12:23 +0800319 "DnsQueryLogTest.cpp",
Luke Huangf40df9c2020-04-21 08:51:48 +0800320 "DnsStatsTest.cpp",
321 "ExperimentsTest.cpp",
Bernie Innocentiac6c9a42020-11-27 21:57:41 +0900322 "OperationLimiterTest.cpp",
Mike Yu0ee1dc92020-11-09 14:56:54 +0800323 "PrivateDnsConfigurationTest.cpp",
Mike Yuc52739e2018-10-19 21:06:32 +0800324 ],
Mike Yuc52739e2018-10-19 21:06:32 +0800325}
Luke Huangfd17c542021-03-17 14:27:28 +0800326
327rust_ffi_static {
328 name: "libdoh_ffi",
Luke Huangfd17c542021-03-17 14:27:28 +0800329 crate_name: "doh",
330 srcs: ["doh.rs"],
331 edition: "2018",
332
333 rlibs: [
334 "libandroid_logger",
335 "libanyhow",
Luke Huangfe453402021-06-24 03:15:03 +0800336 "libbase64_rust",
337 "libfutures",
Luke Huangfd17c542021-03-17 14:27:28 +0800338 "liblibc",
339 "liblog_rust",
340 "libquiche",
341 "libring",
342 "libtokio",
343 "liburl",
344 ],
345 prefer_rlib: true,
346
347 shared_libs: [
348 "libcrypto",
349 "libssl",
350 ],
351
352 apex_available: [
353 "//apex_available:platform", // Needed by doh_ffi_test
354 "com.android.resolv"
355 ],
356 min_sdk_version: "29",
357}
358
Luke Huang744f7c22021-04-15 04:15:43 +0000359rust_test {
360 name: "doh_unit_test",
Luke Huang744f7c22021-04-15 04:15:43 +0000361 crate_name: "doh",
362 srcs: ["doh.rs"],
363 edition: "2018",
364 test_suites: ["general-tests"],
365 auto_gen_config: true,
Luke Huangac1ce2f2021-04-25 17:45:55 +0000366 // Used to enable root permission for the test.
367 // TODO: remove after 'require_root' is supported in rust_test.
368 test_config_template: ":resolv_rust_test_config_template",
Luke Huang744f7c22021-04-15 04:15:43 +0000369 rustlibs: [
370 "libandroid_logger",
371 "libanyhow",
Luke Huangfe453402021-06-24 03:15:03 +0800372 "libbase64_rust",
373 "libfutures",
Luke Huang744f7c22021-04-15 04:15:43 +0000374 "liblibc",
375 "liblog_rust",
Luke Huang5e60de12021-05-19 06:11:18 +0800376 "libquiche_static",
Luke Huang744f7c22021-04-15 04:15:43 +0000377 "libring",
378 "libtokio",
379 "liburl",
380 ],
381 min_sdk_version: "29",
382}
Luke Huange912c762021-06-24 02:38:40 +0800383
384// It's required by unit tests.
385rust_ffi_static {
386 name: "libdoh_ffi_for_test",
387 crate_name: "doh",
388 srcs: ["doh.rs"],
389 edition: "2018",
390
391 rlibs: [
392 "libandroid_logger",
393 "libanyhow",
Luke Huangfe453402021-06-24 03:15:03 +0800394 "libbase64_rust",
395 "libfutures",
Luke Huange912c762021-06-24 02:38:40 +0800396 "liblibc",
397 "liblog_rust",
398 "libquiche_static",
399 "libring",
400 "libtokio",
401 "liburl",
402 ],
403 prefer_rlib: true,
Luke Huang53d3eb22021-07-19 15:08:56 +0800404 // TODO(b/194022174), for unit tests to run on the Android 10 platform,
405 // libunwind must be statically linked.
Luke Huang84f81012021-07-16 16:59:14 +0800406 whole_static_libs: ["libunwind"],
Luke Huange912c762021-06-24 02:38:40 +0800407 apex_available: [
408 "//apex_available:platform", // Needed by doh_ffi_test
409 "com.android.resolv"
410 ],
411 min_sdk_version: "29",
412}