blob: 5a11254d6d892e989fd6f503842515245e7324b2 [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",
51 export_include_dirs: ["include/dnsproxyd_protocol"],
Remi NGUYEN VAN35e9af02020-11-27 18:59:19 +090052 apex_available: [
53 "//apex_available:platform",
54 "com.android.tethering",
55 ],
Luke Huang27616fe2020-05-26 17:31:15 +080056}
57
Jeongik Chae8fe5a52021-03-05 21:18:33 +090058dnsresolver_aidl_interface_lateststable_version = "V7"
59
60cc_library_static {
61 name: "dnsresolver_aidl_interface-lateststable-ndk_platform",
62 whole_static_libs: [
63 "dnsresolver_aidl_interface-" + dnsresolver_aidl_interface_lateststable_version + "-ndk_platform",
64 ],
65 apex_available: [
66 "com.android.resolv",
67 ],
68 min_sdk_version: "29",
69}
70
Luke Huang403c0442019-02-25 15:33:42 +080071aidl_interface {
72 name: "dnsresolver_aidl_interface",
73 local_include_dir: "binder",
74 srcs: [
75 "binder/android/net/IDnsResolver.aidl",
chenbrucefd837fa2019-10-29 18:35:36 +080076 "binder/android/net/ResolverHostsParcel.aidl",
Ken Chena6ac2a62020-04-07 17:25:56 +080077 "binder/android/net/ResolverOptionsParcel.aidl",
waynema37255182019-03-18 13:22:56 +080078 "binder/android/net/ResolverParamsParcel.aidl",
paulhub6d71b62020-11-17 00:29:29 +080079 // New AIDL classes should go into android.net.resolv.aidl so they can be clearly identified
80 "binder/android/net/resolv/aidl/**/*.aidl",
Luke Huang403c0442019-02-25 15:33:42 +080081 ],
Hungming Chena32c8c12019-01-25 10:47:40 +080082 imports: [
83 "netd_event_listener_interface",
84 ],
Luke Huang598daad2019-05-02 18:10:15 +080085 backend: {
chenbruce66ba90d2020-02-25 14:53:39 +080086 java: {
87 apex_available: [
Jiyong Park27b9a8a2020-04-07 16:37:01 +090088 "//apex_available:platform",
chenbruce76035f62020-03-16 00:12:59 +080089 "com.android.bluetooth.updatable",
Remi NGUYEN VANcbc998a2021-03-22 11:17:46 +000090 "com.android.tethering",
chenbruce66ba90d2020-02-25 14:53:39 +080091 "com.android.wifi",
92 ],
93 },
Luke Huang598daad2019-05-02 18:10:15 +080094 ndk: {
95 gen_log: true,
Jiyong Parkf29f09b2020-04-08 23:39:45 +090096 apex_available: [
97 "com.android.resolv",
98 ],
Jooyung Han105a9bc2020-04-16 18:48:33 +090099 min_sdk_version: "29",
Luke Huang598daad2019-05-02 18:10:15 +0800100 },
101 },
Luke Huang5aa6a992019-04-29 22:02:11 +0800102 versions: [
103 "1",
104 "2",
Luke Huang0fc985f2019-11-14 19:18:14 +0800105 "3",
Luke Huange1ddf092020-04-08 01:41:02 +0800106 "4",
Lorenzo Colittia126c242020-05-21 18:07:40 +0900107 "5",
Ken Chenb52a7812020-06-19 17:19:07 +0800108 "6",
paulhub6d71b62020-11-17 00:29:29 +0800109 "7",
Luke Huang5aa6a992019-04-29 22:02:11 +0800110 ],
Luke Huang403c0442019-02-25 15:33:42 +0800111}
112
Luke Huang45b761c2020-03-20 22:30:43 +0800113cc_defaults {
114 name: "resolv_test_defaults",
115 // Note that, static link liblog and libbase is a hard requirement for resolv related tests
116 // because libbase is not compatible between Q and R for general platform build due
117 // to its log revelant functions changing. And most of resolv related tests must be able to run
118 // in Q.
119 static_libs: [
120 "libbase",
121 "liblog",
122 ],
123}
124
Luke Huang0b6c4932020-03-27 17:40:07 +0800125cc_defaults {
126 // This is necessary to have the coverage tests run on cf_x86_phone.
127 // Because the test_suite target is 64 bit and the test infra is running the 64 bit test
128 // suite on cf_x86_phone (32-bit) for coverage.
129 // See b/147785146 for details.
130 // TODO: Remove this target after coverage test switched to 64-bit device.
131 name: "resolv_test_mts_coverage_defaults",
132 test_config_template: ":resolv_test_config_template",
133 compile_multilib: "both",
134 multilib: {
135 lib32: {
136 suffix: "32",
137 },
138 lib64: {
139 suffix: "64",
140 },
141 },
142}
143
Lorenzo Colitti8505af42018-12-19 20:30:41 +0900144cc_library {
Bernie Innocentiafaacf72018-08-30 07:34:37 +0900145 name: "libnetd_resolv",
Bernie Innocenti1e886742018-10-25 18:41:47 +0900146 version_script: "libnetd_resolv.map.txt",
Jooyung Han41fa73d2019-11-27 15:41:44 +0900147 stubs: {
148 versions: [
149 "1",
150 ],
151 symbol_file: "libnetd_resolv.map.txt",
152 },
Bernie Innocentiafaacf72018-08-30 07:34:37 +0900153 defaults: ["netd_defaults"],
154 srcs: [
Bernie Innocenti9c575932018-09-07 21:10:25 +0900155 "getaddrinfo.cpp",
156 "gethnamaddr.cpp",
157 "sethostent.cpp",
158 "res_cache.cpp",
159 "res_comp.cpp",
Bernie Innocenti9c575932018-09-07 21:10:25 +0900160 "res_debug.cpp",
Bernie Innocenti9c575932018-09-07 21:10:25 +0900161 "res_mkquery.cpp",
162 "res_query.cpp",
163 "res_send.cpp",
Bernie Innocenti9c575932018-09-07 21:10:25 +0900164 "res_stats.cpp",
Mike Yu021c3e12019-10-08 17:29:34 +0800165 "util.cpp",
Luke Huang7b26b202019-03-28 14:09:24 +0800166 "Dns64Configuration.cpp",
Mike Yu19108d52018-11-15 21:58:19 +0800167 "DnsProxyListener.cpp",
Mike Yu939e3692019-10-29 17:28:34 +0800168 "DnsQueryLog.cpp",
Luke Huang36796f32019-03-13 02:54:45 +0800169 "DnsResolver.cpp",
Luke Huang403c0442019-02-25 15:33:42 +0800170 "DnsResolverService.cpp",
Mike Yue655b1d2019-08-28 17:49:59 +0800171 "DnsStats.cpp",
Mike Yubab3daa2018-10-19 22:11:43 +0800172 "DnsTlsDispatcher.cpp",
173 "DnsTlsQueryMap.cpp",
174 "DnsTlsTransport.cpp",
175 "DnsTlsServer.cpp",
176 "DnsTlsSessionCache.cpp",
177 "DnsTlsSocket.cpp",
Luke Huangf40df9c2020-04-21 08:51:48 +0800178 "Experiments.cpp",
Mike Yub601ff72018-11-01 20:07:00 +0800179 "PrivateDnsConfiguration.cpp",
Luke Huang7b26b202019-03-28 14:09:24 +0800180 "ResolverController.cpp",
Mike Yu39cc6892018-12-14 16:18:27 +0800181 "ResolverEventReporter.cpp",
Bernie Innocentiafaacf72018-08-30 07:34:37 +0900182 ],
Tobias Thierer469b6332019-08-28 20:25:33 +0100183 // Link most things statically to minimize our dependence on system ABIs.
Bernie Innocenti2a9244c2018-09-13 16:12:56 +0900184 stl: "libc++_static",
Bernie Innocenti9f05f5e2018-09-12 23:20:10 +0900185 static_libs: [
Jeongik Chae8fe5a52021-03-05 21:18:33 +0900186 "dnsresolver_aidl_interface-lateststable-ndk_platform",
Bernie Innocenti9f05f5e2018-09-12 23:20:10 +0900187 "libbase",
Mike Yu19108d52018-11-15 21:58:19 +0800188 "libcutils",
Mike Yubab3daa2018-10-19 22:11:43 +0800189 "libnetdutils",
Bernie Innocenti83a968f2019-06-27 14:35:53 +0900190 "libprotobuf-cpp-lite",
lifr9b87e362019-05-08 13:00:14 +0800191 "libstatslog_resolv",
Muhammad Qureshi10b3d272019-12-03 15:25:19 -0800192 "libstatspush_compat",
Mike Yu19108d52018-11-15 21:58:19 +0800193 "libsysutils",
Jeongik Chae8fe5a52021-03-05 21:18:33 +0900194 "netd_event_listener_interface-lateststable-ndk_platform",
waynemaa74195e2019-01-18 14:02:31 +0800195 "server_configurable_flags",
lifr9b87e362019-05-08 13:00:14 +0800196 "stats_proto",
Mike Yu39cc6892018-12-14 16:18:27 +0800197 ],
Tobias Thierer469b6332019-08-28 20:25:33 +0100198 // libcrypto needs to be used as a shared library because it performs an
199 // integrity check (against a checksum) that is not supported for static
200 // libs. See http://b/141248879
201 // We're also adding libssl here to treat it consistently.
Jiyong Parkdd938dd2020-03-09 14:35:37 +0900202 // liblog is added as a shared library because it provides stable C API
203 // from the platform; we don't need to include it in this module by
204 // statically linking to it. Doing so is even dangerous because the socket
205 // protocol to logd implemented in the library isn't guaranteed to be
206 // stable. See b/151051671
Mike Yu39cc6892018-12-14 16:18:27 +0800207 shared_libs: [
208 "libbinder_ndk",
Tobias Thierer469b6332019-08-28 20:25:33 +0100209 "libcrypto",
Jiyong Parkdd938dd2020-03-09 14:35:37 +0900210 "liblog", //Used by libstatslog_resolv
Tobias Thierer469b6332019-08-28 20:25:33 +0100211 "libssl",
Mike Yu19108d52018-11-15 21:58:19 +0800212 ],
Luke Huangf4c98f22019-06-14 01:57:00 +0800213 header_libs: [
Luke Huang27616fe2020-05-26 17:31:15 +0800214 "libnetdbinder_utils_headers",
Mike Yubab3daa2018-10-19 22:11:43 +0800215 ],
Ruchir Rastogicf96e8b2020-02-26 10:36:18 -0800216 runtime_libs: [
217 // Causes the linkerconfig to create a namespace link from resolv to the
218 // libstatssocket library within the statsd apex
219 "libstatssocket",
220 ],
Bernie Innocentiac18b122018-10-01 23:10:18 +0900221 export_include_dirs: ["include"],
chenbruce99cbfd82019-09-05 15:08:13 +0800222
Bernie Innocenti9f05f5e2018-09-12 23:20:10 +0900223 product_variables: {
224 debuggable: {
225 cppflags: [
226 "-DRESOLV_ALLOW_VERBOSE_LOGGING=1",
227 ],
228 },
229 },
Ken Chen4961dfe2019-11-15 09:03:29 +0800230 header_abi_checker: {
231 enabled: true,
232 symbol_file: "libnetd_resolv.map.txt",
233 },
Ken Chenf5573fd2020-01-14 01:51:05 +0800234 sanitize: {
235 cfi: true,
Ken Chenf5573fd2020-01-14 01:51:05 +0800236 },
Jiyong Parkf29f09b2020-04-08 23:39:45 +0900237 apex_available: ["com.android.resolv"],
Jooyung Han105a9bc2020-04-16 18:48:33 +0900238 min_sdk_version: "29",
Bernie Innocentiafaacf72018-08-30 07:34:37 +0900239}
Mike Yuc52739e2018-10-19 21:06:32 +0800240
lifr9b87e362019-05-08 13:00:14 +0800241cc_library_static {
242 name: "stats_proto",
243 defaults: ["netd_defaults"],
244 proto: {
245 export_proto_headers: true,
246 type: "lite",
247 },
248 srcs: [
249 "stats.proto",
250 ],
Jiyong Parkf29f09b2020-04-08 23:39:45 +0900251 apex_available: ["com.android.resolv"],
Jooyung Han105a9bc2020-04-16 18:48:33 +0900252 min_sdk_version: "29",
lifr9b87e362019-05-08 13:00:14 +0800253}
254
255genrule {
256 name: "statslog_resolv.h",
257 tools: ["stats-log-api-gen"],
258 cmd: "$(location stats-log-api-gen) --header $(genDir)/statslog_resolv.h --module resolv --namespace android,net,stats",
259 out: [
260 "statslog_resolv.h",
261 ],
262}
263
264genrule {
265 name: "statslog_resolv.cpp",
266 tools: ["stats-log-api-gen"],
Muhammad Qureshi10b3d272019-12-03 15:25:19 -0800267 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 +0800268 out: [
269 "statslog_resolv.cpp",
270 ],
271}
272
273cc_library_static {
274 name: "libstatslog_resolv",
275 generated_sources: ["statslog_resolv.cpp"],
276 generated_headers: ["statslog_resolv.h"],
277 defaults: ["netd_defaults"],
278 export_generated_headers: ["statslog_resolv.h"],
279 static_libs: [
280 "libcutils",
Muhammad Qureshi10b3d272019-12-03 15:25:19 -0800281 "libgtest_prod", // Used by libstatspush_compat
282 "libstatspush_compat",
lifr9b87e362019-05-08 13:00:14 +0800283 ],
Jiyong Parkf29f09b2020-04-08 23:39:45 +0900284 apex_available: ["com.android.resolv"],
Jooyung Han105a9bc2020-04-16 18:48:33 +0900285 min_sdk_version: "29",
lifr9b87e362019-05-08 13:00:14 +0800286}
287
Luke Huang6b7ff612020-03-25 15:23:41 +0800288filegroup {
289 name: "resolv_test_config_template",
290 srcs: [
291 "resolv_test_config_template.xml",
292 ],
293}
294
Pirama Arumuga Nainar6d14bb32021-03-09 14:11:05 -0800295filegroup {
296 name: "resolv_unit_test_files",
Mike Yuc52739e2018-10-19 21:06:32 +0800297 srcs: [
Mike Yu39df0b12019-10-31 16:12:23 +0800298 "DnsQueryLogTest.cpp",
Luke Huangf40df9c2020-04-21 08:51:48 +0800299 "DnsStatsTest.cpp",
300 "ExperimentsTest.cpp",
Bernie Innocentiac6c9a42020-11-27 21:57:41 +0900301 "OperationLimiterTest.cpp",
Mike Yu0ee1dc92020-11-09 14:56:54 +0800302 "PrivateDnsConfigurationTest.cpp",
Mike Yuc52739e2018-10-19 21:06:32 +0800303 ],
Mike Yuc52739e2018-10-19 21:06:32 +0800304}