Support for python grpc - continuing the work from the pull request #4270 #4705 ...
[platform/upstream/flatbuffers.git] / BUILD
1 licenses(["notice"])
2
3 load("@rules_cc//cc:defs.bzl", "cc_library")
4
5 package(
6     default_visibility = ["//visibility:public"],
7     features = [
8         "-layering_check",
9         "-parse_headers",
10     ],
11 )
12
13 exports_files([
14     "LICENSE",
15 ])
16
17 load(":build_defs.bzl", "flatbuffer_cc_library")
18
19 # Public flatc library to compile flatbuffer files at runtime.
20 cc_library(
21     name = "flatbuffers",
22     srcs = [
23         "src/code_generators.cpp",
24         "src/idl_gen_fbs.cpp",
25         "src/idl_gen_text.cpp",
26         "src/idl_parser.cpp",
27         "src/reflection.cpp",
28         "src/util.cpp",
29     ],
30     hdrs = [":public_headers"],
31     includes = ["include/"],
32     linkstatic = 1,
33 )
34
35 # Public C++ headers for the Flatbuffers library.
36 filegroup(
37     name = "public_headers",
38     srcs = [
39         "include/flatbuffers/base.h",
40         "include/flatbuffers/code_generators.h",
41         "include/flatbuffers/flatbuffers.h",
42         "include/flatbuffers/flexbuffers.h",
43         "include/flatbuffers/hash.h",
44         "include/flatbuffers/idl.h",
45         "include/flatbuffers/minireflect.h",
46         "include/flatbuffers/reflection.h",
47         "include/flatbuffers/reflection_generated.h",
48         "include/flatbuffers/stl_emulation.h",
49         "include/flatbuffers/util.h",
50     ],
51 )
52
53 # Public flatc compiler library.
54 cc_library(
55     name = "flatc_library",
56     srcs = [
57         "src/code_generators.cpp",
58         "src/flatc.cpp",
59         "src/idl_gen_fbs.cpp",
60         "src/idl_parser.cpp",
61         "src/reflection.cpp",
62         "src/util.cpp",
63     ],
64     hdrs = [
65         "include/flatbuffers/flatc.h",
66         ":public_headers",
67     ],
68     includes = [
69         "grpc/",
70         "include/",
71     ],
72 )
73
74 # Public flatc compiler.
75 cc_binary(
76     name = "flatc",
77     srcs = [
78         "grpc/src/compiler/config.h",
79         "grpc/src/compiler/cpp_generator.cc",
80         "grpc/src/compiler/cpp_generator.h",
81         "grpc/src/compiler/go_generator.cc",
82         "grpc/src/compiler/go_generator.h",
83         "grpc/src/compiler/python_generator.cc",
84         "grpc/src/compiler/python_generator.h",
85         "grpc/src/compiler/python_private_generator.h",
86         "grpc/src/compiler/java_generator.cc",
87         "grpc/src/compiler/java_generator.h",
88         "grpc/src/compiler/schema_interface.h",
89         "src/flatc_main.cpp",
90         "src/idl_gen_cpp.cpp",
91         "src/idl_gen_csharp.cpp",
92         "src/idl_gen_dart.cpp",
93         "src/idl_gen_go.cpp",
94         "src/idl_gen_grpc.cpp",
95         "src/idl_gen_java.cpp",
96         "src/idl_gen_js_ts.cpp",
97         "src/idl_gen_json_schema.cpp",
98         "src/idl_gen_kotlin.cpp",
99         "src/idl_gen_lobster.cpp",
100         "src/idl_gen_lua.cpp",
101         "src/idl_gen_php.cpp",
102         "src/idl_gen_python.cpp",
103         "src/idl_gen_rust.cpp",
104         "src/idl_gen_text.cpp",
105         "src/util.cpp",
106     ],
107     includes = [
108         "grpc/",
109         "include/",
110     ],
111     deps = [
112         ":flatc_library",
113     ],
114 )
115
116 cc_library(
117     name = "runtime_cc",
118     hdrs = [
119         "include/flatbuffers/base.h",
120         "include/flatbuffers/flatbuffers.h",
121         "include/flatbuffers/flexbuffers.h",
122         "include/flatbuffers/stl_emulation.h",
123         "include/flatbuffers/util.h",
124     ],
125     includes = ["include/"],
126     linkstatic = 1,
127 )
128
129 # Test binary.
130 cc_test(
131     name = "flatbuffers_test",
132     testonly = 1,
133     srcs = [
134         "include/flatbuffers/minireflect.h",
135         "include/flatbuffers/registry.h",
136         "src/code_generators.cpp",
137         "src/idl_gen_fbs.cpp",
138         "src/idl_gen_text.cpp",
139         "src/idl_parser.cpp",
140         "src/reflection.cpp",
141         "src/util.cpp",
142         "tests/evolution_test/evolution_v1_generated.h",
143         "tests/evolution_test/evolution_v2_generated.h",
144         "tests/namespace_test/namespace_test1_generated.h",
145         "tests/namespace_test/namespace_test2_generated.h",
146         "tests/native_type_test_impl.cpp",
147         "tests/native_type_test_impl.h",
148         "tests/test.cpp",
149         "tests/test_assert.cpp",
150         "tests/test_assert.h",
151         "tests/test_builder.cpp",
152         "tests/test_builder.h",
153         "tests/union_vector/union_vector_generated.h",
154         ":public_headers",
155     ],
156     copts = [
157         "-DFLATBUFFERS_TRACK_VERIFIER_BUFFER_SIZE",
158         "-DBAZEL_TEST_DATA_PATH",
159     ],
160     data = [
161         ":tests/arrays_test.bfbs",
162         ":tests/arrays_test.fbs",
163         ":tests/arrays_test.golden",
164         ":tests/evolution_test/evolution_v1.fbs",
165         ":tests/evolution_test/evolution_v1.json",
166         ":tests/evolution_test/evolution_v2.fbs",
167         ":tests/evolution_test/evolution_v2.json",
168         ":tests/include_test/include_test1.fbs",
169         ":tests/include_test/sub/include_test2.fbs",
170         ":tests/monster_extra.fbs",
171         ":tests/monster_test.bfbs",
172         ":tests/monster_test.fbs",
173         ":tests/monsterdata_extra.json",
174         ":tests/monsterdata_test.golden",
175         ":tests/monsterdata_test.json",
176         ":tests/native_type_test.fbs",
177         ":tests/prototest/imported.proto",
178         ":tests/prototest/test.golden",
179         ":tests/prototest/test.proto",
180         ":tests/prototest/test_union.golden",
181         ":tests/unicode_test.json",
182         ":tests/union_vector/union_vector.fbs",
183         ":tests/union_vector/union_vector.json",
184     ],
185     includes = [
186         "include/",
187         "tests/",
188     ],
189     deps = [
190         ":arrays_test_cc_fbs",
191         ":monster_extra_cc_fbs",
192         ":monster_test_cc_fbs",
193         ":native_type_test_cc_fbs",
194     ],
195 )
196
197 # Test bzl rules
198
199 flatbuffer_cc_library(
200     name = "monster_test_cc_fbs",
201     srcs = ["tests/monster_test.fbs"],
202     include_paths = ["tests/include_test"],
203     includes = [
204         "tests/include_test/include_test1.fbs",
205         "tests/include_test/sub/include_test2.fbs",
206     ],
207 )
208
209 flatbuffer_cc_library(
210     name = "monster_extra_cc_fbs",
211     srcs = ["tests/monster_extra.fbs"],
212 )
213
214 flatbuffer_cc_library(
215     name = "arrays_test_cc_fbs",
216     srcs = ["tests/arrays_test.fbs"],
217     flatc_args = [
218         "--gen-object-api",
219         "--gen-compare",
220         "--no-includes",
221         "--gen-mutable",
222         "--reflect-names",
223         "--cpp-ptr-type flatbuffers::unique_ptr",
224         "--scoped-enums",
225     ],
226 )
227
228 flatbuffer_cc_library(
229     name = "native_type_test_cc_fbs",
230     srcs = ["tests/native_type_test.fbs"],
231     flatc_args = [
232         "--gen-object-api",
233         "--gen-mutable",
234         "--cpp-ptr-type flatbuffers::unique_ptr",
235     ],
236 )