-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Android.bp
517 lines (481 loc) · 13.9 KB
/
Android.bp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
package {
default_team: "trendy_team_fwk_core_networking",
default_applicable_licenses: ["packages_modules_DnsResolver_license"],
}
// Added automatically by a large-scale-change that took the approach of
// 'apply every license found to every target'. While this makes sure we respect
// every license restriction, it may not be entirely correct.
//
// e.g. GPL in an MIT project might only apply to the contrib/ directory.
//
// Please consider splitting the single license below into multiple licenses,
// taking care not to lose any license_kind information, and overriding the
// default license using the 'licenses: [...]' property on targets as needed.
//
// For unused files, consider creating a 'fileGroup' with "//visibility:private"
// to attach the license to, and including a comment whether the files may be
// used in the current project.
// See: http://go/android-license-faq
license {
name: "packages_modules_DnsResolver_license",
visibility: [":__subpackages__"],
license_kinds: [
"SPDX-license-identifier-Apache-2.0",
"SPDX-license-identifier-BSD",
"SPDX-license-identifier-ISC",
"SPDX-license-identifier-MIT",
],
license_text: [
"NOTICE",
],
}
cc_library_headers {
name: "libnetd_resolv_headers",
export_include_dirs: ["include"],
}
// Used only by dns_responder_client_ndk.cpp for ResolverStats.h
// TODO: refactor stats to use a Parcel and eliminate this dependency
cc_library_headers {
name: "libnetd_resolv_internal_headers",
export_include_dirs: ["."],
}
cc_library_headers {
name: "dnsproxyd_protocol_headers",
sdk_version: "30",
min_sdk_version: "30",
export_include_dirs: ["include/dnsproxyd_protocol"],
apex_available: [
"//apex_available:platform",
"com.android.tethering",
],
}
dnsresolver_aidl_interface_lateststable_version = "V15"
cc_library_static {
name: "dnsresolver_aidl_interface-lateststable-ndk",
whole_static_libs: [
"dnsresolver_aidl_interface-" + dnsresolver_aidl_interface_lateststable_version + "-ndk",
],
apex_available: [
"com.android.resolv",
],
min_sdk_version: "30",
}
aidl_interface {
name: "dnsresolver_aidl_interface",
local_include_dir: "binder",
srcs: [
"binder/android/net/IDnsResolver.aidl",
"binder/android/net/ResolverHostsParcel.aidl",
"binder/android/net/ResolverOptionsParcel.aidl",
"binder/android/net/ResolverParamsParcel.aidl",
// New AIDL classes should go into android.net.resolv.aidl so they can be clearly identified
"binder/android/net/resolv/aidl/**/*.aidl",
],
imports: [
"netd_event_listener_interface-V1",
],
backend: {
java: {
apex_available: [
"com.android.tethering",
"com.android.wifi",
],
min_sdk_version: "30",
},
ndk: {
gen_log: true,
apex_available: [
"com.android.resolv",
],
min_sdk_version: "30",
},
},
dumpapi: {
no_license: true,
},
versions_with_info: [
{
version: "1",
imports: ["netd_event_listener_interface-V1"],
},
{
version: "2",
imports: ["netd_event_listener_interface-V1"],
},
{
version: "3",
imports: ["netd_event_listener_interface-V1"],
},
{
version: "4",
imports: ["netd_event_listener_interface-V1"],
},
{
version: "5",
imports: ["netd_event_listener_interface-V1"],
},
{
version: "6",
imports: ["netd_event_listener_interface-V1"],
},
{
version: "7",
imports: ["netd_event_listener_interface-V1"],
},
{
version: "8",
imports: ["netd_event_listener_interface-V1"],
},
{
version: "9",
imports: ["netd_event_listener_interface-V1"],
},
{
version: "10",
imports: ["netd_event_listener_interface-V1"],
},
{
version: "11",
imports: ["netd_event_listener_interface-V1"],
},
{
version: "12",
imports: ["netd_event_listener_interface-V1"],
},
{
version: "13",
imports: ["netd_event_listener_interface-V1"],
},
{
version: "14",
imports: ["netd_event_listener_interface-V1"],
},
{
version: "15",
imports: ["netd_event_listener_interface-V1"],
},
],
frozen: true,
}
filegroup {
name: "resolv_test_default_map",
srcs: ["resolv_test_default.map"],
}
cc_defaults {
name: "resolv_test_defaults",
cflags: [
// networkCreatePhysical and networkCreateVpn were deprecated from netd_aidl_interface v6.
"-Wno-error=deprecated-declarations",
],
// The resolv-related tests run on older platform versions, so many libraries (such as
// libbase and libc++) need to be linked statically. The tests also need to be linked with a
// version script to ensure that the statically-linked library isn't exported from the
// executable, where it would override the shared libraries that the platform itself uses. See
// b/333438055 for an example of what goes wrong when libc++ is partially exported from an
// executable.
version_script: ":resolv_test_default_map",
stl: "libc++_static",
static_libs: [
"libbase",
],
shared_libs: [
"liblog",
],
min_sdk_version: "30",
}
cc_defaults {
// This is necessary to have the coverage tests run on cf_x86_phone.
// Because the test_suite target is 64 bit and the test infra is running the 64 bit test
// suite on cf_x86_phone (32-bit) for coverage.
// See b/147785146 for details.
// TODO: Remove this target after coverage test switched to 64-bit device.
name: "resolv_test_mts_coverage_defaults",
test_config_template: ":resolv_test_config_template",
compile_multilib: "both",
multilib: {
lib32: {
suffix: "32",
},
lib64: {
suffix: "64",
},
},
// 'resolv_test_config_template' used DisableConfigSyncTargetPreparer provided
// by net-tests-utils-host-common; adding it to make the host jar available
// after the build process.
host_required: [
"net-tests-utils-host-common",
],
}
cc_defaults {
// Similar to resolv_test_mts_coverage_defaults, but it's for the tests that don't need
// root access.
name: "resolv_test_mts_coverage_without_root_defaults",
test_config_template: ":resolv_test_config_without_root_template",
compile_multilib: "both",
multilib: {
lib32: {
suffix: "32",
},
lib64: {
suffix: "64",
},
},
// 'resolv_test_config_without_root_template' used DisableConfigSyncTargetPreparer
// provided by net-tests-utils-host-common; adding it to make the host jar available
// after the build process.
host_required: [
"net-tests-utils-host-common",
],
}
cc_library {
name: "libnetd_resolv",
version_script: "libnetd_resolv.map.txt",
stubs: {
versions: [
"1",
],
symbol_file: "libnetd_resolv.map.txt",
},
defaults: ["netd_defaults"],
srcs: [
"getaddrinfo.cpp",
"gethnamaddr.cpp",
"sethostent.cpp",
"res_cache.cpp",
"res_comp.cpp",
"res_debug.cpp",
"res_mkquery.cpp",
"res_query.cpp",
"res_send.cpp",
"res_stats.cpp",
"util.cpp",
"Dns64Configuration.cpp",
"DnsProxyListener.cpp",
"DnsQueryLog.cpp",
"DnsResolver.cpp",
"DnsResolverService.cpp",
"DnsStats.cpp",
"DnsTlsDispatcher.cpp",
"DnsTlsQueryMap.cpp",
"DnsTlsTransport.cpp",
"DnsTlsServer.cpp",
"DnsTlsSessionCache.cpp",
"DnsTlsSocket.cpp",
"Experiments.cpp",
"PrivateDnsConfiguration.cpp",
"ResolverController.cpp",
"ResolverEventReporter.cpp",
],
// Link most things statically to minimize our dependence on system ABIs.
stl: "libc++_static",
static_libs: [
"dnsresolver_aidl_interface-lateststable-ndk",
"libbase",
"libcutils",
"libnetdutils",
"libdoh_ffi",
"libmodules-utils-build",
"libprotobuf-cpp-lite",
"libstatslog_resolv",
"libsysutils",
"netd_event_listener_interface-lateststable-ndk",
"server_configurable_flags",
"stats_proto",
],
// libcrypto needs to be used as a shared library because it performs an
// integrity check (against a checksum) that is not supported for static
// libs. See http://b/141248879
// We're also adding libssl here to treat it consistently.
// liblog is added as a shared library because it provides stable C API
// from the platform; we don't need to include it in this module by
// statically linking to it. Doing so is even dangerous because the socket
// protocol to logd implemented in the library isn't guaranteed to be
// stable. See b/151051671
shared_libs: [
"libbinder_ndk",
"libcrypto",
"liblog", //Used by libstatslog_resolv
"libssl",
"libstatssocket",
],
runtime_libs: [
"libcom.android.tethering.dns_helper",
],
header_libs: [
"libnetdbinder_utils_headers",
],
export_include_dirs: ["include"],
product_variables: {
debuggable: {
cppflags: [
"-DRESOLV_ALLOW_VERBOSE_LOGGING=1",
],
},
},
header_abi_checker: {
enabled: true,
symbol_file: "libnetd_resolv.map.txt",
},
sanitize: {
cfi: true,
},
apex_available: ["com.android.resolv"],
min_sdk_version: "30",
}
cc_library_static {
name: "stats_proto",
defaults: ["netd_defaults"],
proto: {
export_proto_headers: true,
type: "lite",
},
srcs: [
"stats.proto",
],
apex_available: ["com.android.resolv"],
min_sdk_version: "30",
}
genrule {
name: "statslog_resolv.h",
tools: ["stats-log-api-gen"],
cmd: "$(location stats-log-api-gen) --header $(genDir)/statslog_resolv.h --module resolv" +
" --namespace android,net,stats --minApiLevel 30",
out: [
"statslog_resolv.h",
],
}
genrule {
name: "statslog_resolv.cpp",
tools: ["stats-log-api-gen"],
cmd: "$(location stats-log-api-gen) --cpp $(genDir)/statslog_resolv.cpp --module resolv" +
" --namespace android,net,stats --importHeader statslog_resolv.h --minApiLevel 30",
out: [
"statslog_resolv.cpp",
],
}
cc_library_static {
name: "libstatslog_resolv",
generated_sources: ["statslog_resolv.cpp"],
generated_headers: ["statslog_resolv.h"],
defaults: ["netd_defaults"],
export_generated_headers: ["statslog_resolv.h"],
static_libs: [
"libcutils",
],
shared_libs: [
"libstatssocket",
],
apex_available: ["com.android.resolv"],
min_sdk_version: "30",
}
filegroup {
name: "resolv_test_config_template",
srcs: [
"resolv_test_config_template.xml",
],
}
filegroup {
name: "resolv_test_config_without_root_template",
srcs: [
"resolv_test_config_without_root_template.xml",
],
}
filegroup {
name: "resolv_unit_test_files",
srcs: [
"DnsQueryLogTest.cpp",
"DnsStatsTest.cpp",
"ExperimentsTest.cpp",
"OperationLimiterTest.cpp",
"PrivateDnsConfigurationTest.cpp",
],
}
doh_rust_deps = [
"libandroid_logger",
"libanyhow",
"libbase64_rust",
"libfutures",
"liblibc",
"liblog_rust",
"libring",
"libstatslog_rust",
"librustutils",
"libthiserror",
"libtokio",
"liburl",
]
rust_ffi_static {
name: "libdoh_ffi",
crate_name: "doh",
srcs: ["doh/doh.rs"],
edition: "2018",
rlibs: doh_rust_deps + ["libquiche"],
prefer_rlib: true,
shared_libs: [
"libcrypto",
"libssl",
],
apex_available: [
"//apex_available:platform", // Needed by doh_ffi_test
"com.android.resolv",
],
min_sdk_version: "30",
}
rust_test {
name: "doh_unit_test",
crate_name: "doh",
srcs: ["doh/doh.rs"],
edition: "2018",
test_suites: ["general-tests"],
auto_gen_config: true,
rustlibs: doh_rust_deps + ["libquiche_static"],
min_sdk_version: "30",
shared_libs: ["libc++"],
}
// It's required by unit tests.
rust_ffi_static {
name: "libdoh_ffi_for_test",
crate_name: "doh",
srcs: ["doh/doh.rs"],
edition: "2018",
rlibs: doh_rust_deps + ["libquiche_static"],
prefer_rlib: true,
shared_libs: [
"libstatssocket",
],
// TODO(b/194022174), for unit tests to run on the Android 10 platform,
// libunwind must be statically linked.
whole_static_libs: ["libunwind"],
apex_available: [
"//apex_available:platform", // Needed by doh_ffi_test
"com.android.resolv",
],
min_sdk_version: "30",
}
rust_ffi_static {
// Combines libdoh_frontend_ffi and libdoh_ffi for fuzzing test.
// Includes multiple static rust libraries will cause duplicate symbol error.
name: "libdoh_fuzz_ffi",
crate_name: "doh_fuzz_ffi",
srcs: [
"doh/doh_test_superset_for_fuzzer.rs",
],
edition: "2018",
rlibs: [
"libandroid_logger",
"libanyhow",
"libbase64_rust",
"libfutures",
"liblazy_static",
"liblibc",
"liblog_rust",
"libquiche_static",
"libring",
"libstatslog_rust",
"libthiserror",
"libtokio",
"liburl",
],
whole_static_libs: ["libunwind"],
}