xref: /aosp_15_r20/system/nfc/src/rust/Android.bp (revision 7eba2f3b06c51ae21384f6a4f14577b668a869b3)
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
11rust_defaults {
12    name: "nfc_rust_defaults",
13    target: {
14        darwin: {
15            enabled: false,
16        },
17    },
18    host_supported: true,
19}
20
21cc_defaults {
22    name: "nfc_ffi_defaults",
23    target: {
24        darwin: {
25            enabled: false,
26        },
27    },
28}
29
30rust_library {
31    name: "libnfc_rnci",
32    defaults: ["nfc_rust_defaults"],
33    crate_name: "nfc_rnci",
34    srcs: ["nci/nci.rs"],
35    host_supported: true,
36    rustlibs: [
37        "libnfc_packets",
38        "libbytes",
39        "libnfc_hal",
40        "libpdl_runtime",
41        "libtokio",
42        "libcxx",
43        "liblog_rust",
44    ],
45    proc_macros: ["libnum_derive"],
46}
47
48rust_library {
49    name: "libnfc_hal",
50    defaults: ["nfc_rust_defaults"],
51    crate_name: "nfc_hal",
52    srcs: ["hal/hal.rs"],
53    host_supported: true,
54    rustlibs: [
55        "libnfc_packets",
56        "libbytes",
57        "libpdl_runtime",
58        "libthiserror",
59        "libtokio",
60        "libcxx",
61        "liblog_rust",
62    ],
63    proc_macros: ["libnum_derive"],
64    target: {
65        android: {
66            whole_static_libs: ["libnfc_hidl_hal_cxx"],
67            shared_libs: [
68                "[email protected]",
69                "[email protected]",
70                "[email protected]",
71                "libhidlbase",
72                "libutils",
73            ],
74        },
75    },
76}
77
78genrule {
79    name: "libnfc_hidl_hal_bridge_header",
80    tools: ["cxxbridge"],
81    cmd: "$(location cxxbridge) $(in) --header > $(out)",
82    srcs: ["hal/hidl_hal.rs"],
83    out: ["hal/hidl_hal.rs.h"],
84}
85
86genrule {
87    name: "libnfc_hidl_hal_bridge_code",
88    tools: ["cxxbridge"],
89    cmd: "$(location cxxbridge) $(in) >> $(out)",
90    srcs: ["hal/hidl_hal.rs"],
91    out: ["hidl_hal_generated.cc"],
92}
93
94cc_library_static {
95    name: "libnfc_hidl_hal_cxx",
96    defaults: [
97        "rust_static_cc_lib_defaults",
98        "nfc_ffi_defaults",
99    ],
100    srcs: ["hal/ffi/hidl.cc"],
101    local_include_dirs: ["hal/ffi"],
102    generated_headers: [
103        "libnfc_hidl_hal_bridge_header",
104        "cxx-bridge-header",
105    ],
106    generated_sources: ["libnfc_hidl_hal_bridge_code"],
107    shared_libs: [
108        "[email protected]",
109        "[email protected]",
110        "[email protected]",
111        "libhidlbase",
112        "libutils",
113    ],
114}
115