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