1load("@rules_cc//cc:defs.bzl", "cc_test")
2
3package(default_visibility = ["//visibility:private"])
4
5# Test binary.
6cc_test(
7    name = "flatbuffers_test",
8    testonly = 1,
9    srcs = [
10        "evolution_test/evolution_v1_generated.h",
11        "evolution_test/evolution_v2_generated.h",
12        "namespace_test/namespace_test1_generated.h",
13        "namespace_test/namespace_test2_generated.h",
14        "native_type_test_impl.cpp",
15        "native_type_test_impl.h",
16        "test.cpp",
17        "test_assert.cpp",
18        "test_assert.h",
19        "test_builder.cpp",
20        "test_builder.h",
21        "union_vector/union_vector_generated.h",
22        "monster_test_bfbs_generated.h",
23    ],
24    copts = [
25        "-DFLATBUFFERS_TRACK_VERIFIER_BUFFER_SIZE",
26        "-DBAZEL_TEST_DATA_PATH",
27    ],
28    data = [
29        ":arrays_test.bfbs",
30        ":arrays_test.fbs",
31        ":arrays_test.golden",
32        ":evolution_test/evolution_v1.fbs",
33        ":evolution_test/evolution_v1.json",
34        ":evolution_test/evolution_v2.fbs",
35        ":evolution_test/evolution_v2.json",
36        ":include_test/include_test1.fbs",
37        ":include_test/sub/include_test2.fbs",
38        ":monster_extra.fbs",
39        ":monster_test.bfbs",
40        ":monster_test.fbs",
41        ":monsterdata_extra.json",
42        ":monsterdata_test.golden",
43        ":monsterdata_test.json",
44        ":native_type_test.fbs",
45        ":prototest/imported.proto",
46        ":prototest/test.golden",
47        ":prototest/test.proto",
48        ":prototest/test_include.golden",
49        ":prototest/test_suffix.golden",
50        ":prototest/test_union.golden",
51        ":prototest/test_union_include.golden",
52        ":prototest/test_union_suffix.golden",
53        ":unicode_test.json",
54        ":union_vector/union_vector.fbs",
55        ":union_vector/union_vector.json",
56    ],
57    includes = [
58        "",
59        "include/",
60    ],
61    deps = [
62        ":arrays_test_cc_fbs",
63        ":monster_extra_cc_fbs",
64        ":monster_test_cc_fbs",
65        ":native_type_test_cc_fbs",
66        "//:flatbuffers",
67    ],
68)
69
70# Test bzl rules
71load("//:build_defs.bzl", "flatbuffer_cc_library")
72
73flatbuffer_cc_library(
74    name = "monster_test_cc_fbs",
75    srcs = ["monster_test.fbs"],
76    include_paths = ["tests/include_test"],
77    includes = [
78        "include_test/include_test1.fbs",
79        "include_test/sub/include_test2.fbs",
80    ],
81)
82
83flatbuffer_cc_library(
84    name = "monster_extra_cc_fbs",
85    srcs = ["monster_extra.fbs"],
86)
87
88flatbuffer_cc_library(
89    name = "arrays_test_cc_fbs",
90    srcs = ["arrays_test.fbs"],
91    flatc_args = [
92        "--gen-object-api",
93        "--gen-compare",
94        "--no-includes",
95        "--gen-mutable",
96        "--reflect-names",
97        "--cpp-ptr-type flatbuffers::unique_ptr",
98        "--scoped-enums",
99    ],
100)
101
102flatbuffer_cc_library(
103    name = "native_type_test_cc_fbs",
104    srcs = ["native_type_test.fbs"],
105    flatc_args = [
106        "--gen-object-api",
107        "--gen-mutable",
108        "--cpp-ptr-type flatbuffers::unique_ptr",
109    ],
110)
111