1package {
2    // See: http://go/android-license-faq
3    // A large-scale-change added 'default_applicable_licenses' to import
4    // all of the 'license_kinds' from "system_bt_license"
5    // to get the below license kinds:
6    //   SPDX-license-identifier-Apache-2.0
7    default_applicable_licenses: ["system_bt_license"],
8}
9
10cc_defaults {
11    name: "libbt-hci_defaults",
12    defaults: ["fluoride_defaults"],
13    shared_libs: [
14        "android.hardware.bluetooth@1.0",
15        "android.hardware.bluetooth@1.1",
16        "libhidlbase",
17    ],
18}
19
20// HCI static library for target
21// ========================================================
22cc_library_static {
23    name: "libbt-hci",
24    defaults: ["libbt-hci_defaults"],
25    srcs: [
26        "src/btsnoop.cc",
27        "src/btsnoop_mem.cc",
28        "src/btsnoop_net.cc",
29        "src/buffer_allocator.cc",
30        "src/hci_inject.cc",
31        "src/hci_layer.cc",
32        "src/hci_layer_android.cc",
33        "src/hci_packet_factory.cc",
34        "src/hci_packet_parser.cc",
35        "src/packet_fragmenter.cc",
36    ],
37    local_include_dirs: [
38        "include",
39    ],
40    include_dirs: [
41        "system/bt",
42        "system/bt/internal_include",
43        "system/bt/btcore/include",
44        "system/bt/stack/include",
45        "system/bt/utils/include",
46        "system/bt/bta/include",
47        "system/bt/btif/include",
48        "system/libhwbinder/include",
49        "system/bt/gd/rust/shim",
50    ],
51    product_variables: {
52        debuggable: {
53            cflags: [
54                "-DBT_NET_DEBUG=true",
55            ],
56        },
57    },
58    host_supported: true,
59}
60
61// HCI unit tests for target
62// ========================================================
63cc_test {
64    name: "net_test_hci",
65    test_suites: ["device-tests"],
66    defaults: ["libbt-hci_defaults"],
67    local_include_dirs: [
68        "include",
69    ],
70    include_dirs: [
71        "system/bt",
72        "system/bt/internal_include",
73        "system/bt/btcore/include",
74        "system/bt/osi/test",
75        "system/bt/stack/include",
76        "system/bt/utils/include",
77        "system/libhwbinder/include",
78        "system/bt/gd/rust/shim",
79    ],
80    srcs: [
81        "test/packet_fragmenter_test.cc",
82    ],
83    shared_libs: [
84        "liblog",
85        "libdl",
86        "libprotobuf-cpp-lite",
87    ],
88    static_libs: [
89        "libbt-hci",
90        "libosi",
91        "libosi-AlarmTestHarness",
92        "libosi-AllocationTestHarness",
93        "libcutils",
94        "libbtcore",
95        "libbt-protos-lite",
96        "libbluetooth-for-tests",
97    ],
98}
99
100// HCI native unit tests for target
101// ========================================================
102cc_test {
103    name: "net_test_hci_native",
104    test_suites: ["device-tests"],
105    defaults: ["fluoride_defaults"],
106    host_supported: true,
107    test_options: {
108        unit_test: true,
109    },
110    local_include_dirs: [
111        "include",
112    ],
113    include_dirs: [
114        "system/bt",
115        "system/bt/stack/include",
116    ],
117    srcs: [
118        "test/hci_layer_test.cc",
119        "test/other_stack_stub.cc",
120    ],
121    shared_libs: [
122        "libcrypto",
123        "liblog",
124        "libprotobuf-cpp-lite",
125    ],
126    static_libs: [
127        "libbt-common",
128        "libbt-protos-lite",
129        "libosi",
130        "libosi-AllocationTestHarness",
131    ],
132    sanitize: {
133        address: true,
134        cfi: true,
135        misc_undefined: ["bounds"],
136    },
137}
138
139cc_test {
140    name: "net_test_hci_fragmenter_native",
141    test_suites: ["device-tests"],
142    defaults: ["fluoride_defaults"],
143    host_supported: true,
144    test_options: {
145        unit_test: true,
146    },
147    local_include_dirs: [
148        "include",
149    ],
150    include_dirs: [
151        "system/bt",
152        "system/bt/stack/include",
153        "system/bt/btcore/include",
154        "system/bt/osi/test",
155    ],
156    srcs: [
157        "src/buffer_allocator.cc",
158        "test/packet_fragmenter_host_test.cc",
159    ],
160    shared_libs: [
161        "libcrypto",
162        "liblog",
163        "libprotobuf-cpp-lite",
164    ],
165    static_libs: [
166        "libbt-common",
167        "libbt-protos-lite",
168        "libosi",
169        "libosi-AllocationTestHarness",
170    ],
171    sanitize: {
172        address: true,
173        cfi: true,
174        misc_undefined: ["bounds"],
175    },
176}
177
178