blob: 46108c6414016a05fbdd5d33e42f1771faeb1322 [file] [log] [blame]
Zach Johnson3a770032019-03-27 19:15:38 -07001cc_defaults {
2 name: "gd_defaults",
3 target: {
4 android: {
5 test_config_template: "AndroidTestTemplate.xml",
6 cflags: [
7 "-DOS_ANDROID",
8 "-DOS_LINUX_GENERIC",
9 ],
10 shared_libs: [
Colin Cross62084352019-05-23 14:12:59 -070011 "liblog",
12 ],
Zach Johnson3a770032019-03-27 19:15:38 -070013 },
14 host: {
15 cflags: [
16 "-DOS_LINUX",
17 "-DOS_LINUX_GENERIC",
Colin Cross62084352019-05-23 14:12:59 -070018 ],
19 },
Colin Cross3b06fff2019-05-23 14:10:48 -070020 darwin: {
21 enabled: false,
22 },
Zach Johnson3a770032019-03-27 19:15:38 -070023 },
24 cpp_std: "c++17",
25 cflags: [
26 "-DEXPORT_SYMBOL=__attribute__((visibility(\"default\")))",
27 "-fvisibility=hidden",
28 "-DLOG_NDEBUG=1",
29 "-DGOOGLE_PROTOBUF_NO_RTTI",
Zach Johnsone0e158c2019-04-26 11:57:05 -070030 "-Wno-unused-parameter",
Zach Johnsone0e158c2019-04-26 11:57:05 -070031 "-Wno-unused-result",
Zach Johnson3a770032019-03-27 19:15:38 -070032 ],
33 conlyflags: [
34 "-std=c99",
35 ],
36 sanitize: {
37 misc_undefined: ["bounds"],
38 },
39}
40
41// Enables code coverage for a set of source files. Must be combined with
42// "clang_coverage_bin" in order to work. See //test/gen_coverage.py for more information
43// on generating code coverage.
44cc_defaults {
45 name: "gd_clang_file_coverage",
46 target: {
47 host: {
48 clang_cflags: [
49 "-fprofile-instr-generate",
50 "-fcoverage-mapping",
51 ],
52 },
53 },
54}
55
56// Enabled code coverage on a binary. These flags allow libraries that were
57// compiled with "clang_file_coverage" to be properly linked together in
58// order to create a binary that will create a profraw file when ran. Note
59// these flags themselves don't enable code coverage for the source files
60// compiled in the binary. See //test/gen_coverage.py for more information
61// on generating code coverage.
62cc_defaults {
63 name: "gd_clang_coverage_bin",
64 target: {
65 host: {
66 ldflags: [
67 "-fprofile-instr-generate",
68 "-fcoverage-mapping",
69 ],
70 },
71 },
72}
73
74cc_library {
75 name: "libbluetooth_gd",
Hansong Zhanga25f84d2019-03-19 16:17:42 -070076 defaults: [
Zach Johnson3a770032019-03-27 19:15:38 -070077 "gd_defaults",
78 "gd_clang_file_coverage",
Hansong Zhanga25f84d2019-03-19 16:17:42 -070079 ],
80 host_supported: true,
Zach Johnson3a770032019-03-27 19:15:38 -070081 target: {
82 linux: {
83 srcs: [
84 ":BluetoothOsSources_linux_generic",
Hansong Zhang751a2212019-03-29 14:27:05 -070085 ],
86 },
87 host: {
88 srcs: [
89 ":BluetoothHalSources_hci_rootcanal",
90 ],
91 },
Hansong Zhang904c0222019-04-08 14:26:53 -070092 android: {
93 srcs: [
94 ":BluetoothHalSources_hci_android_hidl",
95 ],
96 shared_libs: [
97 "android.hardware.bluetooth@1.0",
Hansong Zhang904c0222019-04-08 14:26:53 -070098 "libhidlbase",
Hansong Zhang904c0222019-04-08 14:26:53 -070099 "libutils",
100 ],
101 },
Zach Johnson3a770032019-03-27 19:15:38 -0700102 },
Myles Watson0ead5972019-04-01 13:21:25 -0700103 srcs: [
Hansong Zhang3fa05ab2019-04-09 08:55:27 -0700104 "stack_manager.cc",
Zach Johnson429c94b2019-04-25 22:24:54 -0700105 "module.cc",
Myles Watson0ead5972019-04-01 13:21:25 -0700106 ":BluetoothCommonSources",
Jakub Pawlowski5c703472019-05-22 17:36:24 +0200107 ":BluetoothCryptoToolboxSources",
Jack Hee0660822019-04-22 11:45:26 -0700108 ":BluetoothHalSources",
Myles Watsoncf0bb8c2019-02-22 16:08:06 -0800109 ":BluetoothHciSources",
Jack Hefcb2bbf2019-07-31 15:44:05 -0700110 ":BluetoothL2capSources",
Chris Mantonaf1058b2019-10-16 22:26:22 -0700111 ":BluetoothNeighborSources",
Myles Watson0ead5972019-04-01 13:21:25 -0700112 ":BluetoothPacketSources",
Chris Manton1bb0e512019-09-09 21:11:59 -0700113 ":BluetoothShimSources",
Martin Brabhama5be8682019-10-18 13:59:24 -0700114 ":BluetoothSecuritySources",
Hansong Zhang29f99002019-04-24 17:25:42 +0000115 ],
116 generated_headers: [
117 "BluetoothGeneratedPackets_h",
118 ],
Hansong Zhangaa0875c2019-06-06 21:44:55 -0700119 shared_libs: [
120 "libchrome",
121 ],
Hansong Zhang29f99002019-04-24 17:25:42 +0000122}
123
124cc_binary {
Hansong Zhang13ceb562019-09-25 12:12:59 -0700125 name: "bluetooth_stack_with_facade",
Hansong Zhang29f99002019-04-24 17:25:42 +0000126 defaults: [
127 "gd_defaults",
128 ],
129 host_supported: true,
130 srcs: [
Zach Johnson49995042019-05-02 19:56:10 -0700131 "facade/facade_main.cc",
Hansong Zhang30bf8692019-05-02 15:25:54 -0700132 "facade/grpc_root_server.cc",
Hansong Zhange0a997f2019-08-29 14:27:11 -0700133 "facade/read_only_property_server.cc",
Zach Johnsone0e158c2019-04-26 11:57:05 -0700134 "grpc/grpc_module.cc",
Zach Johnson34703602019-04-29 16:45:21 -0700135 ":BluetoothFacade_hci_hal",
Hansong Zhangc5ec8f92019-06-19 17:22:21 -0700136 ":BluetoothFacade_hci_layer",
Jack Hefcb2bbf2019-07-31 15:44:05 -0700137 ":BluetoothFacade_l2cap_layer",
Hansong Zhang29f99002019-04-24 17:25:42 +0000138 ],
139 generated_headers: [
140 "BluetoothGeneratedPackets_h",
Zach Johnson34703602019-04-29 16:45:21 -0700141 "BluetoothFacadeGeneratedStub_h",
Hansong Zhang29f99002019-04-24 17:25:42 +0000142 ],
143 generated_sources: [
Zach Johnson34703602019-04-29 16:45:21 -0700144 "BluetoothFacadeGeneratedStub_cc",
Hansong Zhang29f99002019-04-24 17:25:42 +0000145 ],
146 static_libs: [
147 "libbluetooth_gd",
148 ],
149 shared_libs: [
Hansong Zhangaa0875c2019-06-06 21:44:55 -0700150 "libchrome",
Hansong Zhang29f99002019-04-24 17:25:42 +0000151 "libgrpc++_unsecure",
152 "libprotobuf-cpp-full",
153 ],
154 target: {
155 android: {
156 shared_libs: [
157 "android.hardware.bluetooth@1.0",
Hansong Zhang29f99002019-04-24 17:25:42 +0000158 "libhidlbase",
Hansong Zhang29f99002019-04-24 17:25:42 +0000159 "libutils",
160 ],
161 },
162 },
Hansong Zhang29f99002019-04-24 17:25:42 +0000163 sanitize: {
164 address: true,
165 },
166}
167
Hansong Zhang90ec7402019-04-29 16:04:07 -0700168cc_binary {
169 name: "bluetooth_cert_stack",
170 defaults: [
171 "gd_defaults",
172 ],
173 host_supported: true,
174 srcs: [
Zach Johnson49995042019-05-02 19:56:10 -0700175 "cert/cert_main.cc",
Hansong Zhang30bf8692019-05-02 15:25:54 -0700176 "cert/grpc_root_server.cc",
Hansong Zhange0a997f2019-08-29 14:27:11 -0700177 "cert/read_only_property_server.cc",
Hansong Zhang90ec7402019-04-29 16:04:07 -0700178 "grpc/grpc_module.cc",
179 ":BluetoothCertSource_hci_hal",
Hansong Zhangc5ec8f92019-06-19 17:22:21 -0700180 ":BluetoothCertSource_hci_layer",
Jack Hefcb2bbf2019-07-31 15:44:05 -0700181 ":BluetoothCertSource_l2cap_layer",
Hansong Zhang90ec7402019-04-29 16:04:07 -0700182 ],
183 generated_headers: [
184 "BluetoothGeneratedPackets_h",
185 "BluetoothCertStackGeneratedStub_h",
186 ],
187 generated_sources: [
188 "BluetoothCertStackGeneratedStub_cc",
189 ],
190 static_libs: [
191 "libbluetooth_gd",
192 ],
193 shared_libs: [
Hansong Zhangaa0875c2019-06-06 21:44:55 -0700194 "libchrome",
Hansong Zhang90ec7402019-04-29 16:04:07 -0700195 "libgrpc++_unsecure",
196 "libprotobuf-cpp-full",
197 ],
198 target: {
199 android: {
200 shared_libs: [
201 "android.hardware.bluetooth@1.0",
Hansong Zhang90ec7402019-04-29 16:04:07 -0700202 "libhidlbase",
Hansong Zhang90ec7402019-04-29 16:04:07 -0700203 "libutils",
204 ],
205 },
206 },
207 sanitize: {
208 address: true,
209 },
210}
211
Hansong Zhang29f99002019-04-24 17:25:42 +0000212cc_test {
Zach Johnson3a770032019-03-27 19:15:38 -0700213 name: "bluetooth_test_gd",
Hansong Zhanga25f84d2019-03-19 16:17:42 -0700214 test_suites: ["device-tests"],
215 defaults: [
Zach Johnson3a770032019-03-27 19:15:38 -0700216 "gd_defaults",
217 "gd_clang_coverage_bin",
Hansong Zhanga25f84d2019-03-19 16:17:42 -0700218 ],
219 host_supported: true,
Zach Johnson3a770032019-03-27 19:15:38 -0700220 target: {
221 linux: {
222 srcs: [
223 ":BluetoothOsTestSources_linux_generic",
Hansong Zhang751a2212019-03-29 14:27:05 -0700224 ],
225 },
226 host: {
227 srcs: [
228 ":BluetoothHalTestSources_hci_rootcanal",
229 ],
230 },
Hansong Zhang904c0222019-04-08 14:26:53 -0700231 android: {
232 srcs: [
233 ":BluetoothHalTestSources_hci_android_hidl",
234 ],
235 shared_libs: [
236 "android.hardware.bluetooth@1.0",
Hansong Zhang904c0222019-04-08 14:26:53 -0700237 "libhidlbase",
Hansong Zhang904c0222019-04-08 14:26:53 -0700238 "libutils",
239 ],
240 },
Zach Johnson3a770032019-03-27 19:15:38 -0700241 },
Myles Watson0ead5972019-04-01 13:21:25 -0700242 srcs: [
Zach Johnson429c94b2019-04-25 22:24:54 -0700243 "module_unittest.cc",
Hansong Zhang0bce6f72019-06-13 18:31:40 -0700244 "stack_manager_unittest.cc",
Myles Watson0ead5972019-04-01 13:21:25 -0700245 ":BluetoothCommonTestSources",
Jakub Pawlowski5c703472019-05-22 17:36:24 +0200246 ":BluetoothCryptoToolboxTestSources",
Myles Watsoncc57c6b2019-03-25 15:24:43 -0700247 ":BluetoothHciTestSources",
Myles Watsona4cd53c2019-03-25 15:25:08 -0700248 ":BluetoothL2capTestSources",
Chris Mantonaf1058b2019-10-16 22:26:22 -0700249 ":BluetoothNeighborTestSources",
Myles Watson0ead5972019-04-01 13:21:25 -0700250 ":BluetoothPacketTestSources",
Martin Brabhama5be8682019-10-18 13:59:24 -0700251 ":BluetoothSecurityTestSources",
Chris Mantonee8c0a92019-10-17 10:56:37 -0700252 ":BluetoothShimTestSources",
Myles Watson0ead5972019-04-01 13:21:25 -0700253 ],
Colin Cross62084352019-05-23 14:12:59 -0700254 generated_headers: [
Hansong Zhang05c079b2019-04-04 13:24:43 -0700255 "BluetoothGeneratedPackets_h",
Myles Watsoncc57c6b2019-03-25 15:24:43 -0700256 ],
Colin Cross62084352019-05-23 14:12:59 -0700257 static_libs: [
Zach Johnson3a770032019-03-27 19:15:38 -0700258 "libbluetooth_gd",
Hansong Zhangcf49fa92019-05-06 17:54:51 -0700259 "libgmock",
Hansong Zhanga25f84d2019-03-19 16:17:42 -0700260 ],
Hansong Zhangaa0875c2019-06-06 21:44:55 -0700261 shared_libs: [
262 "libchrome",
263 ],
Hansong Zhanga25f84d2019-03-19 16:17:42 -0700264 sanitize: {
Chienyuan2d7f3b72019-03-29 17:33:41 -0700265 address: true,
Hansong Zhanga25f84d2019-03-19 16:17:42 -0700266 },
267}
Jack Hef4e24712019-04-01 16:20:14 -0700268
Ajay Panicker4d6b7602019-02-06 14:02:36 -0800269cc_test {
270 name: "bluetooth_packet_parser_test",
271 test_suites: ["device-tests"],
272 defaults: [
273 "gd_defaults",
274 "gd_clang_coverage_bin",
275 ],
276 host_supported: true,
277 srcs: [
278 ":BluetoothPacketSources",
279 ":BluetoothPacketParserTestPacketTestSources",
280 ],
Colin Cross62084352019-05-23 14:12:59 -0700281 generated_headers: [
Ajay Panicker4d6b7602019-02-06 14:02:36 -0800282 "BluetoothPacketParserTestPacketPdlGen_h",
283 ],
284 sanitize: {
285 address: true,
286 cfi: true,
287 },
288}
289
Zongheng Wang627ba812019-10-16 16:39:11 -0700290cc_fuzz {
291 name: "bluetooth_gd_fuzz_test",
292 defaults: ["gd_defaults"],
293 srcs: [
294 "fuzz_test.cc",
Jack Hee0cd4da2019-10-22 15:57:10 -0700295 ":BluetoothHciFuzzTestSources",
Zongheng Wang627ba812019-10-16 16:39:11 -0700296 ":BluetoothL2capFuzzTestSources",
297 ],
298 static_libs: [
299 "libbluetooth_gd",
300 "libchrome",
301 "libgmock",
302 "libgtest",
303 ],
304 host_supported: true,
305 generated_headers: [
306 "BluetoothGeneratedPackets_h",
307 ],
308 target: {
309 android: {
310 shared_libs: [
311 "android.hardware.bluetooth@1.0",
312 "libhidlbase",
313 "libutils",
314 ],
315 },
316 },
317}
318
Jack Hef4e24712019-04-01 16:20:14 -0700319cc_benchmark {
320 name: "bluetooth_benchmark_gd",
321 defaults: ["gd_defaults"],
322 host_supported: true,
323 srcs: [
324 "benchmark.cc",
325 ":BluetoothOsBenchmarkSources",
326 ],
Colin Cross62084352019-05-23 14:12:59 -0700327 static_libs: [
Hansong Zhang05c079b2019-04-04 13:24:43 -0700328 "libbluetooth_gd",
329 ],
Hansong Zhangaa0875c2019-06-06 21:44:55 -0700330 shared_libs: [
331 "libchrome",
332 ],
Hansong Zhang05c079b2019-04-04 13:24:43 -0700333}
334
Chienyuan3d8a8032019-11-01 18:04:07 +0800335filegroup {
336 name: "BluetoothHciClassSources",
337 srcs: [
338 "hci/address.cc",
339 "hci/class_of_device.cc",
340 ],
341}
342
Hansong Zhang05c079b2019-04-04 13:24:43 -0700343genrule {
344 name: "BluetoothGeneratedPackets_h",
345 tools: [
346 "bluetooth_packetgen",
347 ],
348 cmd: "$(location bluetooth_packetgen) --include=system/bt/gd --out=$(genDir) $(in)",
349 srcs: [
350 "hci/hci_packets.pdl",
351 "l2cap/l2cap_packets.pdl",
Jakub Pawlowskie79714e2019-10-14 14:49:55 +0200352 "security/smp_packets.pdl",
Hansong Zhang05c079b2019-04-04 13:24:43 -0700353 ],
354 out: [
355 "hci/hci_packets.h",
356 "l2cap/l2cap_packets.h",
Jakub Pawlowskie79714e2019-10-14 14:49:55 +0200357 "security/smp_packets.h",
Jack Hef4e24712019-04-01 16:20:14 -0700358 ],
359}
Hansong Zhang29f99002019-04-24 17:25:42 +0000360
Jack He9be1dcd2019-11-18 19:20:41 -0800361genrule {
362 name: "BluetoothGeneratedPackets_python3_cc",
363 tools: [
364 "bluetooth_packetgen",
365 ],
Jack Hef2d14602019-11-20 17:24:16 -0800366 cmd: "$(location bluetooth_packetgen) --include=system/bt/gd --out=$(genDir) --num_shards=5 $(in)",
Jack He9be1dcd2019-11-18 19:20:41 -0800367 srcs: [
368 "hci/hci_packets.pdl",
369 "l2cap/l2cap_packets.pdl",
370 "security/smp_packets.pdl",
371 ],
372 out: [
373 "hci/hci_packets_python3.cc",
Jack Hef2d14602019-11-20 17:24:16 -0800374 "hci/hci_packets_python3_shard_0.cc",
375 "hci/hci_packets_python3_shard_1.cc",
376 "hci/hci_packets_python3_shard_2.cc",
377 "hci/hci_packets_python3_shard_3.cc",
378 "hci/hci_packets_python3_shard_4.cc",
Jack He9be1dcd2019-11-18 19:20:41 -0800379 "l2cap/l2cap_packets_python3.cc",
Jack Hef2d14602019-11-20 17:24:16 -0800380 "l2cap/l2cap_packets_python3_shard_0.cc",
381 "l2cap/l2cap_packets_python3_shard_1.cc",
382 "l2cap/l2cap_packets_python3_shard_2.cc",
383 "l2cap/l2cap_packets_python3_shard_3.cc",
384 "l2cap/l2cap_packets_python3_shard_4.cc",
Jack He9be1dcd2019-11-18 19:20:41 -0800385 "security/smp_packets_python3.cc",
Jack Hef2d14602019-11-20 17:24:16 -0800386 "security/smp_packets_python3_shard_0.cc",
387 "security/smp_packets_python3_shard_1.cc",
388 "security/smp_packets_python3_shard_2.cc",
389 "security/smp_packets_python3_shard_3.cc",
390 "security/smp_packets_python3_shard_4.cc",
Jack He9be1dcd2019-11-18 19:20:41 -0800391 ],
392}
393
Hansong Zhang29f99002019-04-24 17:25:42 +0000394filegroup {
Zach Johnson34703602019-04-29 16:45:21 -0700395 name: "BluetoothFacadeProto",
Hansong Zhang29f99002019-04-24 17:25:42 +0000396 srcs: [
Chienyuan4adb0422019-04-25 15:11:54 -0700397 "facade/common.proto",
Hansong Zhang30bf8692019-05-02 15:25:54 -0700398 "facade/rootservice.proto",
Zach Johnson34703602019-04-29 16:45:21 -0700399 "hal/facade.proto",
Hansong Zhangc5ec8f92019-06-19 17:22:21 -0700400 "hci/facade.proto",
Jack Heff38d892019-10-03 17:11:07 -0700401 "l2cap/classic/facade.proto",
Hansong Zhang29f99002019-04-24 17:25:42 +0000402 ],
403}
404
405genrule {
Zach Johnson34703602019-04-29 16:45:21 -0700406 name: "BluetoothFacadeGeneratedStub_h",
Hansong Zhang29f99002019-04-24 17:25:42 +0000407 tools: [
408 "aprotoc",
409 "protoc-gen-grpc-cpp-plugin",
410 ],
411 cmd: "$(location aprotoc) -Isystem/bt/gd -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(in) --grpc_out=$(genDir) --cpp_out=$(genDir)",
412 srcs: [
Zach Johnson34703602019-04-29 16:45:21 -0700413 ":BluetoothFacadeProto",
Hansong Zhang29f99002019-04-24 17:25:42 +0000414 ],
415 out: [
Chienyuan4adb0422019-04-25 15:11:54 -0700416 "facade/common.grpc.pb.h",
417 "facade/common.pb.h",
Hansong Zhang30bf8692019-05-02 15:25:54 -0700418 "facade/rootservice.grpc.pb.h",
419 "facade/rootservice.pb.h",
Zach Johnson34703602019-04-29 16:45:21 -0700420 "hal/facade.grpc.pb.h",
421 "hal/facade.pb.h",
Hansong Zhangc5ec8f92019-06-19 17:22:21 -0700422 "hci/facade.grpc.pb.h",
423 "hci/facade.pb.h",
Jack Heff38d892019-10-03 17:11:07 -0700424 "l2cap/classic/facade.grpc.pb.h",
425 "l2cap/classic/facade.pb.h",
Hansong Zhang29f99002019-04-24 17:25:42 +0000426 ],
427}
428
429genrule {
Zach Johnson34703602019-04-29 16:45:21 -0700430 name: "BluetoothFacadeGeneratedStub_cc",
Hansong Zhang29f99002019-04-24 17:25:42 +0000431 tools: [
432 "aprotoc",
433 "protoc-gen-grpc-cpp-plugin",
434 ],
435 cmd: "$(location aprotoc) -Isystem/bt/gd -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(in) --grpc_out=$(genDir) --cpp_out=$(genDir)",
436 srcs: [
Zach Johnson34703602019-04-29 16:45:21 -0700437 ":BluetoothFacadeProto",
Hansong Zhang29f99002019-04-24 17:25:42 +0000438 ],
439 out: [
Chienyuan4adb0422019-04-25 15:11:54 -0700440 "facade/common.grpc.pb.cc",
441 "facade/common.pb.cc",
Hansong Zhang30bf8692019-05-02 15:25:54 -0700442 "facade/rootservice.grpc.pb.cc",
443 "facade/rootservice.pb.cc",
Zach Johnson34703602019-04-29 16:45:21 -0700444 "hal/facade.grpc.pb.cc",
445 "hal/facade.pb.cc",
Hansong Zhangc5ec8f92019-06-19 17:22:21 -0700446 "hci/facade.grpc.pb.cc",
447 "hci/facade.pb.cc",
Jack Heff38d892019-10-03 17:11:07 -0700448 "l2cap/classic/facade.grpc.pb.cc",
449 "l2cap/classic/facade.pb.cc",
Hansong Zhang29f99002019-04-24 17:25:42 +0000450 ],
451}
Zach Johnsonfacafb02019-04-22 16:34:49 -0700452
453genrule {
Hansong Zhang90ec7402019-04-29 16:04:07 -0700454 name: "BluetoothFacadeAndCertGeneratedStub_py",
Zach Johnsonfacafb02019-04-22 16:34:49 -0700455 tools: [
456 "aprotoc",
457 "protoc-gen-grpc-python-plugin",
458 ],
459 cmd: "$(location aprotoc) -Isystem/bt/gd -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-python-plugin) $(in) --grpc_out=$(genDir) --python_out=$(genDir); " +
Chienyuan4adb0422019-04-25 15:11:54 -0700460 "touch $(genDir)/facade/__init__.py; " +
Hansong Zhang90ec7402019-04-29 16:04:07 -0700461 "touch $(genDir)/hal/__init__.py; " +
Hansong Zhangc5ec8f92019-06-19 17:22:21 -0700462 "touch $(genDir)/hal/cert/__init__.py; " +
463 "touch $(genDir)/hci/__init__.py; " +
Jack Hefcb2bbf2019-07-31 15:44:05 -0700464 "touch $(genDir)/hci/cert/__init__.py; " +
Jack Heff38d892019-10-03 17:11:07 -0700465 "touch $(genDir)/l2cap/classic/__init__.py; " +
466 "touch $(genDir)/l2cap/classic/cert/__init__.py; ",
Zach Johnsonfacafb02019-04-22 16:34:49 -0700467 srcs: [
Zach Johnson34703602019-04-29 16:45:21 -0700468 ":BluetoothFacadeProto",
Hansong Zhang90ec7402019-04-29 16:04:07 -0700469 ":BluetoothCertStackProto",
Zach Johnsonfacafb02019-04-22 16:34:49 -0700470 ],
471 out: [
Hansong Zhang30bf8692019-05-02 15:25:54 -0700472 "cert/rootservice_pb2_grpc.py",
473 "cert/rootservice_pb2.py",
Chienyuan4adb0422019-04-25 15:11:54 -0700474 "facade/__init__.py",
475 "facade/common_pb2_grpc.py",
476 "facade/common_pb2.py",
Hansong Zhang30bf8692019-05-02 15:25:54 -0700477 "facade/rootservice_pb2_grpc.py",
478 "facade/rootservice_pb2.py",
Zach Johnsonfacafb02019-04-22 16:34:49 -0700479 "hal/__init__.py",
Zach Johnson34703602019-04-29 16:45:21 -0700480 "hal/facade_pb2_grpc.py",
481 "hal/facade_pb2.py",
Hansong Zhangc5ec8f92019-06-19 17:22:21 -0700482 "hci/__init__.py",
483 "hci/facade_pb2_grpc.py",
484 "hci/facade_pb2.py",
Jack Heff38d892019-10-03 17:11:07 -0700485 "l2cap/classic/__init__.py",
486 "l2cap/classic/facade_pb2_grpc.py",
487 "l2cap/classic/facade_pb2.py",
Hansong Zhang90ec7402019-04-29 16:04:07 -0700488 "hal/cert/__init__.py",
489 "hal/cert/api_pb2_grpc.py",
490 "hal/cert/api_pb2.py",
Hansong Zhangc5ec8f92019-06-19 17:22:21 -0700491 "hci/cert/__init__.py",
492 "hci/cert/api_pb2_grpc.py",
493 "hci/cert/api_pb2.py",
Jack Heff38d892019-10-03 17:11:07 -0700494 "l2cap/classic/cert/__init__.py",
495 "l2cap/classic/cert/api_pb2_grpc.py",
496 "l2cap/classic/cert/api_pb2.py",
Hansong Zhang90ec7402019-04-29 16:04:07 -0700497 ],
498}
499
500filegroup {
501 name: "BluetoothCertStackProto",
502 srcs: [
Hansong Zhang30bf8692019-05-02 15:25:54 -0700503 "cert/rootservice.proto",
Hansong Zhang90ec7402019-04-29 16:04:07 -0700504 "hal/cert/api.proto",
Hansong Zhangc5ec8f92019-06-19 17:22:21 -0700505 "hci/cert/api.proto",
Jack Heff38d892019-10-03 17:11:07 -0700506 "l2cap/classic/cert/api.proto",
Hansong Zhang90ec7402019-04-29 16:04:07 -0700507 ],
508}
509
510genrule {
511 name: "BluetoothCertStackGeneratedStub_h",
512 tools: [
513 "aprotoc",
514 "protoc-gen-grpc-cpp-plugin",
515 ],
516 cmd: "$(location aprotoc) -Isystem/bt/gd -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(in) --grpc_out=$(genDir) --cpp_out=$(genDir)",
517 srcs: [
518 ":BluetoothCertStackProto",
Colin Cross62084352019-05-23 14:12:59 -0700519 ":BluetoothFacadeProto", // we need to use facade/common.proto
Hansong Zhang90ec7402019-04-29 16:04:07 -0700520 ],
521 out: [
Hansong Zhang30bf8692019-05-02 15:25:54 -0700522 "cert/rootservice.grpc.pb.h",
523 "cert/rootservice.pb.h",
Hansong Zhang90ec7402019-04-29 16:04:07 -0700524 "facade/common.grpc.pb.h",
525 "facade/common.pb.h",
526 "hal/cert/api.grpc.pb.h",
527 "hal/cert/api.pb.h",
Hansong Zhangc5ec8f92019-06-19 17:22:21 -0700528 "hci/cert/api.grpc.pb.h",
529 "hci/cert/api.pb.h",
Jack Heff38d892019-10-03 17:11:07 -0700530 "l2cap/classic/cert/api.grpc.pb.h",
531 "l2cap/classic/cert/api.pb.h",
Hansong Zhang90ec7402019-04-29 16:04:07 -0700532 ],
533}
534
535genrule {
536 name: "BluetoothCertStackGeneratedStub_cc",
537 tools: [
538 "aprotoc",
539 "protoc-gen-grpc-cpp-plugin",
540 ],
541 cmd: "$(location aprotoc) -Isystem/bt/gd -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(in) --grpc_out=$(genDir) --cpp_out=$(genDir)",
542 srcs: [
543 ":BluetoothCertStackProto",
Colin Cross62084352019-05-23 14:12:59 -0700544 ":BluetoothFacadeProto", // we need to use facade/common.proto
Hansong Zhang90ec7402019-04-29 16:04:07 -0700545 ],
546 out: [
Hansong Zhang30bf8692019-05-02 15:25:54 -0700547 "cert/rootservice.grpc.pb.cc",
548 "cert/rootservice.pb.cc",
Hansong Zhang90ec7402019-04-29 16:04:07 -0700549 "facade/common.grpc.pb.cc",
550 "facade/common.pb.cc",
551 "hal/cert/api.grpc.pb.cc",
552 "hal/cert/api.pb.cc",
Hansong Zhangc5ec8f92019-06-19 17:22:21 -0700553 "hci/cert/api.grpc.pb.cc",
554 "hci/cert/api.pb.cc",
Jack Heff38d892019-10-03 17:11:07 -0700555 "l2cap/classic/cert/api.grpc.pb.cc",
556 "l2cap/classic/cert/api.pb.cc",
Zach Johnsonfacafb02019-04-22 16:34:49 -0700557 ],
558}
Jack He9be1dcd2019-11-18 19:20:41 -0800559
560cc_defaults {
561 name: "bluetooth_py3_native_extension_defaults",
562 include_dirs: [
563 "external/python/cpython3/Include",
564 ],
565 target: {
566 android: {
567 include_dirs: ["external/python/cpython3/android/bionic/pyconfig"],
568 },
569 android_arm: {
570 cflags: ["-DSOABI=\"cpython-38android-arm-android-bionic\""],
571 suffix: ".cpython-38android-arm-android-bionic",
572 },
573 android_arm64: {
574 cflags: ["-DSOABI=\"cpython-38android-arm64-android-bionic\""],
575 suffix: ".cpython-38android-arm64-android-bionic",
576 },
577 android_x86: {
578 cflags: ["-DSOABI=\"cpython-38android-x86-android-bionic\""],
579 suffix: ".cpython-38android-x86-android-bionic",
580 },
581 android_x86_64: {
582 cflags: ["-DSOABI=\"cpython-38android-x86_64-android-bionic\""],
583 suffix: ".cpython-38android-x86_64-android-bionic",
584 },
585 // Regenerate include dirs with android_regen.sh
586 darwin_x86_64: {
587 include_dirs: ["external/python/cpython3/android/darwin_x86_64/pyconfig"],
588 cflags: [
589 "-Wno-deprecated-declarations",
590 "-Wno-pointer-arith",
591 "-DSOABI=\"cpython-38android-x86_64-darwin\"",
592 ],
593 suffix: ".cpython-38android-x86_64-darwin",
594 },
595 linux_bionic: {
596 // NB linux_bionic is a 'host' architecture but it uses the bionic libc like 'android'
597 // targets so use the android pyconfig.
598 include_dirs: ["external/python/cpython3/android/bionic/pyconfig"],
599 cflags: ["-DSOABI=\"cpython-38android-x86_64-linux-bionic\""],
600 suffix: ".cpython-38android-x86_64-linux-bionic",
601 },
602 linux_glibc_x86: {
603 enabled: false,
604 },
605 linux_glibc_x86_64: {
606 include_dirs: ["external/python/cpython3/android/linux_x86_64/pyconfig"],
607 cflags: ["-DSOABI=\"cpython-38android-x86_64-linux-gnu\""],
Jack He8768f572019-11-20 21:44:55 -0800608 // Commenting out the Linux suffix so that cpython-38-x86_64-linux-gnu
609 // Python 3.8 can also import the untagged .so library per PEP 3149
610 // Keep this change until Android py3-cmd can run ACTS, gRPC and can
611 // Export Python native symbols such as PyType_Type
612 // suffix: ".cpython-38android-x86_64-linux-gnu",
Jack He9be1dcd2019-11-18 19:20:41 -0800613 },
614 windows: {
615 enabled: false,
616 },
617 },
618 allow_undefined_symbols: true,
619}
620
621cc_library{
622 name: "bluetooth_packets_python3",
623 defaults: [
624 "gd_defaults",
625 "bluetooth_py3_native_extension_defaults"
626 ],
627 host_supported: true,
628 srcs: [
629 "packet/python3_module.cc",
630 "l2cap/fcs.cc",
631 ":BluetoothPacketSources",
632 ],
633 generated_headers: [
634 "BluetoothGeneratedPackets_h",
635 ],
636 generated_sources: [
637 "BluetoothGeneratedPackets_python3_cc",
638 ],
639 header_libs: [
640 "pybind11_headers",
641 ],
642 cflags: [
643 "-fexceptions",
644 ],
645 rtti: true,
646}