aboutsummaryrefslogtreecommitdiff
path: root/Android.bp
blob: 50d5dabe15e5f226bf29145446900a6a8cc917e3 (plain)
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
cc_library_headers {
    name: "libnetd_resolv_headers",
    export_include_dirs: ["include"],
}

//For the test to use
//TODO: 1. Need to Refactor ResolverStats related code(ex: ResolverController::getDnsInfo).
//         Then removing this library header file.
//      2. Change the imports path in netd/TEST_MAPPING after migrating from
//         system/netd/resolv to packages/modules/resolv.
cc_library_headers {
    name: "libnetd_resolv_internal_headers",
    export_include_dirs: ["."],
}

aidl_interface {
    name: "dnsresolver_aidl_interface",
    local_include_dir: "binder",
    srcs: [
        "binder/android/net/IDnsResolver.aidl",
        "binder/android/net/ResolverParamsParcel.aidl",
    ],
    imports: [
        "netd_event_listener_interface",
    ],
    backend: {
        ndk: {
            gen_log: true,
        },
    },
    versions: [
        "1",
        "2",
        "3",
    ],
}

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_init.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",
        "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-unstable-ndk_platform",
        "libbase",
        "libcutils",
        "libjsoncpp",
        "liblog", //Used by libstatslog_resolv
        "libnetdutils",
        "libprotobuf-cpp-lite",
        "libstatslog_resolv",
        "libstatssocket",
        "libsysutils",
        "libutils", // Used by libstatslog_resolv
        "netd_event_listener_interface-ndk_platform",
        "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.
    shared_libs: [
        "libbinder_ndk",
        "libcrypto",
        "libssl",
    ],
    header_libs: [
        "libnetd_client_headers",
    ],
    export_include_dirs: ["include"],

    product_variables: {
        debuggable: {
            cppflags: [
                "-DRESOLV_ALLOW_VERBOSE_LOGGING=1",
                "-DRESOLV_INJECT_CA_CERTIFICATE=1",
            ],
        },
    },
}

cc_library_static {
    name: "stats_proto",
    defaults: ["netd_defaults"],
    proto: {
        export_proto_headers: true,
        type: "lite",
    },
    srcs: [
        "stats.proto",
    ],
}

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",
    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",
    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",
        "libstatssocket",
    ],
}

// TODO: Move this test to tests/
cc_test {
    name: "resolv_unit_test",
    test_suites: ["device-tests"],
    require_root: true,
    //TODO:  drop root privileges and make it be an real unit test.
    defaults: ["netd_defaults"],
    srcs: [
        "resolv_cache_unit_test.cpp",
        "resolv_callback_unit_test.cpp",
        "resolv_tls_unit_test.cpp",
        "resolv_unit_test.cpp",
        "DnsStatsTest.cpp",
    ],
    shared_libs: [
        "libbase",
        "libcrypto",
        "libcutils",
        "libssl",
        "libbinder_ndk",
    ],
    static_libs: [
        "dnsresolver_aidl_interface-cpp",
        "dnsresolver_aidl_interface-ndk_platform",
        "netd_event_listener_interface-ndk_platform",
        "libgmock",
        "liblog",
        "libnetd_resolv",
        "libnetd_test_dnsresponder",
        "libnetd_test_resolv_utils",
        "libnetdutils",
        "libprotobuf-cpp-lite",
        "libstatslog_resolv",
        "libstatssocket",
        "libsysutils",
        "libutils",
        "server_configurable_flags",
        "stats_proto",
    ],
}