• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1package {
2    default_team: "trendy_team_fwk_nfc",
3    // See: http://go/android-license-faq
4    // A large-scale-change added 'default_applicable_licenses' to import
5    // all of the 'license_kinds' from "system_nfc_license"
6    // to get the below license kinds:
7    //   SPDX-license-identifier-Apache-2.0
8    default_applicable_licenses: ["system_nfc_license"],
9}
10
11cc_library {
12    arch: {
13        arm: {
14            instruction_set: "arm",
15        },
16    },
17    name: "libnfc-nci",
18    shared_libs: [
19        "libcutils",
20        "liblog",
21        "libdl",
22        "libz",
23        "libbase",
24        // Treble configuration
25        "libhidlbase",
26        "libutils",
27        "libbinder_ndk",
28        "libstatssocket",
29        "server_configurable_flags",
30    ],
31    static_libs: [
32        "android.hardware.nfc@1.0",
33        "android.hardware.nfc@1.1",
34        "android.hardware.nfc@1.2",
35        // Add for AIDL
36        "android.hardware.nfc-V1-ndk",
37        "libnfcutils",
38        "libstatslog_nfc",
39        "libnfc-nci_flags",
40    ],
41    cflags: [
42        "-DDYN_ALLOC=1",
43        "-DBUILDCFG=1",
44        "-DGKI_PTHREAD_JOINABLE",
45        "-Wall",
46        "-Werror",
47        "-Wimplicit-fallthrough",
48    ],
49    local_include_dirs: [
50        "include",
51        "gki/ulinux",
52        "gki/common",
53        "nfa/include",
54        "nfc/include",
55    ],
56    srcs: [
57        "nfa/ce/*.cc",
58        "nfa/dm/*.cc",
59        "nfa/ee/*.cc",
60        "nfa/hci/*.cc",
61        "nfa/rw/*.cc",
62        "nfa/sys/*.cc",
63        "nfa/wlc/*.cc",
64        "nfc/nci/*.cc",
65        "nfc/ndef/*.cc",
66        "nfc/nfc/*.cc",
67        "nfc/tags/*.cc",
68        "adaptation/*.cc",
69        "gki/common/*.cc",
70        "gki/ulinux/*.cc",
71    ],
72    product_variables: {
73        debuggable: {
74            cflags: [
75                "-DDCHECK_ALWAYS_ON",
76            ],
77        },
78    },
79    sanitize: {
80        misc_undefined: ["bounds"],
81        integer_overflow: true,
82        scs: true,
83    },
84    stl: "libc++_static",
85    apex_available: [
86        "//apex_available:platform",
87        "com.android.nfcservices",
88    ],
89}
90
91cc_defaults {
92    name: "nfc_fuzzer_defaults",
93    host_supported: true,
94    native_coverage: true,
95    static_libs: [
96        "libnfcutils",
97        "libcutils",
98        "liblog",
99        "libbase",
100    ],
101    shared_libs: [
102        "libnfc-nci_flags",
103    ],
104    cflags: [
105        "-DBUILDCFG=1",
106        "-Wall",
107        "-Werror",
108        "-Wimplicit-fallthrough",
109        "-g",
110        "-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION",
111        "-DGKI_ENABLE_BUF_CORRUPTION_CHECK=FALSE",
112    ],
113    product_variables: {
114        debuggable: {
115            cflags: [
116                "-DDCHECK_ALWAYS_ON",
117            ],
118        },
119    },
120    local_include_dirs: [
121        "include",
122        "gki/ulinux",
123        "gki/common",
124        "nfc/include",
125        "nfa/include",
126        "fuzzers/inc",
127    ],
128    fuzz_config: {
129        cc: [
130            "android-security-assurance-redteam@google.com",
131            "zachoverflow@google.com",
132            "jackcwyu@google.com",
133            "georgekgchang@google.com",
134            "alisher@google.com",
135        ],
136    },
137}
138
139cc_library {
140    name: "libstatslog_nfc",
141    host_supported: true,
142    generated_sources: ["statslog_nfc.cpp"],
143    generated_headers: ["statslog_nfc.h"],
144    export_generated_headers: ["statslog_nfc.h"],
145    shared_libs: [
146        "libstatssocket",
147    ],
148    target: {
149        host: {
150            static_libs: [
151                "libbase",
152            ],
153        },
154        darwin: {
155            enabled: false,
156        },
157    },
158    apex_available: [
159        "//apex_available:platform",
160        "com.android.nfcservices",
161    ],
162}
163
164genrule {
165    name: "statslog_nfc.h",
166    tools: ["stats-log-api-gen"],
167    cmd: "$(location stats-log-api-gen) --header $(genDir)/statslog_nfc.h --module nfc --namespace nfc,stats",
168    out: [
169        "statslog_nfc.h",
170    ],
171}
172
173genrule {
174    name: "statslog_nfc.cpp",
175    tools: ["stats-log-api-gen"],
176    cmd: "$(location stats-log-api-gen) --cpp $(genDir)/statslog_nfc.cpp --module nfc --namespace nfc,stats --importHeader statslog_nfc.h",
177    out: [
178        "statslog_nfc.cpp",
179    ],
180}
181
182cc_fuzz {
183    name: "nfc_nci_fuzzer",
184    defaults: ["nfc_fuzzer_defaults"],
185    fuzzing_frameworks: {
186        afl: false,
187    },
188    srcs: [
189        "nfc/nci/*.cc",
190        "nfc/nfc/*.cc",
191        "adaptation/debug_lmrt.cc",
192        "gki/common/*.cc",
193        "gki/ulinux/*.cc",
194        "fuzzers/*.cc",
195        "fuzzers/nci/*.cc",
196    ],
197    shared_libs: [
198        "libstatslog_nfc",
199    ],
200}
201
202cc_fuzz {
203    name: "nfc_rw_fuzzer",
204    defaults: ["nfc_fuzzer_defaults"],
205    fuzzing_frameworks: {
206        afl: false,
207    },
208    srcs: [
209        "nfc/tags/rw_*.cc",
210        "nfc/tags/tags_int.cc",
211        "gki/common/*.cc",
212        "gki/ulinux/*.cc",
213        "fuzzers/*.cc",
214        "fuzzers/rw/*.cc",
215    ],
216}
217
218cc_fuzz {
219    name: "nfc_ce_fuzzer",
220    defaults: ["nfc_fuzzer_defaults"],
221    fuzzing_frameworks: {
222        afl: false,
223    },
224    srcs: [
225        "nfc/tags/ce_*.cc",
226        "nfc/tags/tags_int.cc",
227        "gki/common/*.cc",
228        "gki/ulinux/*.cc",
229        "fuzzers/*.cc",
230        "fuzzers/ce/*.cc",
231    ],
232}
233
234cc_fuzz {
235    name: "nfc_ndef_fuzzer",
236    defaults: ["nfc_fuzzer_defaults"],
237    fuzzing_frameworks: {
238        afl: false,
239    },
240    srcs: [
241        "nfa/dm/nfa_dm_ndef.cc",
242        "nfc/ndef/*.cc",
243        "gki/common/*.cc",
244        "gki/ulinux/*.cc",
245        "fuzzers/*.cc",
246        "fuzzers/ndef/*.cc",
247    ],
248}
249
250cc_library_static {
251    name: "nfc_integration_fuzzer_proto",
252    owner: "google",
253    host_supported: true,
254    srcs: ["fuzzers/integration/nfc_integration_fuzzer.proto"],
255    proto: {
256        type: "full",
257        export_proto_headers: true,
258    },
259    shared_libs: ["libprotobuf-cpp-full"],
260}
261
262cc_fuzz {
263    name: "nfc_integration_fuzzer",
264    defaults: ["nfc_fuzzer_defaults"],
265    fuzzing_frameworks: {
266        afl: false,
267    },
268    srcs: [
269        "adaptation/debug_nfcsnoop.cc",
270        "fuzzers/integration/*.cc",
271        "fuzzers/integration/fakes/*.cc",
272        "gki/common/gki_buffer.cc",
273        "adaptation/debug_lmrt.cc",
274        "nfa/ce/*.cc",
275        "nfa/dm/*.cc",
276        "nfa/ee/*.cc",
277        "nfa/hci/*.cc",
278        "nfa/rw/*.cc",
279        "nfa/sys/*.cc",
280        "nfa/wlc/*.cc",
281        "nfc/nci/*.cc",
282        "nfc/ndef/*.cc",
283        "nfc/nfc/*.cc",
284        "nfc/tags/*.cc",
285    ],
286    cflags: [
287        "-DNFC_INTEGRATION_FUZZER",
288    ],
289    local_include_dirs: [
290        "fuzzers/integration",
291        "fuzzers/integration/fakes",
292    ],
293    static_libs: [
294        "libprotobuf-mutator",
295        "libutils",
296        "nfc_integration_fuzzer_proto",
297    ],
298    shared_libs: [
299        "libprotobuf-cpp-full",
300        "libstatslog_nfc",
301        "libz",
302    ],
303}
304
305genrule {
306    name: "NfcGeneratedPackets_rust",
307    defaults: ["pdl_rust_legacy_generator_defaults"],
308    srcs: ["nci_packets.pdl"],
309    out: ["nci_packets.rs"],
310}
311
312rust_library {
313    name: "libnfc_packets",
314    defaults: ["nfc_rust_defaults"],
315    crate_name: "nfc_packets",
316    srcs: [
317        "rust/packets/lib.rs",
318        ":NfcGeneratedPackets_rust",
319    ],
320    host_supported: true,
321    rustlibs: [
322        "libbytes",
323        "liblog_rust",
324        "libpdl_runtime",
325    ],
326}
327
328rust_test_host {
329    name: "libnfc_packets_test",
330    defaults: ["nfc_rust_defaults"],
331    srcs: [
332        "rust/packets/lib.rs",
333        ":NfcGeneratedPackets_rust",
334    ],
335    test_suites: ["general-tests"],
336    rustlibs: [
337        "libbytes",
338        "liblog_rust",
339        "libpdl_runtime",
340    ],
341}
342