summaryrefslogtreecommitdiff
path: root/tests/BUILD.bazel
blob: 856431c589a2ab0614a3c92fe0d6e924f5415e74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
load("@rules_cc//cc:defs.bzl", "cc_test")
load("//:build_defs.bzl", "flatbuffer_cc_library")

package(default_visibility = ["//visibility:private"])

# Test binary.
cc_test(
    name = "flatbuffers_test",
    testonly = 1,
    srcs = [
        "evolution_test/evolution_v1_generated.h",
        "evolution_test/evolution_v2_generated.h",
        "monster_test_bfbs_generated.h",
        "namespace_test/namespace_test1_generated.h",
        "namespace_test/namespace_test2_generated.h",
        "native_type_test_impl.cpp",
        "native_type_test_impl.h",
        "optional_scalars_generated.h",
        "test.cpp",
        "test_assert.cpp",
        "test_assert.h",
        "test_builder.cpp",
        "test_builder.h",
        "union_vector/union_vector_generated.h",
    ],
    copts = [
        "-DFLATBUFFERS_TRACK_VERIFIER_BUFFER_SIZE",
        "-DBAZEL_TEST_DATA_PATH",
    ],
    data = [
        ":arrays_test.bfbs",
        ":arrays_test.fbs",
        ":arrays_test.golden",
        ":evolution_test/evolution_v1.fbs",
        ":evolution_test/evolution_v1.json",
        ":evolution_test/evolution_v2.fbs",
        ":evolution_test/evolution_v2.json",
        ":include_test/include_test1.fbs",
        ":include_test/sub/include_test2.fbs",
        ":monster_extra.fbs",
        ":monster_test.bfbs",
        ":monster_test.fbs",
        ":monsterdata_extra.json",
        ":monsterdata_test.golden",
        ":monsterdata_test.json",
        ":native_type_test.fbs",
        ":optional_scalars.fbs",
        ":prototest/imported.proto",
        ":prototest/test.golden",
        ":prototest/test.proto",
        ":prototest/test_include.golden",
        ":prototest/test_suffix.golden",
        ":prototest/test_union.golden",
        ":prototest/test_union_include.golden",
        ":prototest/test_union_suffix.golden",
        ":unicode_test.json",
        ":union_vector/union_vector.fbs",
        ":union_vector/union_vector.json",
    ],
    includes = [
        "",
        "include/",
    ],
    deps = [
        ":arrays_test_cc_fbs",
        ":monster_extra_cc_fbs",
        ":monster_test_cc_fbs",
        ":native_type_test_cc_fbs",
        "//:flatbuffers",
    ],
)

# Test bzl rules

cc_library(
    name = "test_assert",
    srcs = ["test_assert.cpp"],
    hdrs = ["test_assert.h"],
    visibility = ["//grpc/tests:__subpackages__"],
    deps = ["//:flatbuffers"],
)

cc_library(
    name = "test_builder",
    srcs = ["test_builder.cpp"],
    hdrs = ["test_builder.h"],
    visibility = ["//grpc/tests:__subpackages__"],
    deps = [
        ":monster_test_grpc",
        ":test_assert",
        "//:flatbuffers",
    ],
)

cc_library(
    name = "monster_test_grpc",
    srcs = [
        "monster_test.grpc.fb.cc",
        "monster_test.grpc.fb.h",
        "monster_test_generated.h",
    ],
    hdrs = [
        "monster_test.grpc.fb.h",
        "monster_test_generated.h",
    ],
    includes = ["."],
    visibility = ["//grpc/tests:__subpackages__"],
    deps = [
        "//:flatbuffers",
        "@com_github_grpc_grpc//:grpc++",
    ],
)

flatbuffer_cc_library(
    name = "monster_test_cc_fbs",
    srcs = ["monster_test.fbs"],
    include_paths = ["tests/include_test"],
    includes = [
        "include_test/include_test1.fbs",
        "include_test/sub/include_test2.fbs",
    ],
    visibility = ["//grpc/tests:__subpackages__"],
)

flatbuffer_cc_library(
    name = "monster_extra_cc_fbs",
    srcs = ["monster_extra.fbs"],
)

flatbuffer_cc_library(
    name = "arrays_test_cc_fbs",
    srcs = ["arrays_test.fbs"],
    flatc_args = [
        "--gen-object-api",
        "--gen-compare",
        "--no-includes",
        "--gen-mutable",
        "--reflect-names",
        "--cpp-ptr-type flatbuffers::unique_ptr",
        "--scoped-enums",
    ],
)

flatbuffer_cc_library(
    name = "native_type_test_cc_fbs",
    srcs = ["native_type_test.fbs"],
    flatc_args = [
        "--gen-object-api",
        "--gen-mutable",
        "--cpp-ptr-type flatbuffers::unique_ptr",
    ],
)