• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1load("@rules_cc//cc:defs.bzl", "cc_test")
2load("//:build_defs.bzl", "flatbuffer_cc_library")
3
4package(default_visibility = ["//visibility:private"])
5
6# Test binary.
7cc_test(
8    name = "flatbuffers_test",
9    testonly = 1,
10    srcs = [
11        "evolution_test/evolution_v1_generated.h",
12        "evolution_test/evolution_v2_generated.h",
13        "monster_test_bfbs_generated.h",
14        "namespace_test/namespace_test1_generated.h",
15        "namespace_test/namespace_test2_generated.h",
16        "native_type_test_impl.cpp",
17        "native_type_test_impl.h",
18        "optional_scalars_generated.h",
19        "test.cpp",
20        "test_assert.cpp",
21        "test_assert.h",
22        "test_builder.cpp",
23        "test_builder.h",
24        "union_vector/union_vector_generated.h",
25    ],
26    copts = [
27        "-DFLATBUFFERS_TRACK_VERIFIER_BUFFER_SIZE",
28        "-DBAZEL_TEST_DATA_PATH",
29    ],
30    data = [
31        ":arrays_test.bfbs",
32        ":arrays_test.fbs",
33        ":arrays_test.golden",
34        ":evolution_test/evolution_v1.fbs",
35        ":evolution_test/evolution_v1.json",
36        ":evolution_test/evolution_v2.fbs",
37        ":evolution_test/evolution_v2.json",
38        ":include_test/include_test1.fbs",
39        ":include_test/sub/include_test2.fbs",
40        ":monster_extra.fbs",
41        ":monster_test.bfbs",
42        ":monster_test.fbs",
43        ":monsterdata_extra.json",
44        ":monsterdata_test.golden",
45        ":monsterdata_test.json",
46        ":native_type_test.fbs",
47        ":optional_scalars.fbs",
48        ":prototest/imported.proto",
49        ":prototest/test.golden",
50        ":prototest/test.proto",
51        ":prototest/test_include.golden",
52        ":prototest/test_suffix.golden",
53        ":prototest/test_union.golden",
54        ":prototest/test_union_include.golden",
55        ":prototest/test_union_suffix.golden",
56        ":unicode_test.json",
57        ":union_vector/union_vector.fbs",
58        ":union_vector/union_vector.json",
59    ],
60    includes = [
61        "",
62        "include/",
63    ],
64    deps = [
65        ":arrays_test_cc_fbs",
66        ":monster_extra_cc_fbs",
67        ":monster_test_cc_fbs",
68        ":native_type_test_cc_fbs",
69        "//:flatbuffers",
70    ],
71)
72
73# Test bzl rules
74
75cc_library(
76    name = "test_assert",
77    srcs = ["test_assert.cpp"],
78    hdrs = ["test_assert.h"],
79    visibility = ["//grpc/tests:__subpackages__"],
80    deps = ["//:flatbuffers"],
81)
82
83cc_library(
84    name = "test_builder",
85    srcs = ["test_builder.cpp"],
86    hdrs = ["test_builder.h"],
87    visibility = ["//grpc/tests:__subpackages__"],
88    deps = [
89        ":monster_test_grpc",
90        ":test_assert",
91        "//:flatbuffers",
92    ],
93)
94
95cc_library(
96    name = "monster_test_grpc",
97    srcs = [
98        "monster_test.grpc.fb.cc",
99        "monster_test.grpc.fb.h",
100        "monster_test_generated.h",
101    ],
102    hdrs = [
103        "monster_test.grpc.fb.h",
104        "monster_test_generated.h",
105    ],
106    includes = ["."],
107    visibility = ["//grpc/tests:__subpackages__"],
108    deps = [
109        "//:flatbuffers",
110        "@com_github_grpc_grpc//:grpc++",
111    ],
112)
113
114flatbuffer_cc_library(
115    name = "monster_test_cc_fbs",
116    srcs = ["monster_test.fbs"],
117    include_paths = ["tests/include_test"],
118    includes = [
119        "include_test/include_test1.fbs",
120        "include_test/sub/include_test2.fbs",
121    ],
122    visibility = ["//grpc/tests:__subpackages__"],
123)
124
125flatbuffer_cc_library(
126    name = "monster_extra_cc_fbs",
127    srcs = ["monster_extra.fbs"],
128)
129
130flatbuffer_cc_library(
131    name = "arrays_test_cc_fbs",
132    srcs = ["arrays_test.fbs"],
133    flatc_args = [
134        "--gen-object-api",
135        "--gen-compare",
136        "--no-includes",
137        "--gen-mutable",
138        "--reflect-names",
139        "--cpp-ptr-type flatbuffers::unique_ptr",
140        "--scoped-enums",
141    ],
142)
143
144flatbuffer_cc_library(
145    name = "native_type_test_cc_fbs",
146    srcs = ["native_type_test.fbs"],
147    flatc_args = [
148        "--gen-object-api",
149        "--gen-mutable",
150        "--cpp-ptr-type flatbuffers::unique_ptr",
151    ],
152)
153