package { // See: http://go/android-license-faq // A large-scale-change added 'default_applicable_licenses' to import // all of the 'license_kinds' from "system_bt_license" // to get the below license kinds: // SPDX-license-identifier-Apache-2.0 default_applicable_licenses: ["system_bt_license"], } rust_library_host_rlib { name: "libbt_topshim", defaults: ["gd_rust_defaults"], crate_name: "bt_topshim", srcs: [ "src/lib.rs", ":libbt_topshim_wrapper_bindgen", ], rustlibs: [ "libbitflags", "libbt_common", "libcxx", "libfutures", "libgrpcio", "liblog_rust", "libnix", "libnum_traits", "libtokio", "libtokio_stream", ], proc_macros: [ "libnum_derive", "libpaste", "libtopshim_macros", ], lints: "none", clippy_lints: "none", } cc_library_static { name: "libbt_topshim_cxx", srcs: [ "btav/btav_shim.cc", "btav_sink/btav_sink_shim.cc", "controller/controller_shim.cc", "csis/csis_shim.cc", "gatt/gatt_ble_advertiser_shim.cc", "gatt/gatt_ble_scanner_shim.cc", "gatt/gatt_shim.cc", "hfp/hfp_shim.cc", "le_audio/le_audio_shim.cc", "vc/vc_shim.cc", ], generated_headers: [ "BluetoothGeneratedDumpsysDataSchema_h", "cxx-bridge-header", "libbt_topshim_bridge_header", ], generated_sources: ["libbt_topshim_bridge_code"], include_dirs: [ "packages/modules/Bluetooth/system", "packages/modules/Bluetooth/system/gd", "packages/modules/Bluetooth/system/gd/rust/topshim", "packages/modules/Bluetooth/system/include", ], host_supported: true, static_libs: [ "aics", "libbluetooth_hci_pdl", "libbluetooth_log", "libchrome", "libflatbuffers-cpp", ], aidl: { libs: ["bluetooth_constants"], }, shared_libs: [ "libbinder", ], target: { darwin: { enabled: false, }, }, } gensrcs { name: "libbt_topshim_bridge_header", tools: ["cxxbridge"], cmd: "$(location cxxbridge) $(in) --header > $(out)", srcs: [ "src/controller.rs", "src/profiles/a2dp.rs", "src/profiles/avrcp.rs", "src/profiles/csis.rs", "src/profiles/gatt.rs", "src/profiles/hfp.rs", "src/profiles/le_audio.rs", "src/profiles/vc.rs", ], output_extension: "rs.h", export_include_dirs: ["."], } gensrcs { name: "libbt_topshim_bridge_code", tools: ["cxxbridge"], cmd: "$(location cxxbridge) $(in) > $(out)", srcs: [ "src/controller.rs", "src/profiles/a2dp.rs", "src/profiles/avrcp.rs", "src/profiles/csis.rs", "src/profiles/gatt.rs", "src/profiles/hfp.rs", "src/profiles/le_audio.rs", "src/profiles/vc.rs", ], output_extension: "cc", export_include_dirs: ["."], } rust_bindgen { name: "libbt_topshim_wrapper_bindgen", wrapper_src: "bindings/wrapper.hpp", crate_name: "bt_topshim_wrapper_bindgen", source_stem: "bindings", defaults: ["bluetooth_cflags"], c_std: "", host_supported: true, bindgen_flags: [ "--allowlist-function=bt_.*", "--allowlist-function=btgatt_.*", "--allowlist-function=bthh_.*", "--allowlist-function=btsdp.*", "--allowlist-function=hal_util_.*", "--allowlist-function=osi_property_get.*", "--allowlist-type=bluetooth_sdp.*", "--allowlist-type=bt_.*", "--allowlist-type=btgatt_.*", "--allowlist-type=bthf_.*", "--allowlist-type=bthh_.*", "--allowlist-type=btrc_.*", "--allowlist-type=btsdp.*", "--allowlist-type=btsock_.*", "--allowlist-type=sock_connect_signal_t", "--enable-cxx-namespaces", "--opaque-type=std::.*", "--with-derive-default", "--with-derive-eq", "--with-derive-partialeq", ], shared_libs: [ "libc++", ], cflags: [ "-DTARGET_FLOSS", ], static_libs: [ "libbluetooth_log", ], // The bindgen rule can only include headers via header_libs and does not // support include_dirs. Make sure newly added headers have the correct // header export target listed here. header_libs: [ "libbluetooth_headers", "libbluetooth_system_headers", ], }