blob: eead5ab1121540564e1b08e62cca9a46b1e8844b [file] [log] [blame]
Bob Badourfd4ac102021-02-12 14:43:29 -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
lucasline7c54de2021-03-25 16:33:21 +080054dnsresolver_aidl_interface_lateststable_version = "V8"
Jeongik Cha13ce6fb2021-03-05 21:18:33 +090055
56cc_library_static {
57 name: "dnsresolver_aidl_interface-lateststable-ndk_platform",
58 whole_static_libs: [
59 "dnsresolver_aidl_interface-" + dnsresolver_aidl_interface_lateststable_version + "-ndk_platform",
60 ],
61 apex_available: [
62 "com.android.resolv",
63 ],
64 min_sdk_version: "29",
65}
66
Luke Huang403c0442019-02-25 15:33:42 +080067aidl_interface {
68 name: "dnsresolver_aidl_interface",
69 local_include_dir: "binder",
70 srcs: [
71 "binder/android/net/IDnsResolver.aidl",
chenbrucefd837fa2019-10-29 18:35:36 +080072 "binder/android/net/ResolverHostsParcel.aidl",
Ken Chena6ac2a62020-04-07 17:25:56 +080073 "binder/android/net/ResolverOptionsParcel.aidl",
waynema37255182019-03-18 13:22:56 +080074 "binder/android/net/ResolverParamsParcel.aidl",
paulhub6d71b62020-11-17 00:29:29 +080075 // New AIDL classes should go into android.net.resolv.aidl so they can be clearly identified
76 "binder/android/net/resolv/aidl/**/*.aidl",
Luke Huang403c0442019-02-25 15:33:42 +080077 ],
Hungming Chena32c8c12019-01-25 10:47:40 +080078 imports: [
79 "netd_event_listener_interface",
80 ],
Luke Huang598daad2019-05-02 18:10:15 +080081 backend: {
chenbruce66ba90d2020-02-25 14:53:39 +080082 java: {
83 apex_available: [
chenbruce76035f62020-03-16 00:12:59 +080084 "com.android.bluetooth.updatable",
Remi NGUYEN VANfb492072021-03-22 11:17:46 +000085 "com.android.tethering",
chenbruce66ba90d2020-02-25 14:53:39 +080086 "com.android.wifi",
87 ],
88 },
Luke Huang598daad2019-05-02 18:10:15 +080089 ndk: {
90 gen_log: true,
Jiyong Parkf29f09b2020-04-08 23:39:45 +090091 apex_available: [
92 "com.android.resolv",
93 ],
Jooyung Han105a9bc2020-04-16 18:48:33 +090094 min_sdk_version: "29",
Luke Huang598daad2019-05-02 18:10:15 +080095 },
96 },
Luke Huang5aa6a992019-04-29 22:02:11 +080097 versions: [
98 "1",
99 "2",
Luke Huang0fc985f2019-11-14 19:18:14 +0800100 "3",
Luke Huange1ddf092020-04-08 01:41:02 +0800101 "4",
Lorenzo Colittia126c242020-05-21 18:07:40 +0900102 "5",
Ken Chenb52a7812020-06-19 17:19:07 +0800103 "6",
paulhub6d71b62020-11-17 00:29:29 +0800104 "7",
lucasline7c54de2021-03-25 16:33:21 +0800105 "8",
Luke Huang5aa6a992019-04-29 22:02:11 +0800106 ],
lucaslinc6615602021-03-25 16:27:02 +0800107 dumpapi: {
108 no_license: true,
109 },
Luke Huang403c0442019-02-25 15:33:42 +0800110}
111
Luke Huang45b761c2020-03-20 22:30:43 +0800112cc_defaults {
113 name: "resolv_test_defaults",
Ken Chen0c422ff2021-06-23 12:10:20 +0800114 cflags: [
115 // networkCreatePhysical and networkCreateVpn were deprecated from netd_aidl_interface v6.
116 "-Wno-error=deprecated-declarations",
117 ],
Luke Huang45b761c2020-03-20 22:30:43 +0800118 // Note that, static link liblog and libbase is a hard requirement for resolv related tests
119 // because libbase is not compatible between Q and R for general platform build due
120 // to its log revelant functions changing. And most of resolv related tests must be able to run
121 // in Q.
122 static_libs: [
123 "libbase",
124 "liblog",
125 ],
Luke Huang5b6e3ec2021-05-19 18:59:05 +0800126 // This field is required to make test compatible with Q devices.
127 min_sdk_version: "29",
Luke Huang45b761c2020-03-20 22:30:43 +0800128}
129
Luke Huang0b6c4932020-03-27 17:40:07 +0800130cc_defaults {
131 // This is necessary to have the coverage tests run on cf_x86_phone.
132 // Because the test_suite target is 64 bit and the test infra is running the 64 bit test
133 // suite on cf_x86_phone (32-bit) for coverage.
134 // See b/147785146 for details.
135 // TODO: Remove this target after coverage test switched to 64-bit device.
136 name: "resolv_test_mts_coverage_defaults",
137 test_config_template: ":resolv_test_config_template",
138 compile_multilib: "both",
139 multilib: {
140 lib32: {
141 suffix: "32",
142 },
143 lib64: {
144 suffix: "64",
145 },
146 },
147}
148
Lorenzo Colitti8505af42018-12-19 20:30:41 +0900149cc_library {
Bernie Innocentiafaacf72018-08-30 07:34:37 +0900150 name: "libnetd_resolv",
Bernie Innocenti1e886742018-10-25 18:41:47 +0900151 version_script: "libnetd_resolv.map.txt",
Jooyung Han41fa73d2019-11-27 15:41:44 +0900152 stubs: {
153 versions: [
154 "1",
155 ],
156 symbol_file: "libnetd_resolv.map.txt",
157 },
Bernie Innocentiafaacf72018-08-30 07:34:37 +0900158 defaults: ["netd_defaults"],
159 srcs: [
Bernie Innocenti9c575932018-09-07 21:10:25 +0900160 "getaddrinfo.cpp",
161 "gethnamaddr.cpp",
162 "sethostent.cpp",
163 "res_cache.cpp",
164 "res_comp.cpp",
Bernie Innocenti9c575932018-09-07 21:10:25 +0900165 "res_debug.cpp",
Bernie Innocenti9c575932018-09-07 21:10:25 +0900166 "res_mkquery.cpp",
167 "res_query.cpp",
168 "res_send.cpp",
Bernie Innocenti9c575932018-09-07 21:10:25 +0900169 "res_stats.cpp",
Mike Yu021c3e12019-10-08 17:29:34 +0800170 "util.cpp",
Luke Huang7b26b202019-03-28 14:09:24 +0800171 "Dns64Configuration.cpp",
Mike Yu19108d52018-11-15 21:58:19 +0800172 "DnsProxyListener.cpp",
Mike Yu939e3692019-10-29 17:28:34 +0800173 "DnsQueryLog.cpp",
Luke Huang36796f32019-03-13 02:54:45 +0800174 "DnsResolver.cpp",
Luke Huang403c0442019-02-25 15:33:42 +0800175 "DnsResolverService.cpp",
Mike Yue655b1d2019-08-28 17:49:59 +0800176 "DnsStats.cpp",
Mike Yubab3daa2018-10-19 22:11:43 +0800177 "DnsTlsDispatcher.cpp",
178 "DnsTlsQueryMap.cpp",
179 "DnsTlsTransport.cpp",
180 "DnsTlsServer.cpp",
181 "DnsTlsSessionCache.cpp",
182 "DnsTlsSocket.cpp",
Luke Huangf40df9c2020-04-21 08:51:48 +0800183 "Experiments.cpp",
Mike Yub601ff72018-11-01 20:07:00 +0800184 "PrivateDnsConfiguration.cpp",
Luke Huang7b26b202019-03-28 14:09:24 +0800185 "ResolverController.cpp",
Mike Yu39cc6892018-12-14 16:18:27 +0800186 "ResolverEventReporter.cpp",
Bernie Innocentiafaacf72018-08-30 07:34:37 +0900187 ],
Tobias Thierer469b6332019-08-28 20:25:33 +0100188 // Link most things statically to minimize our dependence on system ABIs.
Bernie Innocenti2a9244c2018-09-13 16:12:56 +0900189 stl: "libc++_static",
Bernie Innocenti9f05f5e2018-09-12 23:20:10 +0900190 static_libs: [
Jeongik Cha13ce6fb2021-03-05 21:18:33 +0900191 "dnsresolver_aidl_interface-lateststable-ndk_platform",
Bernie Innocenti9f05f5e2018-09-12 23:20:10 +0900192 "libbase",
Mike Yu19108d52018-11-15 21:58:19 +0800193 "libcutils",
Mike Yubab3daa2018-10-19 22:11:43 +0800194 "libnetdutils",
Luke Huang2fe9c732021-07-06 01:48:02 +0800195 "libdoh_ffi",
Bernie Innocenti83a968f2019-06-27 14:35:53 +0900196 "libprotobuf-cpp-lite",
lifr9b87e362019-05-08 13:00:14 +0800197 "libstatslog_resolv",
Muhammad Qureshi10b3d272019-12-03 15:25:19 -0800198 "libstatspush_compat",
Mike Yu19108d52018-11-15 21:58:19 +0800199 "libsysutils",
Jeongik Cha13ce6fb2021-03-05 21:18:33 +0900200 "netd_event_listener_interface-lateststable-ndk_platform",
waynemaa74195e2019-01-18 14:02:31 +0800201 "server_configurable_flags",
lifr9b87e362019-05-08 13:00:14 +0800202 "stats_proto",
Mike Yu39cc6892018-12-14 16:18:27 +0800203 ],
Tobias Thierer469b6332019-08-28 20:25:33 +0100204 // libcrypto needs to be used as a shared library because it performs an
205 // integrity check (against a checksum) that is not supported for static
206 // libs. See http://b/141248879
207 // We're also adding libssl here to treat it consistently.
Jiyong Parkdd938dd2020-03-09 14:35:37 +0900208 // liblog is added as a shared library because it provides stable C API
209 // from the platform; we don't need to include it in this module by
210 // statically linking to it. Doing so is even dangerous because the socket
211 // protocol to logd implemented in the library isn't guaranteed to be
212 // stable. See b/151051671
Mike Yu39cc6892018-12-14 16:18:27 +0800213 shared_libs: [
214 "libbinder_ndk",
Tobias Thierer469b6332019-08-28 20:25:33 +0100215 "libcrypto",
Jiyong Parkdd938dd2020-03-09 14:35:37 +0900216 "liblog", //Used by libstatslog_resolv
Tobias Thierer469b6332019-08-28 20:25:33 +0100217 "libssl",
Mike Yu19108d52018-11-15 21:58:19 +0800218 ],
Luke Huangf4c98f22019-06-14 01:57:00 +0800219 header_libs: [
Luke Huang27616fe2020-05-26 17:31:15 +0800220 "libnetdbinder_utils_headers",
Mike Yubab3daa2018-10-19 22:11:43 +0800221 ],
Ruchir Rastogicf96e8b2020-02-26 10:36:18 -0800222 runtime_libs: [
223 // Causes the linkerconfig to create a namespace link from resolv to the
224 // libstatssocket library within the statsd apex
225 "libstatssocket",
226 ],
Bernie Innocentiac18b122018-10-01 23:10:18 +0900227 export_include_dirs: ["include"],
chenbruce99cbfd82019-09-05 15:08:13 +0800228
Bernie Innocenti9f05f5e2018-09-12 23:20:10 +0900229 product_variables: {
230 debuggable: {
231 cppflags: [
232 "-DRESOLV_ALLOW_VERBOSE_LOGGING=1",
233 ],
234 },
235 },
Ken Chen4961dfe2019-11-15 09:03:29 +0800236 header_abi_checker: {
237 enabled: true,
238 symbol_file: "libnetd_resolv.map.txt",
239 },
Ken Chenf5573fd2020-01-14 01:51:05 +0800240 sanitize: {
241 cfi: true,
Ken Chenf5573fd2020-01-14 01:51:05 +0800242 },
Jiyong Parkf29f09b2020-04-08 23:39:45 +0900243 apex_available: ["com.android.resolv"],
Jooyung Han105a9bc2020-04-16 18:48:33 +0900244 min_sdk_version: "29",
Bernie Innocentiafaacf72018-08-30 07:34:37 +0900245}
Mike Yuc52739e2018-10-19 21:06:32 +0800246
lifr9b87e362019-05-08 13:00:14 +0800247cc_library_static {
248 name: "stats_proto",
249 defaults: ["netd_defaults"],
250 proto: {
251 export_proto_headers: true,
252 type: "lite",
253 },
254 srcs: [
255 "stats.proto",
256 ],
Jiyong Parkf29f09b2020-04-08 23:39:45 +0900257 apex_available: ["com.android.resolv"],
Jooyung Han105a9bc2020-04-16 18:48:33 +0900258 min_sdk_version: "29",
lifr9b87e362019-05-08 13:00:14 +0800259}
260
261genrule {
262 name: "statslog_resolv.h",
263 tools: ["stats-log-api-gen"],
Muhammad Qureshibf66b112020-12-10 10:24:18 -0800264 cmd: "$(location stats-log-api-gen) --header $(genDir)/statslog_resolv.h --module resolv" +
265 " --namespace android,net,stats --minApiLevel 29",
lifr9b87e362019-05-08 13:00:14 +0800266 out: [
267 "statslog_resolv.h",
268 ],
269}
270
271genrule {
272 name: "statslog_resolv.cpp",
273 tools: ["stats-log-api-gen"],
Muhammad Qureshibf66b112020-12-10 10:24:18 -0800274 cmd: "$(location stats-log-api-gen) --cpp $(genDir)/statslog_resolv.cpp --module resolv" +
275 " --namespace android,net,stats --importHeader statslog_resolv.h --minApiLevel 29",
lifr9b87e362019-05-08 13:00:14 +0800276 out: [
277 "statslog_resolv.cpp",
278 ],
279}
280
281cc_library_static {
282 name: "libstatslog_resolv",
283 generated_sources: ["statslog_resolv.cpp"],
284 generated_headers: ["statslog_resolv.h"],
285 defaults: ["netd_defaults"],
286 export_generated_headers: ["statslog_resolv.h"],
287 static_libs: [
288 "libcutils",
Muhammad Qureshi10b3d272019-12-03 15:25:19 -0800289 "libstatspush_compat",
lifr9b87e362019-05-08 13:00:14 +0800290 ],
Yifan Hong028d2d62021-04-26 16:24:34 -0700291 header_libs: [
292 "libgtest_prod_headers", // Used by libstatspush_compat
293 ],
Jiyong Parkf29f09b2020-04-08 23:39:45 +0900294 apex_available: ["com.android.resolv"],
Jooyung Han105a9bc2020-04-16 18:48:33 +0900295 min_sdk_version: "29",
lifr9b87e362019-05-08 13:00:14 +0800296}
297
Luke Huang6b7ff612020-03-25 15:23:41 +0800298filegroup {
Luke Huang3c8164a2021-04-15 01:25:12 +0800299 name: "resolv_rust_test_config_template",
300 srcs: [
301 "resolv_rust_test_config_template.xml",
302 ],
303}
304
305filegroup {
Luke Huang6b7ff612020-03-25 15:23:41 +0800306 name: "resolv_test_config_template",
307 srcs: [
308 "resolv_test_config_template.xml",
309 ],
310}
311
Pirama Arumuga Nainar6d14bb32021-03-09 14:11:05 -0800312filegroup {
313 name: "resolv_unit_test_files",
Mike Yuc52739e2018-10-19 21:06:32 +0800314 srcs: [
Mike Yu39df0b12019-10-31 16:12:23 +0800315 "DnsQueryLogTest.cpp",
Luke Huangf40df9c2020-04-21 08:51:48 +0800316 "DnsStatsTest.cpp",
317 "ExperimentsTest.cpp",
Bernie Innocentiac6c9a42020-11-27 21:57:41 +0900318 "OperationLimiterTest.cpp",
Mike Yu0ee1dc92020-11-09 14:56:54 +0800319 "PrivateDnsConfigurationTest.cpp",
Mike Yuc52739e2018-10-19 21:06:32 +0800320 ],
Mike Yuc52739e2018-10-19 21:06:32 +0800321}
Luke Huang0841e312021-03-17 14:27:28 +0800322
323rust_ffi_static {
324 name: "libdoh_ffi",
Luke Huang0841e312021-03-17 14:27:28 +0800325 crate_name: "doh",
326 srcs: ["doh.rs"],
327 edition: "2018",
328
329 rlibs: [
330 "libandroid_logger",
331 "libanyhow",
Luke Huangfe453402021-06-24 03:15:03 +0800332 "libbase64_rust",
333 "libfutures",
Luke Huang0841e312021-03-17 14:27:28 +0800334 "liblibc",
335 "liblog_rust",
336 "libquiche",
337 "libring",
338 "libtokio",
339 "liburl",
340 ],
341 prefer_rlib: true,
342
343 shared_libs: [
344 "libcrypto",
345 "libssl",
346 ],
347
348 apex_available: [
349 "//apex_available:platform", // Needed by doh_ffi_test
350 "com.android.resolv"
351 ],
352 min_sdk_version: "29",
353}
354
Luke Huangd5870282021-04-08 22:34:58 +0800355rust_test {
356 name: "doh_unit_test",
Luke Huangd5870282021-04-08 22:34:58 +0800357 crate_name: "doh",
358 srcs: ["doh.rs"],
359 edition: "2018",
360 test_suites: ["general-tests"],
361 auto_gen_config: true,
Luke Huang3c8164a2021-04-15 01:25:12 +0800362 // Used to enable root permission for the test.
363 // TODO: remove after 'require_root' is supported in rust_test.
364 test_config_template: ":resolv_rust_test_config_template",
Luke Huangd5870282021-04-08 22:34:58 +0800365 rustlibs: [
366 "libandroid_logger",
367 "libanyhow",
Luke Huangfe453402021-06-24 03:15:03 +0800368 "libbase64_rust",
369 "libfutures",
Luke Huangd5870282021-04-08 22:34:58 +0800370 "liblibc",
371 "liblog_rust",
Luke Huang5e60de12021-05-19 06:11:18 +0800372 "libquiche_static",
Luke Huangd5870282021-04-08 22:34:58 +0800373 "libring",
374 "libtokio",
375 "liburl",
376 ],
377 min_sdk_version: "29",
378}
Luke Huange912c762021-06-24 02:38:40 +0800379
380// It's required by unit tests.
381rust_ffi_static {
382 name: "libdoh_ffi_for_test",
383 crate_name: "doh",
384 srcs: ["doh.rs"],
385 edition: "2018",
386
387 rlibs: [
388 "libandroid_logger",
389 "libanyhow",
Luke Huangfe453402021-06-24 03:15:03 +0800390 "libbase64_rust",
391 "libfutures",
Luke Huange912c762021-06-24 02:38:40 +0800392 "liblibc",
393 "liblog_rust",
394 "libquiche_static",
395 "libring",
396 "libtokio",
397 "liburl",
398 ],
399 prefer_rlib: true,
Luke Huang84f81012021-07-16 16:59:14 +0800400 // For unit tests to run on the Android 10 platform, libunwind must be statically linked..
401 whole_static_libs: ["libunwind"],
Luke Huange912c762021-06-24 02:38:40 +0800402 apex_available: [
403 "//apex_available:platform", // Needed by doh_ffi_test
404 "com.android.resolv"
405 ],
406 min_sdk_version: "29",
407}