• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1cc_library_headers {
2    name: "libnetd_resolv_headers",
3    export_include_dirs: ["include"],
4}
5
6// Used only by dns_responder_client_ndk.cpp for ResolverStats.h
7// TODO: refactor stats to use a Parcel and eliminate this dependency
8cc_library_headers {
9    name: "libnetd_resolv_internal_headers",
10    export_include_dirs: ["."],
11}
12
13cc_library_headers {
14    name: "dnsproxyd_protocol_headers",
15    export_include_dirs: ["include/dnsproxyd_protocol"],
16}
17
18aidl_interface {
19    name: "dnsresolver_aidl_interface",
20    local_include_dir: "binder",
21    srcs: [
22        "binder/android/net/IDnsResolver.aidl",
23        "binder/android/net/ResolverHostsParcel.aidl",
24        "binder/android/net/ResolverOptionsParcel.aidl",
25        "binder/android/net/ResolverParamsParcel.aidl",
26    ],
27    imports: [
28        "netd_event_listener_interface",
29    ],
30    backend: {
31        java: {
32            apex_available: [
33                "//apex_available:platform",
34                "com.android.bluetooth.updatable",
35                "com.android.wifi",
36            ],
37        },
38        ndk: {
39            gen_log: true,
40            apex_available: [
41                "com.android.resolv",
42            ],
43            min_sdk_version: "29",
44        },
45    },
46    versions: [
47        "1",
48        "2",
49        "3",
50        "4",
51        "5",
52        "6",
53    ],
54}
55
56cc_defaults {
57    name: "resolv_test_defaults",
58    // Note that, static link liblog and libbase is a hard requirement for resolv related tests
59    // because libbase is not compatible between Q and R for general platform build due
60    // to its log revelant functions changing. And most of resolv related tests must be able to run
61    // in Q.
62    static_libs: [
63        "libbase",
64        "liblog",
65    ],
66}
67
68cc_defaults {
69    // This is necessary to have the coverage tests run on cf_x86_phone.
70    // Because the test_suite target is 64 bit and the test infra is running the 64 bit test
71    // suite on cf_x86_phone (32-bit) for coverage.
72    // See b/147785146 for details.
73    // TODO: Remove this target after coverage test switched to 64-bit device.
74    name: "resolv_test_mts_coverage_defaults",
75    test_config_template: ":resolv_test_config_template",
76    compile_multilib: "both",
77    multilib: {
78        lib32: {
79            suffix: "32",
80        },
81        lib64: {
82            suffix: "64",
83        },
84    },
85}
86
87cc_library {
88    name: "libnetd_resolv",
89    version_script: "libnetd_resolv.map.txt",
90    stubs: {
91        versions: [
92            "1",
93        ],
94        symbol_file: "libnetd_resolv.map.txt",
95    },
96    defaults: ["netd_defaults"],
97    srcs: [
98        "getaddrinfo.cpp",
99        "gethnamaddr.cpp",
100        "sethostent.cpp",
101        "res_cache.cpp",
102        "res_comp.cpp",
103        "res_debug.cpp",
104        "res_init.cpp",
105        "res_mkquery.cpp",
106        "res_query.cpp",
107        "res_send.cpp",
108        "res_stats.cpp",
109        "util.cpp",
110        "Dns64Configuration.cpp",
111        "DnsProxyListener.cpp",
112        "DnsQueryLog.cpp",
113        "DnsResolver.cpp",
114        "DnsResolverService.cpp",
115        "DnsStats.cpp",
116        "DnsTlsDispatcher.cpp",
117        "DnsTlsQueryMap.cpp",
118        "DnsTlsTransport.cpp",
119        "DnsTlsServer.cpp",
120        "DnsTlsSessionCache.cpp",
121        "DnsTlsSocket.cpp",
122        "Experiments.cpp",
123        "PrivateDnsConfiguration.cpp",
124        "ResolverController.cpp",
125        "ResolverEventReporter.cpp",
126    ],
127    // Link most things statically to minimize our dependence on system ABIs.
128    stl: "libc++_static",
129    static_libs: [
130        "dnsresolver_aidl_interface-ndk_platform",
131        "libbase",
132        "libcutils",
133        "libnetdutils",
134        "libprotobuf-cpp-lite",
135        "libstatslog_resolv",
136        "libstatspush_compat",
137        "libsysutils",
138        "netd_event_listener_interface-ndk_platform",
139        "server_configurable_flags",
140        "stats_proto",
141    ],
142    // libcrypto needs to be used as a shared library because it performs an
143    // integrity check (against a checksum) that is not supported for static
144    // libs. See http://b/141248879
145    // We're also adding libssl here to treat it consistently.
146    // liblog is added as a shared library because it provides stable C API
147    // from the platform; we don't need to include it in this module by
148    // statically linking to it. Doing so is even dangerous because the socket
149    // protocol to logd implemented in the library isn't guaranteed to be
150    // stable. See b/151051671
151    shared_libs: [
152        "libbinder_ndk",
153        "libcrypto",
154        "liblog", //Used by libstatslog_resolv
155        "libssl",
156    ],
157    header_libs: [
158        "libnetdbinder_utils_headers",
159    ],
160    runtime_libs: [
161        // Causes the linkerconfig to create a namespace link from resolv to the
162        // libstatssocket library within the statsd apex
163        "libstatssocket",
164    ],
165    export_include_dirs: ["include"],
166
167    product_variables: {
168        debuggable: {
169            cppflags: [
170                "-DRESOLV_ALLOW_VERBOSE_LOGGING=1",
171            ],
172        },
173    },
174    header_abi_checker: {
175        enabled: true,
176        symbol_file: "libnetd_resolv.map.txt",
177    },
178    sanitize: {
179        cfi: true,
180    },
181    apex_available: ["com.android.resolv"],
182    min_sdk_version: "29",
183}
184
185cc_library_static {
186    name: "stats_proto",
187    defaults: ["netd_defaults"],
188    proto: {
189        export_proto_headers: true,
190        type: "lite",
191    },
192    srcs: [
193        "stats.proto",
194    ],
195    apex_available: ["com.android.resolv"],
196    min_sdk_version: "29",
197}
198
199genrule {
200    name: "statslog_resolv.h",
201    tools: ["stats-log-api-gen"],
202    cmd: "$(location stats-log-api-gen) --header $(genDir)/statslog_resolv.h --module resolv --namespace android,net,stats",
203    out: [
204        "statslog_resolv.h",
205    ],
206}
207
208genrule {
209    name: "statslog_resolv.cpp",
210    tools: ["stats-log-api-gen"],
211    cmd: "$(location stats-log-api-gen) --cpp $(genDir)/statslog_resolv.cpp --module resolv --namespace android,net,stats --importHeader statslog_resolv.h --supportQ",
212    out: [
213        "statslog_resolv.cpp",
214    ],
215}
216
217cc_library_static {
218    name: "libstatslog_resolv",
219    generated_sources: ["statslog_resolv.cpp"],
220    generated_headers: ["statslog_resolv.h"],
221    defaults: ["netd_defaults"],
222    export_generated_headers: ["statslog_resolv.h"],
223    static_libs: [
224        "libcutils",
225        "libgtest_prod", // Used by libstatspush_compat
226        "libstatspush_compat",
227    ],
228    apex_available: ["com.android.resolv"],
229    min_sdk_version: "29",
230}
231
232filegroup {
233    name: "resolv_test_config_template",
234    srcs: [
235        "resolv_test_config_template.xml",
236    ],
237}
238
239// TODO: Move this test to tests/
240cc_test {
241    name: "resolv_unit_test",
242    test_suites: [
243        "general-tests",
244        "mts",
245    ],
246    require_root: true,
247    // TODO: Drop root privileges and make it be an real unit test.
248    // TODO: Remove resolv_test_mts_coverage_defaults after mts coverage switched to 64-bit device.
249    defaults: [
250        "netd_defaults",
251        "resolv_test_defaults",
252        "resolv_test_mts_coverage_defaults",
253    ],
254    srcs: [
255        "resolv_cache_unit_test.cpp",
256        "resolv_callback_unit_test.cpp",
257        "resolv_tls_unit_test.cpp",
258        "resolv_unit_test.cpp",
259        "DnsQueryLogTest.cpp",
260        "DnsStatsTest.cpp",
261        "ExperimentsTest.cpp",
262    ],
263    shared_libs: [
264        "libcrypto",
265        "libbinder_ndk",
266        "libssl",
267    ],
268    static_libs: [
269        "dnsresolver_aidl_interface-unstable-ndk_platform",
270        "netd_aidl_interface-ndk_platform",
271        "netd_event_listener_interface-ndk_platform",
272        "libcutils",
273        "libgmock",
274        "libnetd_resolv",
275        "libnetd_test_dnsresponder_ndk",
276        "libnetd_test_resolv_utils",
277        "libnetdutils",
278        "libprotobuf-cpp-lite",
279        "libstatslog_resolv",
280        "libstatspush_compat",
281        "libsysutils",
282        "libutils",
283        "resolv_stats_test_utils",
284        "server_configurable_flags",
285        "stats_proto",
286    ],
287}
288