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    srcs: [
13        "bundler.cc",
14        "main.cc",
15    ],
16}
17
18filegroup {
19    name: "BluetoothFlatbufferBundlerTestSources",
20    srcs: [
21        "bundler.cc",
22        "test.cc",
23    ],
24}
25
26genrule {
27    name: "BluetoothGeneratedBundlerSchema_h_bfbs",
28    tools: [
29        "flatc",
30    ],
31    cmd: "$(location flatc) -I system/bt/gd -b --schema -o $(genDir) --cpp $(in) ",
32    srcs: [
33        "bundler.fbs",
34    ],
35    out: [
36        "bundler_generated.h", "bundler.bfbs",
37    ],
38}
39
40cc_defaults {
41    name: "bluetooth_flatbuffer_bundler_defaults",
42    cpp_std: "c++17",
43    cflags: [
44        "-Wall",
45        "-Werror",
46        "-Wno-unused-parameter",
47        "-Wno-unused-variable",
48    ],
49    generated_headers: [
50        "BluetoothGeneratedBundlerSchema_h_bfbs",
51    ],
52    sanitize: {
53        misc_undefined: ["bounds"],
54    },
55    static_libs: [
56        "libflatbuffers-cpp",
57    ],
58}
59
60cc_binary_host {
61    name: "bluetooth_flatbuffer_bundler",
62    srcs: [
63        ":BluetoothFlatbufferBundlerSources",
64    ],
65    defaults: [
66        "bluetooth_flatbuffer_bundler_defaults",
67    ],
68}
69
70cc_test {
71    name: "bluetooth_flatbuffer_bundler_test",
72    host_supported: true,
73    srcs: [
74        ":BluetoothFlatbufferBundlerTestSources",
75    ],
76    defaults: [
77        "bluetooth_flatbuffer_bundler_defaults",
78    ],
79    data: [
80        "test.bfbs",
81    ],
82    test_options: {
83        unit_test: true,
84    },
85}
86