Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f39dd283 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Use libraries to track PDL-generated packet files" into main

parents 5400d131 4e304b91
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -19,10 +19,10 @@ LOCAL_host_executables := \
	$(HOST_OUT_EXECUTABLES)/root-canal

LOCAL_host_python_hci_packets_library := \
	$(SOONG_OUT_DIR)/.intermediates/packages/modules/Bluetooth/system/gd/gd_hci_packets_python3_gen/gen/hci_packets.py
	$(SOONG_OUT_DIR)/.intermediates/packages/modules/Bluetooth/system/pdl/hci/gd_hci_packets_python3_gen/gen/hci_packets.py

LOCAL_host_python_smp_packets_library := \
	$(SOONG_OUT_DIR)/.intermediates/packages/modules/Bluetooth/system/gd/gd_smp_packets_python3_gen/gen/smp_packets.py
	$(SOONG_OUT_DIR)/.intermediates/packages/modules/Bluetooth/system/pdl/security/gd_smp_packets_python3_gen/gen/smp_packets.py

LOCAL_host_python_extension_libraries := \
	$(HOST_OUT_SHARED_LIBRARIES)/bluetooth_packets_python3.so
+6 −84
Original line number Diff line number Diff line
@@ -153,7 +153,6 @@ cc_defaults {
    generated_headers: [
        "BluetoothGeneratedBundlerSchema_h_bfbs",
        "BluetoothGeneratedDumpsysDataSchema_h",
        "BluetoothGeneratedPackets_h",
    ],
    shared_libs: [
        "libcrypto",
@@ -163,6 +162,9 @@ cc_defaults {
        "libflatbuffers-cpp",
    ],
    whole_static_libs: [
        "libbluetooth_hci_pdl",
        "libbluetooth_l2cap_pdl",
        "libbluetooth_smp_pdl",
        "libc++fs",
    ],
    static_libs: [
@@ -218,7 +220,9 @@ cc_library {
    cflags: [
        "-DUSE_FAKE_TIMERS",
    ],
    static_libs: ["libchrome"],
    static_libs: [
        "libchrome",
    ],
}

cc_binary {
@@ -559,32 +563,6 @@ filegroup {
    ],
}

genrule {
    name: "BluetoothGeneratedPackets_h",
    tools: [
        "bluetooth_packetgen",
    ],
    cmd: "$(location bluetooth_packetgen) --fuzzing --testing --include=packages/modules/Bluetooth/system/gd --out=$(genDir) $(in)",
    srcs: [
        "hci/hci_packets.pdl",
        "l2cap/l2cap_packets.pdl",
        "security/smp_packets.pdl",
    ],
    out: [
        "hci/hci_packets.h",
        "l2cap/l2cap_packets.h",
        "security/smp_packets.h",
    ],
    visibility: ["//visibility:public"],
}

genrule {
    name: "BluetoothGeneratedPackets_rust",
    defaults: ["pdl_rust_generator_defaults"],
    srcs: ["hci/hci_packets.pdl"],
    out: ["hci/hci_packets.rs"],
}

rust_library {
    name: "libbt_packets",
    defaults: ["gd_rust_defaults"],
@@ -685,30 +663,6 @@ genrule {
    ],
}

genrule {
    name: "BluetoothGeneratedPackets_python3_cc",
    tools: [
        "bluetooth_packetgen",
    ],
    cmd: "$(location bluetooth_packetgen) --include=packages/modules/Bluetooth/system/gd --out=$(genDir) --num_shards=10 $(in)",
    srcs: [
        "l2cap/l2cap_packets.pdl",
    ],
    out: [
        "l2cap/l2cap_packets_python3.cc",
        "l2cap/l2cap_packets_python3_shard_0.cc",
        "l2cap/l2cap_packets_python3_shard_1.cc",
        "l2cap/l2cap_packets_python3_shard_2.cc",
        "l2cap/l2cap_packets_python3_shard_3.cc",
        "l2cap/l2cap_packets_python3_shard_4.cc",
        "l2cap/l2cap_packets_python3_shard_5.cc",
        "l2cap/l2cap_packets_python3_shard_6.cc",
        "l2cap/l2cap_packets_python3_shard_7.cc",
        "l2cap/l2cap_packets_python3_shard_8.cc",
        "l2cap/l2cap_packets_python3_shard_9.cc",
    ],
}

cc_defaults {
    name: "bluetooth_py3_native_extension_defaults",
    include_dirs: [
@@ -811,35 +765,3 @@ cc_library_host_shared {
    ],
    rtti: true,
}

// Generate the python parser+serializer backend for
// hci_packets.pdl.
genrule {
    name: "gd_hci_packets_python3_gen",
    defaults: ["pdl_python_generator_defaults"],
    cmd: "$(location :pdlc) $(in) |" +
        " $(location :pdl_python_generator)" +
        " --output $(out) --custom-type-location blueberry.utils.bluetooth",
    srcs: [
        ":BluetoothHciPackets",
    ],
    out: [
        "hci_packets.py",
    ],
}

// Generate the python parser+serializer backend for
// smp_packets.pdl.
genrule {
    name: "gd_smp_packets_python3_gen",
    defaults: ["pdl_python_generator_defaults"],
    cmd: "$(location :pdlc) $(in) |" +
        " $(location :pdl_python_generator)" +
        " --output $(out) --custom-type-location blueberry.utils.bluetooth",
    srcs: [
        "security/smp_packets.pdl",
    ],
    out: [
        "smp_packets.py",
    ],
}
+2 −25
Original line number Diff line number Diff line
@@ -46,9 +46,9 @@ group("gd_default_deps") {
  deps = [
    "//bt/system:libbt-platform-protos-lite",
    "//bt/system/gd:BluetoothGeneratedDumpsysDataSchema_h",
    "//bt/system/gd:BluetoothGeneratedPackets_h",
    "//bt/system/gd/dumpsys:libbluetooth-dumpsys",
    "//bt/system/gd/rust/shim:init_flags_bridge_header",
    "//bt/system/pdl:BluetoothGeneratedPackets_h",
  ]
}

@@ -64,7 +64,6 @@ static_library("libbluetooth_gd") {
    "//bt/system/gd/rust/common:libbt_keystore_cc",
    "//bt/system/gd/rust/topshim:libbluetooth_topshim",
    "//bt/system/gd/rust/shim:libbluetooth_rust_interop",
    "//bt/system/gd:BluetoothGeneratedPackets_h",
    "//bt/system/gd/att:BluetoothAttSources",
    "//bt/system/gd/common:BluetoothCommonSources",
    "//bt/system/gd/crypto_toolbox:BluetoothCryptoToolboxSources",
@@ -78,6 +77,7 @@ static_library("libbluetooth_gd") {
    "//bt/system/gd/shim:BluetoothShimSources",
    "//bt/system/gd/storage:BluetoothStorageSources",
    "//bt/system/gd/sysprops:BluetoothSyspropsSources",
    "//bt/system/pdl:BluetoothGeneratedPackets_h",
  ]
}

@@ -106,26 +106,3 @@ bt_flatc_binary_schema("BluetoothGeneratedDumpsysBinarySchema_bfbs") {

  include_dir = "system/gd"
}

packetgen_py("BluetoothGeneratedPackets_python3_cc") {
  sources = [
    "hci/hci_packets.pdl",
    "l2cap/l2cap_packets.pdl",
    "security/smp_packets.pdl",
  ]

  include = "system/gd"
  source_root = "../.."
  shards = 10
}

packetgen_headers("BluetoothGeneratedPackets_h") {
  sources = [
    "hci/hci_packets.pdl",
    "l2cap/l2cap_packets.pdl",
    "security/smp_packets.pdl",
  ]

  include = "system/gd"
  source_root = "../.."
}
+2 −1
Original line number Diff line number Diff line
@@ -32,7 +32,8 @@ ANDROID_BUILD_TOP = os.getenv("ANDROID_BUILD_TOP")
PYBIND11_INCLUDE_DIR = os.path.join(ANDROID_BUILD_TOP, "external/python/pybind11/include")
GD_DIR = os.path.join(ANDROID_BUILD_TOP, "packages/modules/Bluetooth/system/gd")
BT_PACKETS_GEN_DIR = os.path.join(
    ANDROID_BUILD_TOP, "out/soong/.intermediates/packages/modules/Bluetooth/system/gd/BluetoothGeneratedPackets_h/gen")
    ANDROID_BUILD_TOP,
    "out/soong/.intermediates/packages/modules/Bluetooth/system/gd/BluetoothGeneratedPackets_h/gen")
BT_PACKETS_PY3_GEN_DIR = os.path.join(
    ANDROID_BUILD_TOP,
    "out/soong/.intermediates/packages/modules/Bluetooth/system/gd/BluetoothGeneratedPackets_python3_cc/gen")
+0 −17
Original line number Diff line number Diff line
@@ -7,19 +7,9 @@ package {
    default_applicable_licenses: ["system_bt_license"],
}

filegroup {
    name: "BluetoothHciPacketSources",
    srcs: [
        "address.cc",
        "class_of_device.cc",
    ],
    visibility: ["//visibility:public"],
}

filegroup {
    name: "BluetoothHciSources",
    srcs: [
        ":BluetoothHciPacketSources",
        "acl_manager.cc",
        "acl_manager/acl_connection.cc",
        "acl_manager/acl_fragmenter.cc",
@@ -103,10 +93,3 @@ filegroup {
        "fuzz/status_vs_complete_commands.cc",
    ],
}

filegroup {
    name: "BluetoothHciPackets",
    srcs: [
        "hci_packets.pdl",
    ],
}
Loading