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 // SPDX-license-identifier-BSD // SPDX-license-identifier-MIT // legacy_unencumbered default_applicable_licenses: ["system_bt_license"], } filegroup { name: "BlueberryFacadeProto", srcs: [ "blueberry/facade/common.proto", "blueberry/facade/hal/hal_facade.proto", "blueberry/facade/hci/acl_manager_facade.proto", "blueberry/facade/hci/controller_facade.proto", "blueberry/facade/hci/hci_facade.proto", "blueberry/facade/hci/le_acl_manager_facade.proto", "blueberry/facade/hci/le_advertising_manager_facade.proto", "blueberry/facade/hci/le_initiator_address_facade.proto", "blueberry/facade/hci/le_scanning_manager_facade.proto", "blueberry/facade/l2cap/classic/facade.proto", "blueberry/facade/l2cap/le/facade.proto", "blueberry/facade/neighbor/facade.proto", "blueberry/facade/rootservice.proto", "blueberry/facade/topshim/facade.proto", ], } filegroup { name: "TestMockCodecManager", srcs: [ "bta/le_audio/mock_codec_manager.cc", ], } genrule { name: "BlueberryFacadeGeneratedStub_h", tools: [ "aprotoc", "protoc-gen-grpc-cpp-plugin", ], cmd: "$(location aprotoc) -Ipackages/modules/Bluetooth/system -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(locations :BlueberryFacadeProto) --grpc_out=$(genDir) --cpp_out=$(genDir)", srcs: [ ":BlueberryFacadeProto", ":libprotobuf-internal-protos", ], out: [ "blueberry/facade/common.grpc.pb.h", "blueberry/facade/common.pb.h", "blueberry/facade/hal/hal_facade.grpc.pb.h", "blueberry/facade/hal/hal_facade.pb.h", "blueberry/facade/hci/acl_manager_facade.grpc.pb.h", "blueberry/facade/hci/acl_manager_facade.pb.h", "blueberry/facade/hci/controller_facade.grpc.pb.h", "blueberry/facade/hci/controller_facade.pb.h", "blueberry/facade/hci/hci_facade.grpc.pb.h", "blueberry/facade/hci/hci_facade.pb.h", "blueberry/facade/hci/le_acl_manager_facade.grpc.pb.h", "blueberry/facade/hci/le_acl_manager_facade.pb.h", "blueberry/facade/hci/le_advertising_manager_facade.grpc.pb.h", "blueberry/facade/hci/le_advertising_manager_facade.pb.h", "blueberry/facade/hci/le_initiator_address_facade.grpc.pb.h", "blueberry/facade/hci/le_initiator_address_facade.pb.h", "blueberry/facade/hci/le_scanning_manager_facade.grpc.pb.h", "blueberry/facade/hci/le_scanning_manager_facade.pb.h", "blueberry/facade/l2cap/classic/facade.grpc.pb.h", "blueberry/facade/l2cap/classic/facade.pb.h", "blueberry/facade/l2cap/le/facade.grpc.pb.h", "blueberry/facade/l2cap/le/facade.pb.h", "blueberry/facade/neighbor/facade.grpc.pb.h", "blueberry/facade/neighbor/facade.pb.h", "blueberry/facade/rootservice.grpc.pb.h", "blueberry/facade/rootservice.pb.h", ], } genrule { name: "BlueberryFacadeGeneratedStub_cc", tools: [ "aprotoc", "protoc-gen-grpc-cpp-plugin", ], cmd: "$(location aprotoc) -Ipackages/modules/Bluetooth/system -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(locations :BlueberryFacadeProto) --grpc_out=$(genDir) --cpp_out=$(genDir)", srcs: [ ":BlueberryFacadeProto", ":libprotobuf-internal-protos", ], out: [ "blueberry/facade/common.grpc.pb.cc", "blueberry/facade/common.pb.cc", "blueberry/facade/hal/hal_facade.grpc.pb.cc", "blueberry/facade/hal/hal_facade.pb.cc", "blueberry/facade/hci/acl_manager_facade.grpc.pb.cc", "blueberry/facade/hci/acl_manager_facade.pb.cc", "blueberry/facade/hci/controller_facade.grpc.pb.cc", "blueberry/facade/hci/controller_facade.pb.cc", "blueberry/facade/hci/hci_facade.grpc.pb.cc", "blueberry/facade/hci/hci_facade.pb.cc", "blueberry/facade/hci/le_acl_manager_facade.grpc.pb.cc", "blueberry/facade/hci/le_acl_manager_facade.pb.cc", "blueberry/facade/hci/le_advertising_manager_facade.grpc.pb.cc", "blueberry/facade/hci/le_advertising_manager_facade.pb.cc", "blueberry/facade/hci/le_initiator_address_facade.grpc.pb.cc", "blueberry/facade/hci/le_initiator_address_facade.pb.cc", "blueberry/facade/hci/le_scanning_manager_facade.grpc.pb.cc", "blueberry/facade/hci/le_scanning_manager_facade.pb.cc", "blueberry/facade/l2cap/classic/facade.grpc.pb.cc", "blueberry/facade/l2cap/classic/facade.pb.cc", "blueberry/facade/l2cap/le/facade.grpc.pb.cc", "blueberry/facade/l2cap/le/facade.pb.cc", "blueberry/facade/neighbor/facade.grpc.pb.cc", "blueberry/facade/neighbor/facade.pb.cc", "blueberry/facade/rootservice.grpc.pb.cc", "blueberry/facade/rootservice.pb.cc", ], } genrule { name: "BlueberryFacadeAndCertGeneratedStub_py", tools: [ "aprotoc", "protoc-gen-grpc-python-plugin", "soong_zip", ], cmd: "mkdir -p $(genDir)/files && " + "$(location aprotoc) -Ipackages/modules/Bluetooth/system -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-python-plugin) $(locations :BlueberryFacadeProto) --grpc_out=$(genDir)/files --python_out=$(genDir)/files && " + "for dir in `find $(genDir)/files -type d`; do touch $$dir/__init__.py; done &&" + "$(location soong_zip) -C $(genDir)/files -D $(genDir)/files -o $(out)", srcs: [ ":BlueberryFacadeProto", ":libprotobuf-internal-protos", ], out: ["blueberry_facade_generated_py.zip"], } rust_protobuf { name: "libbt_topshim_facade_protobuf", crate_name: "bt_topshim_facade_protobuf", source_stem: "topshim_facade", host_supported: true, grpc_protos: ["blueberry/facade/topshim/facade.proto"], } // Export system headers for rules that can't simply use `include_dirs` cc_library_headers { name: "libbluetooth_system_headers", visibility: [ "//packages/modules/Bluetooth/system:__subpackages__", ], export_include_dirs: ["./"], vendor_available: true, host_supported: true, apex_available: [ "//apex_available:platform", "com.android.btservices", ], min_sdk_version: "30", } genrule { name: "bluetooth_cert_test_sources-zip", tools: [ "soong_zip", ], srcs: [ "blueberry/**/*.py", "blueberry/**/*.yaml", "setup.py", ], out: ["bluetooth_cert_test_sources.zip"], cmd: "echo $(in) > $(genDir)/file_list.txt && " + "$(location soong_zip) -C packages/modules/Bluetooth/system -l $(genDir)/file_list.txt -o $(out)", } genrule { name: "gd_hci_packets_python3_gen-zip", tools: [ "soong_zip", ], srcs: [ ":gd_hci_packets_python3_gen", ], out: ["gd_hci_packets_python3_gen.zip"], cmd: "echo $(in) > $(genDir)/file_list.txt && " + "$(location soong_zip) -j -l $(genDir)/file_list.txt -o $(out)", } genrule { name: "gd_smp_packets_python3_gen-zip", tools: [ "soong_zip", ], srcs: [ ":gd_smp_packets_python3_gen", ], out: ["gd_smp_packets_python3_gen.zip"], cmd: "echo $(in) > $(genDir)/file_list.txt && " + "$(location soong_zip) -j -l $(genDir)/file_list.txt -o $(out)", } cc_genrule { name: "bluetooth_cert_test_host_deps-zip", host_supported: true, device_supported: false, compile_multilib: "first", tools: [ "bluetooth_stack_with_facade", "bt_topshim_facade", "root-canal", "soong_zip", ], srcs: [ ":libbase", ":libbinder", ":libbinder_ndk", ":libbluetooth", ":libbluetooth_gd", ":libc++", ":libchrome", ":libcrypto", ":libcutils", ":libevent", ":libflatbuffers-cpp", ":libgrpc++", ":libgrpc_wrap", ":liblog", ":liblzma", ":libprotobuf-cpp-full", ":libssl", ":libunwindstack", ":libutils", ":libz", ":server_configurable_flags", ], out: ["bluetooth_cert_test_host_deps.zip"], cmd: "echo $(in) > $(genDir)/file_list.txt && " + "$(location soong_zip) -j -f $(location bluetooth_stack_with_facade) -f $(location bt_topshim_facade) -f $(location root-canal) -P lib64 -l $(genDir)/file_list.txt -o $(out)", } cc_genrule { name: "bluetooth_cert_test_target_deps-zip", compile_multilib: "first", tools: [ "soong_zip", ], srcs: [ // executables ":bluetooth_stack_with_facade", // libs ":android.hardware.bluetooth@1.0", ":android.hardware.bluetooth@1.1", ":libandroid_runtime_lazy", ":libbase", ":libbinder", ":libbinder_ndk", ":libc++", ":libcrypto", ":libcutils", ":libgrpc++", ":libgrpc_wrap", ":libhidlbase", ":liblog", ":liblzma", ":libprotobuf-cpp-full", ":libssl", ":libunwindstack", ":libutils", ":libz", ":server_configurable_flags", ], out: ["bluetooth_cert_test_target_deps.zip"], cmd: "echo $(in) > $(genDir)/file_list.txt && " + "$(location soong_zip) -j -P target -l $(genDir)/file_list.txt -o $(out)", } genrule { name: "llvm-tools-zip", tools: [ "soong_zip", ], srcs: [ ":llvm-tools", ], out: ["llvm-tools.zip"], cmd: "mkdir -p $(genDir)/llvm_binutils/bin && mkdir -p $(genDir)/llvm_binutils/lib/x86_64-unknown-linux-gnu && " + "cp prebuilts/clang/host/linux-x86/*/bin/llvm-cov $(genDir)/llvm_binutils/bin && " + "cp prebuilts/clang/host/linux-x86/*/bin/llvm-profdata $(genDir)/llvm_binutils/bin && " + "cp prebuilts/clang/host/linux-x86/*/bin/llvm-symbolizer $(genDir)/llvm_binutils/bin && " + "cp prebuilts/clang/host/linux-x86/*/lib/x86_64-unknown-linux-gnu/libc++.so $(genDir)/llvm_binutils/lib/x86_64-unknown-linux-gnu && " + "$(location soong_zip) -C $(genDir) -D $(genDir)/llvm_binutils -o $(out)", } cc_genrule { name: "bluetooth_cert_tests.zip", host_supported: true, device_supported: false, compile_multilib: "first", tools: [ "merge_zips", "soong_zip", ], srcs: [ ":BlueberryFacadeAndCertGeneratedStub_py", ":bluetooth_cert_test_host_deps-zip", ":bluetooth_cert_test_sources-zip", ":gd_hci_packets_python3_gen-zip", ":gd_smp_packets_python3_gen-zip", ":llvm-tools-zip", ], device_first_srcs: [ ":bluetooth_cert_test_target_deps-zip", ], out: ["bluetooth_cert_tests.zip"], cmd: "$(location merge_zips) $(genDir)/temp.zip $(in) && " + "unzip -q -d $(genDir)/files $(genDir)/temp.zip && " + "for d in $$(find $(genDir)/files/blueberry -type d -name '*'); do touch -a $$d/__init__.py; done && " + "$(location soong_zip) -C $(genDir)/files -D $(genDir)/files -o $(out)", dist: { targets: [ "bluetooth_stack_with_facade", ], }, }