1package { 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 33cc_library_headers { 34 name: "libnetd_resolv_headers", 35 export_include_dirs: ["include"], 36} 37 38// Used only by dns_responder_client_ndk.cpp for ResolverStats.h 39// TODO: refactor stats to use a Parcel and eliminate this dependency 40cc_library_headers { 41 name: "libnetd_resolv_internal_headers", 42 export_include_dirs: ["."], 43} 44 45cc_library_headers { 46 name: "dnsproxyd_protocol_headers", 47 sdk_version: "29", 48 min_sdk_version: "29", 49 export_include_dirs: ["include/dnsproxyd_protocol"], 50 apex_available: [ 51 "//apex_available:platform", 52 "com.android.tethering", 53 ], 54} 55 56dnsresolver_aidl_interface_lateststable_version = "V11" 57 58cc_library_static { 59 name: "dnsresolver_aidl_interface-lateststable-ndk", 60 whole_static_libs: [ 61 "dnsresolver_aidl_interface-" + dnsresolver_aidl_interface_lateststable_version + "-ndk", 62 ], 63 apex_available: [ 64 "com.android.resolv", 65 ], 66 min_sdk_version: "29", 67} 68 69aidl_interface { 70 name: "dnsresolver_aidl_interface", 71 local_include_dir: "binder", 72 srcs: [ 73 "binder/android/net/IDnsResolver.aidl", 74 "binder/android/net/ResolverHostsParcel.aidl", 75 "binder/android/net/ResolverOptionsParcel.aidl", 76 "binder/android/net/ResolverParamsParcel.aidl", 77 // New AIDL classes should go into android.net.resolv.aidl so they can be clearly identified 78 "binder/android/net/resolv/aidl/**/*.aidl", 79 ], 80 imports: [ 81 "netd_event_listener_interface-V1", 82 ], 83 backend: { 84 java: { 85 apex_available: [ 86 "com.android.tethering", 87 "com.android.wifi", 88 ], 89 min_sdk_version: "30", 90 }, 91 ndk: { 92 gen_log: true, 93 apex_available: [ 94 "com.android.resolv", 95 ], 96 min_sdk_version: "29", 97 }, 98 }, 99 versions: [ 100 "1", 101 "2", 102 "3", 103 "4", 104 "5", 105 "6", 106 "7", 107 "8", 108 "9", 109 "10", 110 "11", 111 ], 112 dumpapi: { 113 no_license: true, 114 }, 115} 116 117cc_defaults { 118 name: "resolv_test_defaults", 119 cflags: [ 120 // networkCreatePhysical and networkCreateVpn were deprecated from netd_aidl_interface v6. 121 "-Wno-error=deprecated-declarations", 122 ], 123 // Note that, static link liblog and libbase is a hard requirement for resolv related tests 124 // because libbase is not compatible between Q and R for general platform build due 125 // to its log revelant functions changing. And most of resolv related tests must be able to run 126 // in Q. 127 static_libs: [ 128 "libbase", 129 "liblog", 130 ], 131 // This field is required to make test compatible with Q devices. 132 min_sdk_version: "29", 133} 134 135cc_defaults { 136 // This is necessary to have the coverage tests run on cf_x86_phone. 137 // Because the test_suite target is 64 bit and the test infra is running the 64 bit test 138 // suite on cf_x86_phone (32-bit) for coverage. 139 // See b/147785146 for details. 140 // TODO: Remove this target after coverage test switched to 64-bit device. 141 name: "resolv_test_mts_coverage_defaults", 142 test_config_template: ":resolv_test_config_template", 143 compile_multilib: "both", 144 multilib: { 145 lib32: { 146 suffix: "32", 147 }, 148 lib64: { 149 suffix: "64", 150 }, 151 }, 152 // 'resolv_test_config_template' used DisableConfigSyncTargetPreparer provided 153 // by net-tests-utils-host-common; adding it to make the host jar available 154 // after the build process. 155 host_required: [ 156 "net-tests-utils-host-common", 157 ] 158} 159 160cc_defaults { 161 // Similar to resolv_test_mts_coverage_defaults, but it's for the tests that don't need 162 // root access. 163 name: "resolv_test_mts_coverage_without_root_defaults", 164 test_config_template: ":resolv_test_config_without_root_template", 165 compile_multilib: "both", 166 multilib: { 167 lib32: { 168 suffix: "32", 169 }, 170 lib64: { 171 suffix: "64", 172 }, 173 }, 174 // 'resolv_test_config_without_root_template' used DisableConfigSyncTargetPreparer 175 // provided by net-tests-utils-host-common; adding it to make the host jar available 176 // after the build process. 177 host_required: [ 178 "net-tests-utils-host-common", 179 ] 180} 181 182cc_library { 183 name: "libnetd_resolv", 184 version_script: "libnetd_resolv.map.txt", 185 stubs: { 186 versions: [ 187 "1", 188 ], 189 symbol_file: "libnetd_resolv.map.txt", 190 }, 191 defaults: ["netd_defaults"], 192 srcs: [ 193 "getaddrinfo.cpp", 194 "gethnamaddr.cpp", 195 "sethostent.cpp", 196 "res_cache.cpp", 197 "res_comp.cpp", 198 "res_debug.cpp", 199 "res_mkquery.cpp", 200 "res_query.cpp", 201 "res_send.cpp", 202 "res_stats.cpp", 203 "util.cpp", 204 "Dns64Configuration.cpp", 205 "DnsProxyListener.cpp", 206 "DnsQueryLog.cpp", 207 "DnsResolver.cpp", 208 "DnsResolverService.cpp", 209 "DnsStats.cpp", 210 "DnsTlsDispatcher.cpp", 211 "DnsTlsQueryMap.cpp", 212 "DnsTlsTransport.cpp", 213 "DnsTlsServer.cpp", 214 "DnsTlsSessionCache.cpp", 215 "DnsTlsSocket.cpp", 216 "Experiments.cpp", 217 "PrivateDnsConfiguration.cpp", 218 "ResolverController.cpp", 219 "ResolverEventReporter.cpp", 220 ], 221 // Link most things statically to minimize our dependence on system ABIs. 222 stl: "libc++_static", 223 static_libs: [ 224 "dnsresolver_aidl_interface-lateststable-ndk", 225 "libbase", 226 "libcutils", 227 "libnetdutils", 228 "libdoh_ffi", 229 "libmodules-utils-build", 230 "libprotobuf-cpp-lite", 231 "libstatslog_resolv", 232 "libstatspush_compat", 233 "libsysutils", 234 "libutils", 235 "netd_event_listener_interface-lateststable-ndk", 236 "server_configurable_flags", 237 "stats_proto", 238 ], 239 // libcrypto needs to be used as a shared library because it performs an 240 // integrity check (against a checksum) that is not supported for static 241 // libs. See http://b/141248879 242 // We're also adding libssl here to treat it consistently. 243 // liblog is added as a shared library because it provides stable C API 244 // from the platform; we don't need to include it in this module by 245 // statically linking to it. Doing so is even dangerous because the socket 246 // protocol to logd implemented in the library isn't guaranteed to be 247 // stable. See b/151051671 248 shared_libs: [ 249 "libbinder_ndk", 250 "libcrypto", 251 "liblog", //Used by libstatslog_resolv 252 "libssl", 253 ], 254 header_libs: [ 255 "libnetdbinder_utils_headers", 256 ], 257 runtime_libs: [ 258 // Causes the linkerconfig to create a namespace link from resolv to the 259 // libstatssocket library within the statsd apex 260 "libstatssocket", 261 ], 262 export_include_dirs: ["include"], 263 264 product_variables: { 265 debuggable: { 266 cppflags: [ 267 "-DRESOLV_ALLOW_VERBOSE_LOGGING=1", 268 ], 269 }, 270 }, 271 header_abi_checker: { 272 enabled: true, 273 symbol_file: "libnetd_resolv.map.txt", 274 }, 275 sanitize: { 276 cfi: true, 277 }, 278 apex_available: ["com.android.resolv"], 279 min_sdk_version: "29", 280} 281 282cc_library_static { 283 name: "stats_proto", 284 defaults: ["netd_defaults"], 285 proto: { 286 export_proto_headers: true, 287 type: "lite", 288 }, 289 srcs: [ 290 "stats.proto", 291 ], 292 apex_available: ["com.android.resolv"], 293 min_sdk_version: "29", 294} 295 296genrule { 297 name: "statslog_resolv.h", 298 tools: ["stats-log-api-gen"], 299 cmd: "$(location stats-log-api-gen) --header $(genDir)/statslog_resolv.h --module resolv" + 300 " --namespace android,net,stats --minApiLevel 29", 301 out: [ 302 "statslog_resolv.h", 303 ], 304} 305 306genrule { 307 name: "statslog_resolv.cpp", 308 tools: ["stats-log-api-gen"], 309 cmd: "$(location stats-log-api-gen) --cpp $(genDir)/statslog_resolv.cpp --module resolv" + 310 " --namespace android,net,stats --importHeader statslog_resolv.h --minApiLevel 29", 311 out: [ 312 "statslog_resolv.cpp", 313 ], 314} 315 316cc_library_static { 317 name: "libstatslog_resolv", 318 generated_sources: ["statslog_resolv.cpp"], 319 generated_headers: ["statslog_resolv.h"], 320 defaults: ["netd_defaults"], 321 export_generated_headers: ["statslog_resolv.h"], 322 static_libs: [ 323 "libcutils", 324 "libstatspush_compat", 325 ], 326 header_libs: [ 327 "libgtest_prod_headers", // Used by libstatspush_compat 328 ], 329 apex_available: ["com.android.resolv"], 330 min_sdk_version: "29", 331} 332 333filegroup { 334 name: "resolv_test_config_template", 335 srcs: [ 336 "resolv_test_config_template.xml", 337 ], 338} 339 340filegroup { 341 name: "resolv_test_config_without_root_template", 342 srcs: [ 343 "resolv_test_config_without_root_template.xml", 344 ], 345} 346 347filegroup { 348 name: "resolv_unit_test_files", 349 srcs: [ 350 "DnsQueryLogTest.cpp", 351 "DnsStatsTest.cpp", 352 "ExperimentsTest.cpp", 353 "OperationLimiterTest.cpp", 354 "PrivateDnsConfigurationTest.cpp", 355 ], 356} 357 358doh_rust_deps = [ 359 "libandroid_logger", 360 "libanyhow", 361 "libbase64_rust", 362 "libfutures", 363 "liblibc", 364 "liblog_rust", 365 "libring", 366 "libthiserror", 367 "libtokio", 368 "liburl", 369] 370 371rust_ffi_static { 372 name: "libdoh_ffi", 373 crate_name: "doh", 374 srcs: ["doh/doh.rs"], 375 edition: "2018", 376 377 rlibs: doh_rust_deps + ["libquiche"], 378 prefer_rlib: true, 379 380 shared_libs: [ 381 "libcrypto", 382 "libssl", 383 ], 384 385 apex_available: [ 386 "//apex_available:platform", // Needed by doh_ffi_test 387 "com.android.resolv", 388 ], 389 min_sdk_version: "29", 390} 391 392rust_test { 393 name: "doh_unit_test", 394 crate_name: "doh", 395 srcs: ["doh/doh.rs"], 396 edition: "2018", 397 test_suites: ["general-tests"], 398 auto_gen_config: true, 399 rustlibs: doh_rust_deps + ["libquiche_static"], 400 min_sdk_version: "29", 401} 402 403// It's required by unit tests. 404rust_ffi_static { 405 name: "libdoh_ffi_for_test", 406 crate_name: "doh", 407 srcs: ["doh/doh.rs"], 408 edition: "2018", 409 410 rlibs: doh_rust_deps + ["libquiche_static"], 411 prefer_rlib: true, 412 // TODO(b/194022174), for unit tests to run on the Android 10 platform, 413 // libunwind must be statically linked. 414 whole_static_libs: ["libunwind"], 415 apex_available: [ 416 "//apex_available:platform", // Needed by doh_ffi_test 417 "com.android.resolv", 418 ], 419 min_sdk_version: "29", 420} 421 422rust_ffi_static { 423 // Combines libdoh_frontend_ffi and libdoh_ffi for fuzzing test. 424 // Includes multiple static rust libraries will cause duplicate symbol error. 425 name: "libdoh_fuzz_ffi", 426 crate_name: "doh_fuzz_ffi", 427 srcs: [ 428 "doh/doh_test_superset_for_fuzzer.rs", 429 ], 430 edition: "2018", 431 432 rlibs: [ 433 "libandroid_logger", 434 "libanyhow", 435 "libbase64_rust", 436 "libfutures", 437 "liblazy_static", 438 "liblibc", 439 "liblog_rust", 440 "libquiche_static", 441 "libring", 442 "libthiserror", 443 "libtokio", 444 "liburl", 445 ], 446 447 whole_static_libs: ["libunwind"], 448} 449