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
10filegroup {
11    name: "BluetoothFlatbufferBundlerSources",
12    visibility: ["//visibility:private"],
13    srcs: [
14        "bundler.cc",
15        "main.cc",
16    ],
17}
18
19filegroup {
20    name: "BluetoothFlatbufferBundlerTestSources",
21    visibility: ["//visibility:private"],
22    srcs: [
23        "bundler.cc",
24        "test.cc",
25    ],
26}
27
28// Flatbuffer bundler schema that wraps the bundled binary module schema
29genrule {
30    name: "BluetoothGeneratedBundlerSchema_h_bfbs",
31    visibility: [
32        "//packages/modules/Bluetooth/system/bta",
33        "//packages/modules/Bluetooth/system/btif",
34        "//packages/modules/Bluetooth/system/btm",
35        "//packages/modules/Bluetooth/system/gd",
36        "//packages/modules/Bluetooth/system/main",
37        "//packages/modules/Bluetooth/system/rust",
38        "//packages/modules/Bluetooth/system/stack",
39    ],
40    tools: [
41        "flatc",
42    ],
43    cmd: "$(location flatc) -I packages/modules/Bluetooth/system/gd -b --schema -o $(genDir) --cpp $(in) ",
44    srcs: [
45        "bundler_schema.fbs",
46    ],
47    out: [
48        "bundler_schema.bfbs",
49        "bundler_schema_generated.h",
50    ],
51}
52
53cc_defaults {
54    name: "bluetooth_flatbuffer_bundler_defaults",
55    defaults: ["bluetooth_cflags"],
56    generated_headers: [
57        "BluetoothGeneratedBundlerSchema_h_bfbs",
58    ],
59    sanitize: {
60        misc_undefined: ["bounds"],
61    },
62    static_libs: [
63        "libflatbuffers-cpp",
64    ],
65}
66
67cc_binary_host {
68    name: "bluetooth_flatbuffer_bundler",
69    srcs: [
70        ":BluetoothFlatbufferBundlerSources",
71    ],
72    defaults: [
73        "bluetooth_flatbuffer_bundler_defaults",
74    ],
75    cflags: ["-Wno-unused-parameter"],
76}
77
78cc_test_host {
79    name: "bluetooth_flatbuffer_bundler_test",
80    srcs: [
81        ":BluetoothFlatbufferBundlerTestSources",
82    ],
83    defaults: [
84        "bluetooth_flatbuffer_bundler_defaults",
85    ],
86    data: [
87        "test.bfbs",
88    ],
89    test_options: {
90        unit_test: true,
91    },
92    cflags: ["-Wno-unused-parameter"],
93}
94