Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame] | 1 | load("@rules_cc//cc:defs.bzl", "cc_test") |
| 2 | |
| 3 | package(default_visibility = ["//visibility:private"]) |
| 4 | |
| 5 | # Test binary. |
| 6 | cc_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 | "monster_test_bfbs_generated.h", |
| 13 | "namespace_test/namespace_test1_generated.h", |
| 14 | "namespace_test/namespace_test2_generated.h", |
| 15 | "native_type_test_impl.cpp", |
| 16 | "native_type_test_impl.h", |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame^] | 17 | "optional_scalars_generated.h", |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame] | 18 | "test.cpp", |
| 19 | "test_assert.cpp", |
| 20 | "test_assert.h", |
| 21 | "test_builder.cpp", |
| 22 | "test_builder.h", |
| 23 | "union_vector/union_vector_generated.h", |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame] | 24 | ], |
| 25 | copts = [ |
| 26 | "-DFLATBUFFERS_TRACK_VERIFIER_BUFFER_SIZE", |
| 27 | "-DBAZEL_TEST_DATA_PATH", |
| 28 | ], |
| 29 | data = [ |
| 30 | ":arrays_test.bfbs", |
| 31 | ":arrays_test.fbs", |
| 32 | ":arrays_test.golden", |
| 33 | ":evolution_test/evolution_v1.fbs", |
| 34 | ":evolution_test/evolution_v1.json", |
| 35 | ":evolution_test/evolution_v2.fbs", |
| 36 | ":evolution_test/evolution_v2.json", |
| 37 | ":include_test/include_test1.fbs", |
| 38 | ":include_test/sub/include_test2.fbs", |
| 39 | ":monster_extra.fbs", |
| 40 | ":monster_test.bfbs", |
| 41 | ":monster_test.fbs", |
| 42 | ":monsterdata_extra.json", |
| 43 | ":monsterdata_test.golden", |
| 44 | ":monsterdata_test.json", |
| 45 | ":native_type_test.fbs", |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame^] | 46 | ":optional_scalars.fbs", |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame] | 47 | ":prototest/imported.proto", |
| 48 | ":prototest/test.golden", |
| 49 | ":prototest/test.proto", |
| 50 | ":prototest/test_include.golden", |
| 51 | ":prototest/test_suffix.golden", |
| 52 | ":prototest/test_union.golden", |
| 53 | ":prototest/test_union_include.golden", |
| 54 | ":prototest/test_union_suffix.golden", |
| 55 | ":unicode_test.json", |
| 56 | ":union_vector/union_vector.fbs", |
| 57 | ":union_vector/union_vector.json", |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame] | 58 | ], |
| 59 | includes = [ |
| 60 | "", |
| 61 | "include/", |
| 62 | ], |
| 63 | deps = [ |
| 64 | ":arrays_test_cc_fbs", |
| 65 | ":monster_extra_cc_fbs", |
| 66 | ":monster_test_cc_fbs", |
| 67 | ":native_type_test_cc_fbs", |
| 68 | "//:flatbuffers", |
| 69 | ], |
| 70 | ) |
| 71 | |
| 72 | # Test bzl rules |
| 73 | load("//:build_defs.bzl", "flatbuffer_cc_library") |
| 74 | |
| 75 | cc_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 | |
| 83 | cc_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 | |
| 95 | cc_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 | |
| 114 | flatbuffer_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 | |
| 125 | flatbuffer_cc_library( |
| 126 | name = "monster_extra_cc_fbs", |
| 127 | srcs = ["monster_extra.fbs"], |
| 128 | ) |
| 129 | |
| 130 | flatbuffer_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 | |
| 144 | flatbuffer_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 | ) |