Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: third_party/protobuf/BUILD

Issue 1842653006: Update //third_party/protobuf to version 3. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/protobuf/.travis.yml ('k') | third_party/protobuf/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Bazel (http://bazel.io/) BUILD file for Protobuf.
2
3 licenses(["notice"])
4
5 ################################################################################
6 # Protobuf Runtime Library
7 ################################################################################
8
9 COPTS = [
10 "-DHAVE_PTHREAD",
11 "-Wall",
12 "-Wwrite-strings",
13 "-Woverloaded-virtual",
14 "-Wno-sign-compare",
15 "-Wno-error=unused-function",
16 ]
17
18 # Bazel should provide portable link_opts for pthread.
19 LINK_OPTS = ["-lpthread"]
20
21 load(
22 "protobuf",
23 "cc_proto_library",
24 "py_proto_library",
25 "internal_copied_filegroup",
26 "internal_protobuf_py_tests",
27 )
28
29 cc_library(
30 name = "protobuf_lite",
31 srcs = [
32 # AUTOGEN(protobuf_lite_srcs)
33 "src/google/protobuf/arena.cc",
34 "src/google/protobuf/arenastring.cc",
35 "src/google/protobuf/extension_set.cc",
36 "src/google/protobuf/generated_message_util.cc",
37 "src/google/protobuf/io/coded_stream.cc",
38 "src/google/protobuf/io/zero_copy_stream.cc",
39 "src/google/protobuf/io/zero_copy_stream_impl_lite.cc",
40 "src/google/protobuf/message_lite.cc",
41 "src/google/protobuf/repeated_field.cc",
42 "src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc",
43 "src/google/protobuf/stubs/atomicops_internals_x86_msvc.cc",
44 "src/google/protobuf/stubs/bytestream.cc",
45 "src/google/protobuf/stubs/common.cc",
46 "src/google/protobuf/stubs/int128.cc",
47 "src/google/protobuf/stubs/once.cc",
48 "src/google/protobuf/stubs/status.cc",
49 "src/google/protobuf/stubs/statusor.cc",
50 "src/google/protobuf/stubs/stringpiece.cc",
51 "src/google/protobuf/stubs/stringprintf.cc",
52 "src/google/protobuf/stubs/structurally_valid.cc",
53 "src/google/protobuf/stubs/strutil.cc",
54 "src/google/protobuf/stubs/time.cc",
55 "src/google/protobuf/wire_format_lite.cc",
56 ],
57 hdrs = glob(["src/google/protobuf/**/*.h"]),
58 copts = COPTS,
59 includes = ["src/"],
60 linkopts = LINK_OPTS,
61 visibility = ["//visibility:public"],
62 )
63
64 cc_library(
65 name = "protobuf",
66 srcs = [
67 # AUTOGEN(protobuf_srcs)
68 "src/google/protobuf/any.cc",
69 "src/google/protobuf/any.pb.cc",
70 "src/google/protobuf/api.pb.cc",
71 "src/google/protobuf/compiler/importer.cc",
72 "src/google/protobuf/compiler/parser.cc",
73 "src/google/protobuf/descriptor.cc",
74 "src/google/protobuf/descriptor.pb.cc",
75 "src/google/protobuf/descriptor_database.cc",
76 "src/google/protobuf/duration.pb.cc",
77 "src/google/protobuf/dynamic_message.cc",
78 "src/google/protobuf/empty.pb.cc",
79 "src/google/protobuf/extension_set_heavy.cc",
80 "src/google/protobuf/field_mask.pb.cc",
81 "src/google/protobuf/generated_message_reflection.cc",
82 "src/google/protobuf/io/gzip_stream.cc",
83 "src/google/protobuf/io/printer.cc",
84 "src/google/protobuf/io/strtod.cc",
85 "src/google/protobuf/io/tokenizer.cc",
86 "src/google/protobuf/io/zero_copy_stream_impl.cc",
87 "src/google/protobuf/map_field.cc",
88 "src/google/protobuf/message.cc",
89 "src/google/protobuf/reflection_ops.cc",
90 "src/google/protobuf/service.cc",
91 "src/google/protobuf/source_context.pb.cc",
92 "src/google/protobuf/struct.pb.cc",
93 "src/google/protobuf/stubs/mathlimits.cc",
94 "src/google/protobuf/stubs/substitute.cc",
95 "src/google/protobuf/text_format.cc",
96 "src/google/protobuf/timestamp.pb.cc",
97 "src/google/protobuf/type.pb.cc",
98 "src/google/protobuf/unknown_field_set.cc",
99 "src/google/protobuf/util/field_comparator.cc",
100 "src/google/protobuf/util/field_mask_util.cc",
101 "src/google/protobuf/util/internal/datapiece.cc",
102 "src/google/protobuf/util/internal/default_value_objectwriter.cc",
103 "src/google/protobuf/util/internal/error_listener.cc",
104 "src/google/protobuf/util/internal/field_mask_utility.cc",
105 "src/google/protobuf/util/internal/json_escaping.cc",
106 "src/google/protobuf/util/internal/json_objectwriter.cc",
107 "src/google/protobuf/util/internal/json_stream_parser.cc",
108 "src/google/protobuf/util/internal/object_writer.cc",
109 "src/google/protobuf/util/internal/proto_writer.cc",
110 "src/google/protobuf/util/internal/protostream_objectsource.cc",
111 "src/google/protobuf/util/internal/protostream_objectwriter.cc",
112 "src/google/protobuf/util/internal/type_info.cc",
113 "src/google/protobuf/util/internal/type_info_test_helper.cc",
114 "src/google/protobuf/util/internal/utility.cc",
115 "src/google/protobuf/util/json_util.cc",
116 "src/google/protobuf/util/message_differencer.cc",
117 "src/google/protobuf/util/time_util.cc",
118 "src/google/protobuf/util/type_resolver_util.cc",
119 "src/google/protobuf/wire_format.cc",
120 "src/google/protobuf/wrappers.pb.cc",
121 ],
122 hdrs = glob(["src/**/*.h"]),
123 copts = COPTS,
124 includes = ["src/"],
125 linkopts = LINK_OPTS,
126 visibility = ["//visibility:public"],
127 deps = [":protobuf_lite"],
128 )
129
130 objc_library(
131 name = "protobuf_objc",
132 hdrs = ["objectivec/GPBProtocolBuffers.h"],
133 includes = ["objectivec"],
134 non_arc_srcs = ["objectivec/GPBProtocolBuffers.m"],
135 visibility = ["//visibility:public"],
136 )
137
138 RELATIVE_WELL_KNOWN_PROTOS = [
139 # AUTOGEN(well_known_protos)
140 "google/protobuf/any.proto",
141 "google/protobuf/api.proto",
142 "google/protobuf/compiler/plugin.proto",
143 "google/protobuf/descriptor.proto",
144 "google/protobuf/duration.proto",
145 "google/protobuf/empty.proto",
146 "google/protobuf/field_mask.proto",
147 "google/protobuf/source_context.proto",
148 "google/protobuf/struct.proto",
149 "google/protobuf/timestamp.proto",
150 "google/protobuf/type.proto",
151 "google/protobuf/wrappers.proto",
152 ]
153
154 WELL_KNOWN_PROTOS = ["src/" + s for s in RELATIVE_WELL_KNOWN_PROTOS]
155
156 cc_proto_library(
157 name = "cc_wkt_protos",
158 srcs = WELL_KNOWN_PROTOS,
159 include = "src",
160 default_runtime = ":protobuf",
161 internal_bootstrap_hack = 1,
162 protoc = ":protoc",
163 visibility = ["//visibility:public"],
164 )
165
166 ################################################################################
167 # Protocol Buffers Compiler
168 ################################################################################
169
170 cc_library(
171 name = "protoc_lib",
172 srcs = [
173 # AUTOGEN(protoc_lib_srcs)
174 "src/google/protobuf/compiler/code_generator.cc",
175 "src/google/protobuf/compiler/command_line_interface.cc",
176 "src/google/protobuf/compiler/cpp/cpp_enum.cc",
177 "src/google/protobuf/compiler/cpp/cpp_enum_field.cc",
178 "src/google/protobuf/compiler/cpp/cpp_extension.cc",
179 "src/google/protobuf/compiler/cpp/cpp_field.cc",
180 "src/google/protobuf/compiler/cpp/cpp_file.cc",
181 "src/google/protobuf/compiler/cpp/cpp_generator.cc",
182 "src/google/protobuf/compiler/cpp/cpp_helpers.cc",
183 "src/google/protobuf/compiler/cpp/cpp_map_field.cc",
184 "src/google/protobuf/compiler/cpp/cpp_message.cc",
185 "src/google/protobuf/compiler/cpp/cpp_message_field.cc",
186 "src/google/protobuf/compiler/cpp/cpp_primitive_field.cc",
187 "src/google/protobuf/compiler/cpp/cpp_service.cc",
188 "src/google/protobuf/compiler/cpp/cpp_string_field.cc",
189 "src/google/protobuf/compiler/csharp/csharp_doc_comment.cc",
190 "src/google/protobuf/compiler/csharp/csharp_enum.cc",
191 "src/google/protobuf/compiler/csharp/csharp_enum_field.cc",
192 "src/google/protobuf/compiler/csharp/csharp_field_base.cc",
193 "src/google/protobuf/compiler/csharp/csharp_generator.cc",
194 "src/google/protobuf/compiler/csharp/csharp_helpers.cc",
195 "src/google/protobuf/compiler/csharp/csharp_map_field.cc",
196 "src/google/protobuf/compiler/csharp/csharp_message.cc",
197 "src/google/protobuf/compiler/csharp/csharp_message_field.cc",
198 "src/google/protobuf/compiler/csharp/csharp_primitive_field.cc",
199 "src/google/protobuf/compiler/csharp/csharp_reflection_class.cc",
200 "src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc",
201 "src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc",
202 "src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc" ,
203 "src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc",
204 "src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc",
205 "src/google/protobuf/compiler/java/java_context.cc",
206 "src/google/protobuf/compiler/java/java_doc_comment.cc",
207 "src/google/protobuf/compiler/java/java_enum.cc",
208 "src/google/protobuf/compiler/java/java_enum_field.cc",
209 "src/google/protobuf/compiler/java/java_enum_field_lite.cc",
210 "src/google/protobuf/compiler/java/java_enum_lite.cc",
211 "src/google/protobuf/compiler/java/java_extension.cc",
212 "src/google/protobuf/compiler/java/java_field.cc",
213 "src/google/protobuf/compiler/java/java_file.cc",
214 "src/google/protobuf/compiler/java/java_generator.cc",
215 "src/google/protobuf/compiler/java/java_generator_factory.cc",
216 "src/google/protobuf/compiler/java/java_helpers.cc",
217 "src/google/protobuf/compiler/java/java_lazy_message_field.cc",
218 "src/google/protobuf/compiler/java/java_lazy_message_field_lite.cc",
219 "src/google/protobuf/compiler/java/java_map_field.cc",
220 "src/google/protobuf/compiler/java/java_map_field_lite.cc",
221 "src/google/protobuf/compiler/java/java_message.cc",
222 "src/google/protobuf/compiler/java/java_message_builder.cc",
223 "src/google/protobuf/compiler/java/java_message_builder_lite.cc",
224 "src/google/protobuf/compiler/java/java_message_field.cc",
225 "src/google/protobuf/compiler/java/java_message_field_lite.cc",
226 "src/google/protobuf/compiler/java/java_message_lite.cc",
227 "src/google/protobuf/compiler/java/java_name_resolver.cc",
228 "src/google/protobuf/compiler/java/java_primitive_field.cc",
229 "src/google/protobuf/compiler/java/java_primitive_field_lite.cc",
230 "src/google/protobuf/compiler/java/java_service.cc",
231 "src/google/protobuf/compiler/java/java_shared_code_generator.cc",
232 "src/google/protobuf/compiler/java/java_string_field.cc",
233 "src/google/protobuf/compiler/java/java_string_field_lite.cc",
234 "src/google/protobuf/compiler/javanano/javanano_enum.cc",
235 "src/google/protobuf/compiler/javanano/javanano_enum_field.cc",
236 "src/google/protobuf/compiler/javanano/javanano_extension.cc",
237 "src/google/protobuf/compiler/javanano/javanano_field.cc",
238 "src/google/protobuf/compiler/javanano/javanano_file.cc",
239 "src/google/protobuf/compiler/javanano/javanano_generator.cc",
240 "src/google/protobuf/compiler/javanano/javanano_helpers.cc",
241 "src/google/protobuf/compiler/javanano/javanano_map_field.cc",
242 "src/google/protobuf/compiler/javanano/javanano_message.cc",
243 "src/google/protobuf/compiler/javanano/javanano_message_field.cc",
244 "src/google/protobuf/compiler/javanano/javanano_primitive_field.cc",
245 "src/google/protobuf/compiler/js/js_generator.cc",
246 "src/google/protobuf/compiler/objectivec/objectivec_enum.cc",
247 "src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc",
248 "src/google/protobuf/compiler/objectivec/objectivec_extension.cc",
249 "src/google/protobuf/compiler/objectivec/objectivec_field.cc",
250 "src/google/protobuf/compiler/objectivec/objectivec_file.cc",
251 "src/google/protobuf/compiler/objectivec/objectivec_generator.cc",
252 "src/google/protobuf/compiler/objectivec/objectivec_helpers.cc",
253 "src/google/protobuf/compiler/objectivec/objectivec_map_field.cc",
254 "src/google/protobuf/compiler/objectivec/objectivec_message.cc",
255 "src/google/protobuf/compiler/objectivec/objectivec_message_field.cc",
256 "src/google/protobuf/compiler/objectivec/objectivec_oneof.cc",
257 "src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc",
258 "src/google/protobuf/compiler/plugin.cc",
259 "src/google/protobuf/compiler/plugin.pb.cc",
260 "src/google/protobuf/compiler/python/python_generator.cc",
261 "src/google/protobuf/compiler/ruby/ruby_generator.cc",
262 "src/google/protobuf/compiler/subprocess.cc",
263 "src/google/protobuf/compiler/zip_writer.cc",
264 ],
265 copts = COPTS,
266 includes = ["src/"],
267 linkopts = LINK_OPTS,
268 visibility = ["//visibility:public"],
269 deps = [":protobuf"],
270 )
271
272 cc_binary(
273 name = "protoc",
274 srcs = ["src/google/protobuf/compiler/main.cc"],
275 linkopts = LINK_OPTS,
276 visibility = ["//visibility:public"],
277 deps = [":protoc_lib"],
278 )
279
280 ################################################################################
281 # Tests
282 ################################################################################
283
284 RELATIVE_LITE_TEST_PROTOS = [
285 # AUTOGEN(lite_test_protos)
286 "google/protobuf/map_lite_unittest.proto",
287 "google/protobuf/unittest_import_lite.proto",
288 "google/protobuf/unittest_import_public_lite.proto",
289 "google/protobuf/unittest_lite.proto",
290 "google/protobuf/unittest_no_arena_lite.proto",
291 ]
292
293 LITE_TEST_PROTOS = ["src/" + s for s in RELATIVE_LITE_TEST_PROTOS]
294
295 RELATIVE_TEST_PROTOS = [
296 # AUTOGEN(test_protos)
297 "google/protobuf/any_test.proto",
298 "google/protobuf/compiler/cpp/cpp_test_bad_identifiers.proto",
299 "google/protobuf/compiler/cpp/cpp_test_large_enum_value.proto",
300 "google/protobuf/map_proto2_unittest.proto",
301 "google/protobuf/map_unittest.proto",
302 "google/protobuf/unittest.proto",
303 "google/protobuf/unittest_arena.proto",
304 "google/protobuf/unittest_custom_options.proto",
305 "google/protobuf/unittest_drop_unknown_fields.proto",
306 "google/protobuf/unittest_embed_optimize_for.proto",
307 "google/protobuf/unittest_empty.proto",
308 "google/protobuf/unittest_enormous_descriptor.proto",
309 "google/protobuf/unittest_import.proto",
310 "google/protobuf/unittest_import_public.proto",
311 "google/protobuf/unittest_lite_imports_nonlite.proto",
312 "google/protobuf/unittest_mset.proto",
313 "google/protobuf/unittest_mset_wire_format.proto",
314 "google/protobuf/unittest_no_arena.proto",
315 "google/protobuf/unittest_no_arena_import.proto",
316 "google/protobuf/unittest_no_field_presence.proto",
317 "google/protobuf/unittest_no_generic_services.proto",
318 "google/protobuf/unittest_optimize_for.proto",
319 "google/protobuf/unittest_preserve_unknown_enum.proto",
320 "google/protobuf/unittest_preserve_unknown_enum2.proto",
321 "google/protobuf/unittest_proto3_arena.proto",
322 "google/protobuf/unittest_well_known_types.proto",
323 "google/protobuf/util/internal/testdata/anys.proto",
324 "google/protobuf/util/internal/testdata/books.proto",
325 "google/protobuf/util/internal/testdata/default_value.proto",
326 "google/protobuf/util/internal/testdata/default_value_test.proto",
327 "google/protobuf/util/internal/testdata/field_mask.proto",
328 "google/protobuf/util/internal/testdata/maps.proto",
329 "google/protobuf/util/internal/testdata/oneofs.proto",
330 "google/protobuf/util/internal/testdata/struct.proto",
331 "google/protobuf/util/internal/testdata/timestamp_duration.proto",
332 "google/protobuf/util/json_format_proto3.proto",
333 "google/protobuf/util/message_differencer_unittest.proto",
334 ]
335
336 TEST_PROTOS = ["src/" + s for s in RELATIVE_TEST_PROTOS]
337
338 cc_proto_library(
339 name = "cc_test_protos",
340 srcs = LITE_TEST_PROTOS + TEST_PROTOS,
341 include = "src",
342 default_runtime = ":protobuf",
343 protoc = ":protoc",
344 deps = [":cc_wkt_protos"],
345 )
346
347 COMMON_TEST_SRCS = [
348 # AUTOGEN(common_test_srcs)
349 "src/google/protobuf/arena_test_util.cc",
350 "src/google/protobuf/map_test_util.cc",
351 "src/google/protobuf/test_util.cc",
352 "src/google/protobuf/testing/file.cc",
353 "src/google/protobuf/testing/googletest.cc",
354 ]
355
356 cc_binary(
357 name = "test_plugin",
358 srcs = [
359 # AUTOGEN(test_plugin_srcs)
360 "src/google/protobuf/compiler/mock_code_generator.cc",
361 "src/google/protobuf/compiler/test_plugin.cc",
362 "src/google/protobuf/testing/file.cc",
363 ],
364 deps = [
365 ":protobuf",
366 ":protoc_lib",
367 "//external:gtest",
368 ],
369 )
370
371 cc_test(
372 name = "protobuf_test",
373 srcs = COMMON_TEST_SRCS + [
374 # AUTOGEN(test_srcs)
375 "src/google/protobuf/any_test.cc",
376 "src/google/protobuf/arena_unittest.cc",
377 "src/google/protobuf/arenastring_unittest.cc",
378 "src/google/protobuf/compiler/command_line_interface_unittest.cc",
379 "src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc",
380 "src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc",
381 "src/google/protobuf/compiler/cpp/cpp_unittest.cc",
382 "src/google/protobuf/compiler/csharp/csharp_generator_unittest.cc",
383 "src/google/protobuf/compiler/importer_unittest.cc",
384 "src/google/protobuf/compiler/java/java_doc_comment_unittest.cc",
385 "src/google/protobuf/compiler/java/java_plugin_unittest.cc",
386 "src/google/protobuf/compiler/mock_code_generator.cc",
387 "src/google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc" ,
388 "src/google/protobuf/compiler/parser_unittest.cc",
389 "src/google/protobuf/compiler/python/python_plugin_unittest.cc",
390 "src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc",
391 "src/google/protobuf/descriptor_database_unittest.cc",
392 "src/google/protobuf/descriptor_unittest.cc",
393 "src/google/protobuf/drop_unknown_fields_test.cc",
394 "src/google/protobuf/dynamic_message_unittest.cc",
395 "src/google/protobuf/extension_set_unittest.cc",
396 "src/google/protobuf/generated_message_reflection_unittest.cc",
397 "src/google/protobuf/io/coded_stream_unittest.cc",
398 "src/google/protobuf/io/printer_unittest.cc",
399 "src/google/protobuf/io/tokenizer_unittest.cc",
400 "src/google/protobuf/io/zero_copy_stream_unittest.cc",
401 "src/google/protobuf/map_field_test.cc",
402 "src/google/protobuf/map_test.cc",
403 "src/google/protobuf/message_unittest.cc",
404 "src/google/protobuf/no_field_presence_test.cc",
405 "src/google/protobuf/preserve_unknown_enum_test.cc",
406 "src/google/protobuf/proto3_arena_unittest.cc",
407 "src/google/protobuf/reflection_ops_unittest.cc",
408 "src/google/protobuf/repeated_field_reflection_unittest.cc",
409 "src/google/protobuf/repeated_field_unittest.cc",
410 "src/google/protobuf/stubs/bytestream_unittest.cc",
411 "src/google/protobuf/stubs/common_unittest.cc",
412 "src/google/protobuf/stubs/int128_unittest.cc",
413 "src/google/protobuf/stubs/once_unittest.cc",
414 "src/google/protobuf/stubs/status_test.cc",
415 "src/google/protobuf/stubs/statusor_test.cc",
416 "src/google/protobuf/stubs/stringpiece_unittest.cc",
417 "src/google/protobuf/stubs/stringprintf_unittest.cc",
418 "src/google/protobuf/stubs/structurally_valid_unittest.cc",
419 "src/google/protobuf/stubs/strutil_unittest.cc",
420 "src/google/protobuf/stubs/template_util_unittest.cc",
421 "src/google/protobuf/stubs/time_test.cc",
422 "src/google/protobuf/stubs/type_traits_unittest.cc",
423 "src/google/protobuf/text_format_unittest.cc",
424 "src/google/protobuf/unknown_field_set_unittest.cc",
425 "src/google/protobuf/util/field_comparator_test.cc",
426 "src/google/protobuf/util/field_mask_util_test.cc",
427 "src/google/protobuf/util/internal/default_value_objectwriter_test.cc",
428 "src/google/protobuf/util/internal/json_objectwriter_test.cc",
429 "src/google/protobuf/util/internal/json_stream_parser_test.cc",
430 "src/google/protobuf/util/internal/protostream_objectsource_test.cc",
431 "src/google/protobuf/util/internal/protostream_objectwriter_test.cc",
432 "src/google/protobuf/util/internal/type_info_test_helper.cc",
433 "src/google/protobuf/util/json_util_test.cc",
434 "src/google/protobuf/util/message_differencer_unittest.cc",
435 "src/google/protobuf/util/time_util_test.cc",
436 "src/google/protobuf/util/type_resolver_util_test.cc",
437 "src/google/protobuf/well_known_types_unittest.cc",
438 "src/google/protobuf/wire_format_unittest.cc",
439 ],
440 copts = COPTS,
441 data = [
442 ":test_plugin",
443 ] + glob([
444 "src/google/protobuf/**/*",
445 ]),
446 includes = [
447 "src/",
448 ],
449 linkopts = LINK_OPTS,
450 deps = [
451 ":cc_test_protos",
452 ":protobuf",
453 ":protoc_lib",
454 "//external:gtest_main",
455 ],
456 )
457
458 ################################################################################
459 # Java support
460 ################################################################################
461 genrule(
462 name = "generate_java_descriptor_proto",
463 srcs = ["src/google/protobuf/descriptor.proto"],
464 outs = ["com/google/protobuf/DescriptorProtos.java"],
465 cmd = "$(location :protoc) --java_out=$(@D)/../../.. $<",
466 tools = [":protoc"],
467 )
468
469 java_library(
470 name = "protobuf_java",
471 srcs = glob([
472 "java/src/main/java/com/google/protobuf/*.java",
473 ]) + [
474 ":generate_java_descriptor_proto",
475 ],
476 visibility = ["//visibility:public"],
477 )
478
479 ################################################################################
480 # Python support
481 ################################################################################
482
483 # Hack:
484 # protoc generated files contain imports like:
485 # "from google.protobuf.xxx import yyy"
486 # However, the sources files of the python runtime are not directly under
487 # "google/protobuf" (they are under python/google/protobuf). We workaround
488 # this by copying runtime source files into the desired location to workaround
489 # the import issue. Ideally py_library should support something similiar to the
490 # "include" attribute in cc_library to inject the PYTHON_PATH for all libraries
491 # that depend on the target.
492 #
493 # If you use python protobuf as a third_party library in your bazel managed
494 # project:
495 # 1) Please import the whole package to //google/protobuf in your
496 # project. Otherwise, bazel disallows generated files out of the current
497 # package, thus we won't be able to copy protobuf runtime files into
498 # //google/protobuf/.
499 # 2) The runtime also requires "six" for Python2/3 compatibility, please see the
500 # WORKSPACE file and bind "six" to your workspace as well.
501 internal_copied_filegroup(
502 name = "python_srcs",
503 srcs = glob(
504 [
505 "python/google/protobuf/*.py",
506 "python/google/protobuf/**/*.py",
507 ],
508 exclude = [
509 "python/google/protobuf/internal/*_test.py",
510 "python/google/protobuf/internal/test_util.py",
511 ],
512 ),
513 include = "python",
514 )
515
516 cc_binary(
517 name = "internal/_api_implementation.so",
518 srcs = ["python/google/protobuf/internal/api_implementation.cc"],
519 copts = COPTS + [
520 "-DPYTHON_PROTO2_CPP_IMPL_V2",
521 ],
522 linkshared = 1,
523 linkstatic = 1,
524 deps = select({
525 "//conditions:default": [],
526 ":use_fast_cpp_protos": ["//util/python:python_headers"],
527 }),
528 )
529
530 cc_binary(
531 name = "pyext/_message.so",
532 srcs = glob([
533 "python/google/protobuf/pyext/*.cc",
534 "python/google/protobuf/pyext/*.h",
535 ]),
536 copts = COPTS + [
537 "-DGOOGLE_PROTOBUF_HAS_ONEOF=1",
538 ],
539 includes = [
540 "python/",
541 "src/",
542 ],
543 linkshared = 1,
544 linkstatic = 1,
545 deps = [
546 ":protobuf",
547 ] + select({
548 "//conditions:default": [],
549 ":use_fast_cpp_protos": ["//util/python:python_headers"],
550 }),
551 )
552
553 config_setting(
554 name = "use_fast_cpp_protos",
555 values = {
556 "define": "use_fast_cpp_protos=true",
557 },
558 )
559
560 py_proto_library(
561 name = "protobuf_python",
562 srcs = WELL_KNOWN_PROTOS,
563 include = "src",
564 data = select({
565 "//conditions:default": [],
566 ":use_fast_cpp_protos": [
567 ":internal/_api_implementation.so",
568 ":pyext/_message.so",
569 ],
570 }),
571 default_runtime = "",
572 protoc = ":protoc",
573 py_extra_srcs = [":python_srcs"],
574 py_libs = ["//external:six"],
575 srcs_version = "PY2AND3",
576 visibility = ["//visibility:public"],
577 )
578
579 internal_copied_filegroup(
580 name = "python_test_srcs",
581 srcs = glob(
582 [
583 "python/google/protobuf/internal/*_test.py",
584 "python/google/protobuf/internal/test_util.py",
585 ],
586 ),
587 include = "python",
588 )
589
590 py_proto_library(
591 name = "python_common_test_protos",
592 srcs = LITE_TEST_PROTOS + TEST_PROTOS,
593 include = "src",
594 default_runtime = "",
595 protoc = ":protoc",
596 deps = [":protobuf_python"],
597 )
598
599 py_proto_library(
600 name = "python_specific_test_protos",
601 srcs = glob([
602 "python/google/protobuf/internal/*.proto",
603 "python/google/protobuf/internal/import_test_package/*.proto",
604 ]),
605 include = "python",
606 default_runtime = ":protobuf_python",
607 protoc = ":protoc",
608 deps = [":python_common_test_protos"],
609 )
610
611 py_library(
612 name = "python_tests",
613 srcs = [":python_test_srcs"],
614 srcs_version = "PY2AND3",
615 deps = [
616 ":protobuf_python",
617 ":python_common_test_protos",
618 ":python_specific_test_protos",
619 ],
620 )
621
622 internal_protobuf_py_tests(
623 name = "python_tests_batch",
624 data = glob([
625 "src/google/protobuf/**/*",
626 ]),
627 modules = [
628 "descriptor_database_test",
629 "descriptor_pool_test",
630 "descriptor_test",
631 "generator_test",
632 "json_format_test",
633 "message_factory_test",
634 "message_test",
635 "proto_builder_test",
636 "reflection_test",
637 "service_reflection_test",
638 "symbol_database_test",
639 "text_encoding_test",
640 "text_format_test",
641 "unknown_fields_test",
642 "wire_format_test",
643 ],
644 deps = [":python_tests"],
645 )
OLDNEW
« no previous file with comments | « third_party/protobuf/.travis.yml ('k') | third_party/protobuf/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698