blob: d33ab9aa4b4ad17d16d7e5050f415d8d37f12c52 [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
Luke Huang7892e662021-03-18 10:14:39 +000033// Whether to enable the targets in this file that require rust toolchain.
34// Set to false in branches like mainline-prod where rust toolchain isn't supported.
35support_rust_toolchain = true
36
Lorenzo Colitti84485a42018-12-18 19:16:12 +090037cc_library_headers {
38 name: "libnetd_resolv_headers",
39 export_include_dirs: ["include"],
40}
41
Bernie Innocenti86890c92020-01-08 21:00:39 +090042// Used only by dns_responder_client_ndk.cpp for ResolverStats.h
43// TODO: refactor stats to use a Parcel and eliminate this dependency
chenbruce2e2446c2019-06-28 16:37:36 +080044cc_library_headers {
45 name: "libnetd_resolv_internal_headers",
46 export_include_dirs: ["."],
47}
48
Luke Huang27616fe2020-05-26 17:31:15 +080049cc_library_headers {
50 name: "dnsproxyd_protocol_headers",
Remi NGUYEN VANb5fb4ca2021-03-23 11:18:05 +000051 sdk_version: "29",
52 min_sdk_version: "29",
Luke Huang27616fe2020-05-26 17:31:15 +080053 export_include_dirs: ["include/dnsproxyd_protocol"],
Remi NGUYEN VAN35e9af02020-11-27 18:59:19 +090054 apex_available: [
55 "//apex_available:platform",
56 "com.android.tethering",
57 ],
Luke Huang27616fe2020-05-26 17:31:15 +080058}
59
lucasline7c54de2021-03-25 16:33:21 +080060dnsresolver_aidl_interface_lateststable_version = "V8"
Jeongik Chae8fe5a52021-03-05 21:18:33 +090061
62cc_library_static {
63 name: "dnsresolver_aidl_interface-lateststable-ndk_platform",
64 whole_static_libs: [
65 "dnsresolver_aidl_interface-" + dnsresolver_aidl_interface_lateststable_version + "-ndk_platform",
66 ],
67 apex_available: [
68 "com.android.resolv",
69 ],
70 min_sdk_version: "29",
71}
72
Luke Huang403c0442019-02-25 15:33:42 +080073aidl_interface {
74 name: "dnsresolver_aidl_interface",
75 local_include_dir: "binder",
76 srcs: [
77 "binder/android/net/IDnsResolver.aidl",
chenbrucefd837fa2019-10-29 18:35:36 +080078 "binder/android/net/ResolverHostsParcel.aidl",
Ken Chena6ac2a62020-04-07 17:25:56 +080079 "binder/android/net/ResolverOptionsParcel.aidl",
waynema37255182019-03-18 13:22:56 +080080 "binder/android/net/ResolverParamsParcel.aidl",
paulhub6d71b62020-11-17 00:29:29 +080081 // New AIDL classes should go into android.net.resolv.aidl so they can be clearly identified
82 "binder/android/net/resolv/aidl/**/*.aidl",
Luke Huang403c0442019-02-25 15:33:42 +080083 ],
Hungming Chena32c8c12019-01-25 10:47:40 +080084 imports: [
85 "netd_event_listener_interface",
86 ],
Luke Huang598daad2019-05-02 18:10:15 +080087 backend: {
chenbruce66ba90d2020-02-25 14:53:39 +080088 java: {
89 apex_available: [
chenbruce76035f62020-03-16 00:12:59 +080090 "com.android.bluetooth.updatable",
Remi NGUYEN VANcbc998a2021-03-22 11:17:46 +000091 "com.android.tethering",
chenbruce66ba90d2020-02-25 14:53:39 +080092 "com.android.wifi",
93 ],
Remi NGUYEN VANb5fb4ca2021-03-23 11:18:05 +000094 min_sdk_version: "30",
chenbruce66ba90d2020-02-25 14:53:39 +080095 },
Luke Huang598daad2019-05-02 18:10:15 +080096 ndk: {
97 gen_log: true,
Jiyong Parkf29f09b2020-04-08 23:39:45 +090098 apex_available: [
99 "com.android.resolv",
100 ],
Jooyung Han105a9bc2020-04-16 18:48:33 +0900101 min_sdk_version: "29",
Luke Huang598daad2019-05-02 18:10:15 +0800102 },
103 },
Luke Huang5aa6a992019-04-29 22:02:11 +0800104 versions: [
105 "1",
106 "2",
Luke Huang0fc985f2019-11-14 19:18:14 +0800107 "3",
Luke Huange1ddf092020-04-08 01:41:02 +0800108 "4",
Lorenzo Colittia126c242020-05-21 18:07:40 +0900109 "5",
Ken Chenb52a7812020-06-19 17:19:07 +0800110 "6",
paulhub6d71b62020-11-17 00:29:29 +0800111 "7",
lucasline7c54de2021-03-25 16:33:21 +0800112 "8",
Luke Huang5aa6a992019-04-29 22:02:11 +0800113 ],
lucaslinc6615602021-03-25 16:27:02 +0800114 dumpapi: {
115 no_license: true,
116 },
Luke Huang403c0442019-02-25 15:33:42 +0800117}
118
Luke Huang45b761c2020-03-20 22:30:43 +0800119cc_defaults {
120 name: "resolv_test_defaults",
121 // Note that, static link liblog and libbase is a hard requirement for resolv related tests
122 // because libbase is not compatible between Q and R for general platform build due
123 // to its log revelant functions changing. And most of resolv related tests must be able to run
124 // in Q.
125 static_libs: [
126 "libbase",
127 "liblog",
128 ],
129}
130
Luke Huang0b6c4932020-03-27 17:40:07 +0800131cc_defaults {
132 // This is necessary to have the coverage tests run on cf_x86_phone.
133 // Because the test_suite target is 64 bit and the test infra is running the 64 bit test
134 // suite on cf_x86_phone (32-bit) for coverage.
135 // See b/147785146 for details.
136 // TODO: Remove this target after coverage test switched to 64-bit device.
137 name: "resolv_test_mts_coverage_defaults",
138 test_config_template: ":resolv_test_config_template",
139 compile_multilib: "both",
140 multilib: {
141 lib32: {
142 suffix: "32",
143 },
144 lib64: {
145 suffix: "64",
146 },
147 },
148}
149
Lorenzo Colitti8505af42018-12-19 20:30:41 +0900150cc_library {
Bernie Innocentiafaacf72018-08-30 07:34:37 +0900151 name: "libnetd_resolv",
Bernie Innocenti1e886742018-10-25 18:41:47 +0900152 version_script: "libnetd_resolv.map.txt",
Jooyung Han41fa73d2019-11-27 15:41:44 +0900153 stubs: {
154 versions: [
155 "1",
156 ],
157 symbol_file: "libnetd_resolv.map.txt",
158 },
Bernie Innocentiafaacf72018-08-30 07:34:37 +0900159 defaults: ["netd_defaults"],
160 srcs: [
Bernie Innocenti9c575932018-09-07 21:10:25 +0900161 "getaddrinfo.cpp",
162 "gethnamaddr.cpp",
163 "sethostent.cpp",
164 "res_cache.cpp",
165 "res_comp.cpp",
Bernie Innocenti9c575932018-09-07 21:10:25 +0900166 "res_debug.cpp",
Bernie Innocenti9c575932018-09-07 21:10:25 +0900167 "res_mkquery.cpp",
168 "res_query.cpp",
169 "res_send.cpp",
Bernie Innocenti9c575932018-09-07 21:10:25 +0900170 "res_stats.cpp",
Mike Yu021c3e12019-10-08 17:29:34 +0800171 "util.cpp",
Luke Huang7b26b202019-03-28 14:09:24 +0800172 "Dns64Configuration.cpp",
Mike Yu19108d52018-11-15 21:58:19 +0800173 "DnsProxyListener.cpp",
Mike Yu939e3692019-10-29 17:28:34 +0800174 "DnsQueryLog.cpp",
Luke Huang36796f32019-03-13 02:54:45 +0800175 "DnsResolver.cpp",
Luke Huang403c0442019-02-25 15:33:42 +0800176 "DnsResolverService.cpp",
Mike Yue655b1d2019-08-28 17:49:59 +0800177 "DnsStats.cpp",
Mike Yubab3daa2018-10-19 22:11:43 +0800178 "DnsTlsDispatcher.cpp",
179 "DnsTlsQueryMap.cpp",
180 "DnsTlsTransport.cpp",
181 "DnsTlsServer.cpp",
182 "DnsTlsSessionCache.cpp",
183 "DnsTlsSocket.cpp",
Luke Huangf40df9c2020-04-21 08:51:48 +0800184 "Experiments.cpp",
Mike Yub601ff72018-11-01 20:07:00 +0800185 "PrivateDnsConfiguration.cpp",
Luke Huang7b26b202019-03-28 14:09:24 +0800186 "ResolverController.cpp",
Mike Yu39cc6892018-12-14 16:18:27 +0800187 "ResolverEventReporter.cpp",
Bernie Innocentiafaacf72018-08-30 07:34:37 +0900188 ],
Tobias Thierer469b6332019-08-28 20:25:33 +0100189 // Link most things statically to minimize our dependence on system ABIs.
Bernie Innocenti2a9244c2018-09-13 16:12:56 +0900190 stl: "libc++_static",
Bernie Innocenti9f05f5e2018-09-12 23:20:10 +0900191 static_libs: [
Jeongik Chae8fe5a52021-03-05 21:18:33 +0900192 "dnsresolver_aidl_interface-lateststable-ndk_platform",
Bernie Innocenti9f05f5e2018-09-12 23:20:10 +0900193 "libbase",
Mike Yu19108d52018-11-15 21:58:19 +0800194 "libcutils",
Mike Yubab3daa2018-10-19 22:11:43 +0800195 "libnetdutils",
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 Chae8fe5a52021-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"],
264 cmd: "$(location stats-log-api-gen) --header $(genDir)/statslog_resolv.h --module resolv --namespace android,net,stats",
265 out: [
266 "statslog_resolv.h",
267 ],
268}
269
270genrule {
271 name: "statslog_resolv.cpp",
272 tools: ["stats-log-api-gen"],
Muhammad Qureshi10b3d272019-12-03 15:25:19 -0800273 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 +0800274 out: [
275 "statslog_resolv.cpp",
276 ],
277}
278
279cc_library_static {
280 name: "libstatslog_resolv",
281 generated_sources: ["statslog_resolv.cpp"],
282 generated_headers: ["statslog_resolv.h"],
283 defaults: ["netd_defaults"],
284 export_generated_headers: ["statslog_resolv.h"],
285 static_libs: [
286 "libcutils",
Muhammad Qureshi10b3d272019-12-03 15:25:19 -0800287 "libgtest_prod", // Used by libstatspush_compat
288 "libstatspush_compat",
lifr9b87e362019-05-08 13:00:14 +0800289 ],
Jiyong Parkf29f09b2020-04-08 23:39:45 +0900290 apex_available: ["com.android.resolv"],
Jooyung Han105a9bc2020-04-16 18:48:33 +0900291 min_sdk_version: "29",
lifr9b87e362019-05-08 13:00:14 +0800292}
293
Luke Huang6b7ff612020-03-25 15:23:41 +0800294filegroup {
295 name: "resolv_test_config_template",
296 srcs: [
297 "resolv_test_config_template.xml",
298 ],
299}
300
Pirama Arumuga Nainar6d14bb32021-03-09 14:11:05 -0800301filegroup {
302 name: "resolv_unit_test_files",
Mike Yuc52739e2018-10-19 21:06:32 +0800303 srcs: [
Mike Yu39df0b12019-10-31 16:12:23 +0800304 "DnsQueryLogTest.cpp",
Luke Huangf40df9c2020-04-21 08:51:48 +0800305 "DnsStatsTest.cpp",
306 "ExperimentsTest.cpp",
Bernie Innocentiac6c9a42020-11-27 21:57:41 +0900307 "OperationLimiterTest.cpp",
Mike Yu0ee1dc92020-11-09 14:56:54 +0800308 "PrivateDnsConfigurationTest.cpp",
Mike Yuc52739e2018-10-19 21:06:32 +0800309 ],
Mike Yuc52739e2018-10-19 21:06:32 +0800310}
Luke Huangfd17c542021-03-17 14:27:28 +0800311
312rust_ffi_static {
313 name: "libdoh_ffi",
314 enabled: support_rust_toolchain,
315 crate_name: "doh",
316 srcs: ["doh.rs"],
317 edition: "2018",
318
319 rlibs: [
320 "libandroid_logger",
321 "libanyhow",
322 "liblazy_static",
323 "liblibc",
324 "liblog_rust",
325 "libquiche",
326 "libring",
327 "libtokio",
328 "liburl",
329 ],
330 prefer_rlib: true,
331
332 shared_libs: [
333 "libcrypto",
334 "libssl",
335 ],
336
337 apex_available: [
338 "//apex_available:platform", // Needed by doh_ffi_test
339 "com.android.resolv"
340 ],
341 min_sdk_version: "29",
342}
343
344cc_test {
345 name: "doh_ffi_test",
346 enabled: support_rust_toolchain,
347 test_suites: [
348 "general-tests",
349 ],
350 defaults: ["netd_defaults"],
351 srcs: ["doh_ffi_test.cpp"],
352 static_libs: [
353 "libdoh_ffi",
354 "libgmock",
355 "liblog",
356 "libring-core",
357 ],
358 // These are not carried over from libdoh_ffi.
359 shared_libs: [
360 "libcrypto",
361 "libssl",
362 ],
363 min_sdk_version: "29",
364}
Luke Huang744f7c22021-04-15 04:15:43 +0000365
366rust_test {
367 name: "doh_unit_test",
368 enabled: support_rust_toolchain,
369 crate_name: "doh",
370 srcs: ["doh.rs"],
371 edition: "2018",
372 test_suites: ["general-tests"],
373 auto_gen_config: true,
374 rustlibs: [
375 "libandroid_logger",
376 "libanyhow",
377 "liblazy_static",
378 "liblibc",
379 "liblog_rust",
380 "libquiche",
381 "libring",
382 "libtokio",
383 "liburl",
384 ],
385 min_sdk_version: "29",
386}