blob: 50f854b67b284baaa7ac18437e9cc12611771d0f [file] [log] [blame]
Jisi Liud19604f2015-06-17 17:37:58 -07001# Bazel (http://bazel.io/) BUILD file for Protobuf.
2
3licenses(["notice"])
4
Piotr Sikorafaea19c2016-08-04 15:32:14 -07005exports_files(["LICENSE"])
6
Jorge Canizalesd5d7bb32015-06-28 15:23:02 -07007################################################################################
8# Protobuf Runtime Library
9################################################################################
10
Yun Peng0b059a32017-05-31 14:01:23 +020011WIN_COPTS = [
12 "/DHAVE_PTHREAD",
13 "/wd4018", # -Wno-sign-compare
14 "/wd4514", # -Wno-unused-function
Jisi Liud19604f2015-06-17 17:37:58 -070015]
16
Yun Peng0b059a32017-05-31 14:01:23 +020017COPTS = select({
18 ":windows" : WIN_COPTS,
19 ":windows_msvc" : WIN_COPTS,
20 "//conditions:default": [
21 "-DHAVE_PTHREAD",
22 "-Wall",
23 "-Wwrite-strings",
24 "-Woverloaded-virtual",
25 "-Wno-sign-compare",
26 "-Wno-unused-function",
27 ],
28})
29
30config_setting(
31 name = "windows",
32 values = { "cpu": "x64_windows" },
33)
34
35config_setting(
36 name = "windows_msvc",
37 values = { "cpu": "x64_windows_msvc" },
38)
39
Andrew Harpb56b4612016-04-04 15:13:30 -040040config_setting(
41 name = "android",
42 values = {
43 "crosstool_top": "//external:android/crosstool",
44 },
45)
46
Seth Greenstein68ee9162017-10-10 11:08:27 -070047# Android and Windows builds do not need to link in a separate pthread library.
Andrew Harpb56b4612016-04-04 15:13:30 -040048LINK_OPTS = select({
Andrew Harp3b4e7dc2016-04-04 16:13:31 -040049 ":android": [],
Seth Greenstein68ee9162017-10-10 11:08:27 -070050 ":windows": [],
51 ":windows_msvc": [],
Daniel Ylitalo32fa55e2017-01-25 22:04:11 +010052 "//conditions:default": ["-lpthread", "-lm"],
Andrew Harpb56b4612016-04-04 15:13:30 -040053})
Jisi Liud19604f2015-06-17 17:37:58 -070054
Jisi Liu04658a32015-10-20 15:00:13 -070055load(
cgrushko65a4d202017-02-08 15:23:57 -050056 ":protobuf.bzl",
Jisi Liu04658a32015-10-20 15:00:13 -070057 "cc_proto_library",
58 "py_proto_library",
David Z. Chen02cd45c2016-05-20 16:49:04 -070059 "internal_copied_filegroup",
Steven Parkesea188662016-02-25 07:53:19 -080060 "internal_gen_well_known_protos_java",
Jisi Liu04658a32015-10-20 15:00:13 -070061 "internal_protobuf_py_tests",
62)
Jisi Liu39362b32015-10-14 17:12:11 -070063
Jisi Liud19604f2015-06-17 17:37:58 -070064cc_library(
65 name = "protobuf_lite",
66 srcs = [
67 # AUTOGEN(protobuf_lite_srcs)
68 "src/google/protobuf/arena.cc",
69 "src/google/protobuf/arenastring.cc",
70 "src/google/protobuf/extension_set.cc",
Jisi Liu12c186f2017-07-25 14:38:00 -070071 "src/google/protobuf/generated_message_table_driven_lite.cc",
Jisi Liud19604f2015-06-17 17:37:58 -070072 "src/google/protobuf/generated_message_util.cc",
73 "src/google/protobuf/io/coded_stream.cc",
74 "src/google/protobuf/io/zero_copy_stream.cc",
75 "src/google/protobuf/io/zero_copy_stream_impl_lite.cc",
76 "src/google/protobuf/message_lite.cc",
77 "src/google/protobuf/repeated_field.cc",
78 "src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc",
79 "src/google/protobuf/stubs/atomicops_internals_x86_msvc.cc",
Jisi Liuaf3eafd2015-06-18 13:38:36 -070080 "src/google/protobuf/stubs/bytestream.cc",
Jisi Liud19604f2015-06-17 17:37:58 -070081 "src/google/protobuf/stubs/common.cc",
Jisi Liub90f9f82015-08-25 17:06:33 -070082 "src/google/protobuf/stubs/int128.cc",
Jisi Liu759245a2017-07-25 11:52:33 -070083 "src/google/protobuf/stubs/io_win32.cc",
Jisi Liud19604f2015-06-17 17:37:58 -070084 "src/google/protobuf/stubs/once.cc",
Jisi Liuaf3eafd2015-06-18 13:38:36 -070085 "src/google/protobuf/stubs/status.cc",
86 "src/google/protobuf/stubs/statusor.cc",
87 "src/google/protobuf/stubs/stringpiece.cc",
Jisi Liud19604f2015-06-17 17:37:58 -070088 "src/google/protobuf/stubs/stringprintf.cc",
Jisi Liub90f9f82015-08-25 17:06:33 -070089 "src/google/protobuf/stubs/structurally_valid.cc",
Jisi Liuaf3eafd2015-06-18 13:38:36 -070090 "src/google/protobuf/stubs/strutil.cc",
91 "src/google/protobuf/stubs/time.cc",
Jisi Liud19604f2015-06-17 17:37:58 -070092 "src/google/protobuf/wire_format_lite.cc",
93 ],
Manjunath Kudlur3ff1dca2015-12-07 13:08:21 -080094 hdrs = glob(["src/google/protobuf/**/*.h"]),
Param Reddy16792c62017-10-15 13:06:58 -070095 copts = COPTS,
Jisi Liud19604f2015-06-17 17:37:58 -070096 includes = ["src/"],
97 linkopts = LINK_OPTS,
98 visibility = ["//visibility:public"],
99)
100
101cc_library(
102 name = "protobuf",
103 srcs = [
104 # AUTOGEN(protobuf_srcs)
105 "src/google/protobuf/any.cc",
106 "src/google/protobuf/any.pb.cc",
107 "src/google/protobuf/api.pb.cc",
108 "src/google/protobuf/compiler/importer.cc",
109 "src/google/protobuf/compiler/parser.cc",
110 "src/google/protobuf/descriptor.cc",
111 "src/google/protobuf/descriptor.pb.cc",
112 "src/google/protobuf/descriptor_database.cc",
113 "src/google/protobuf/duration.pb.cc",
114 "src/google/protobuf/dynamic_message.cc",
115 "src/google/protobuf/empty.pb.cc",
116 "src/google/protobuf/extension_set_heavy.cc",
117 "src/google/protobuf/field_mask.pb.cc",
118 "src/google/protobuf/generated_message_reflection.cc",
Jisi Liu759245a2017-07-25 11:52:33 -0700119 "src/google/protobuf/generated_message_table_driven.cc",
Jisi Liud19604f2015-06-17 17:37:58 -0700120 "src/google/protobuf/io/gzip_stream.cc",
121 "src/google/protobuf/io/printer.cc",
122 "src/google/protobuf/io/strtod.cc",
123 "src/google/protobuf/io/tokenizer.cc",
124 "src/google/protobuf/io/zero_copy_stream_impl.cc",
125 "src/google/protobuf/map_field.cc",
126 "src/google/protobuf/message.cc",
127 "src/google/protobuf/reflection_ops.cc",
128 "src/google/protobuf/service.cc",
129 "src/google/protobuf/source_context.pb.cc",
130 "src/google/protobuf/struct.pb.cc",
Jisi Liuaf3eafd2015-06-18 13:38:36 -0700131 "src/google/protobuf/stubs/mathlimits.cc",
Jisi Liud19604f2015-06-17 17:37:58 -0700132 "src/google/protobuf/stubs/substitute.cc",
133 "src/google/protobuf/text_format.cc",
134 "src/google/protobuf/timestamp.pb.cc",
135 "src/google/protobuf/type.pb.cc",
136 "src/google/protobuf/unknown_field_set.cc",
Bairen Yi312e2db2017-03-21 03:52:37 +0800137 "src/google/protobuf/util/delimited_message_util.cc",
Jisi Liuaf3eafd2015-06-18 13:38:36 -0700138 "src/google/protobuf/util/field_comparator.cc",
Jisi Liub90f9f82015-08-25 17:06:33 -0700139 "src/google/protobuf/util/field_mask_util.cc",
Jisi Liuaf3eafd2015-06-18 13:38:36 -0700140 "src/google/protobuf/util/internal/datapiece.cc",
141 "src/google/protobuf/util/internal/default_value_objectwriter.cc",
142 "src/google/protobuf/util/internal/error_listener.cc",
143 "src/google/protobuf/util/internal/field_mask_utility.cc",
144 "src/google/protobuf/util/internal/json_escaping.cc",
145 "src/google/protobuf/util/internal/json_objectwriter.cc",
146 "src/google/protobuf/util/internal/json_stream_parser.cc",
147 "src/google/protobuf/util/internal/object_writer.cc",
Feng Xiaoef6c72b2015-12-28 17:33:55 -0800148 "src/google/protobuf/util/internal/proto_writer.cc",
Jisi Liuaf3eafd2015-06-18 13:38:36 -0700149 "src/google/protobuf/util/internal/protostream_objectsource.cc",
150 "src/google/protobuf/util/internal/protostream_objectwriter.cc",
151 "src/google/protobuf/util/internal/type_info.cc",
152 "src/google/protobuf/util/internal/type_info_test_helper.cc",
153 "src/google/protobuf/util/internal/utility.cc",
154 "src/google/protobuf/util/json_util.cc",
155 "src/google/protobuf/util/message_differencer.cc",
Jisi Liub90f9f82015-08-25 17:06:33 -0700156 "src/google/protobuf/util/time_util.cc",
Jisi Liuaf3eafd2015-06-18 13:38:36 -0700157 "src/google/protobuf/util/type_resolver_util.cc",
Jisi Liud19604f2015-06-17 17:37:58 -0700158 "src/google/protobuf/wire_format.cc",
159 "src/google/protobuf/wrappers.pb.cc",
160 ],
Lukacs T. Berki915d9cd2015-11-16 09:36:32 +0100161 hdrs = glob(["src/**/*.h"]),
Param Reddy16792c62017-10-15 13:06:58 -0700162 copts = COPTS,
Jisi Liud19604f2015-06-17 17:37:58 -0700163 includes = ["src/"],
164 linkopts = LINK_OPTS,
165 visibility = ["//visibility:public"],
166 deps = [":protobuf_lite"],
167)
168
Manjunath Kudlur6837b2d2017-03-02 18:02:05 -0800169# This provides just the header files for use in projects that need to build
170# shared libraries for dynamic loading. This target is available until Bazel
171# adds native support for such use cases.
172# TODO(keveman): Remove this target once the support gets added to Bazel.
Manjunath Kudlur2d430f82017-02-23 08:17:24 -0800173cc_library(
174 name = "protobuf_headers",
175 hdrs = glob(["src/**/*.h"]),
176 includes = ["src/"],
177 visibility = ["//visibility:public"],
178)
179
Jisi Liu14c8f8a2015-10-20 15:36:22 -0700180objc_library(
181 name = "protobuf_objc",
182 hdrs = ["objectivec/GPBProtocolBuffers.h"],
183 includes = ["objectivec"],
184 non_arc_srcs = ["objectivec/GPBProtocolBuffers.m"],
185 visibility = ["//visibility:public"],
186)
Jorge Canizalesd5d7bb32015-06-28 15:23:02 -0700187
Jakob Buchgraber699c0eb2017-09-05 17:15:10 +0200188# Map of all well known protos.
189# name => (include path, imports)
190WELL_KNOWN_PROTO_MAP = {
191 "any" : ("google/protobuf/any.proto", []),
192 "api" : ("google/protobuf/api.proto", ["source_context", "type"]),
193 "compiler_plugin" : ("google/protobuf/compiler/plugin.proto", ["descriptor"]),
194 "descriptor" : ("google/protobuf/descriptor.proto", []),
195 "duration" : ("google/protobuf/duration.proto", []),
196 "empty" : ("google/protobuf/empty.proto", []),
197 "field_mask" : ("google/protobuf/field_mask.proto", []),
198 "source_context" : ("google/protobuf/source_context.proto", []),
199 "struct" : ("google/protobuf/struct.proto", []),
200 "timestamp" : ("google/protobuf/timestamp.proto", []),
201 "type" : ("google/protobuf/type.proto", ["any", "source_context"]),
202 "wrappers" : ("google/protobuf/wrappers.proto", []),
203}
204
205RELATIVE_WELL_KNOWN_PROTOS = [proto[1][0] for proto in WELL_KNOWN_PROTO_MAP.items()]
Jorge Canizalesd5d7bb32015-06-28 15:23:02 -0700206
Jisi Liu993fb702015-10-19 17:19:49 -0700207WELL_KNOWN_PROTOS = ["src/" + s for s in RELATIVE_WELL_KNOWN_PROTOS]
208
Steven Parkesd5a57322016-03-22 17:56:07 -0700209filegroup(
210 name = "well_known_protos",
211 srcs = WELL_KNOWN_PROTOS,
212 visibility = ["//visibility:public"],
213)
214
Jisi Liu39362b32015-10-14 17:12:11 -0700215cc_proto_library(
216 name = "cc_wkt_protos",
Jisi Liu993fb702015-10-19 17:19:49 -0700217 srcs = WELL_KNOWN_PROTOS,
Jisi Liu3101e732015-10-16 12:46:26 -0700218 include = "src",
Manjunath Kudlur3ff1dca2015-12-07 13:08:21 -0800219 default_runtime = ":protobuf",
Jisi Liu993fb702015-10-19 17:19:49 -0700220 internal_bootstrap_hack = 1,
Jisi Liu04658a32015-10-20 15:00:13 -0700221 protoc = ":protoc",
Jisi Liu6a40bf82015-11-17 12:36:21 -0800222 visibility = ["//visibility:public"],
Jisi Liu39362b32015-10-14 17:12:11 -0700223)
224
Jorge Canizalesd5d7bb32015-06-28 15:23:02 -0700225################################################################################
Jakob Buchgraber699c0eb2017-09-05 17:15:10 +0200226# Well Known Types Proto Library Rules
227#
228# These proto_library rules can be used with one of the language specific proto
229# library rules i.e. java_proto_library:
230#
231# java_proto_library(
232# name = "any_java_proto",
233# deps = ["@com_google_protobuf//:any_proto],
234# )
235################################################################################
236
237internal_copied_filegroup(
238 name = "_internal_wkt_protos",
239 srcs = WELL_KNOWN_PROTOS,
240 dest = "",
241 strip_prefix = "src",
242 visibility = ["//visibility:hidden"],
243)
244
245[proto_library(
246 name = proto[0] + "_proto",
247 srcs = [proto[1][0]],
248 deps = [dep + "_proto" for dep in proto[1][1]],
249 visibility = ["//visibility:public"],
250 ) for proto in WELL_KNOWN_PROTO_MAP.items()]
251
252################################################################################
Jorge Canizalesd5d7bb32015-06-28 15:23:02 -0700253# Protocol Buffers Compiler
254################################################################################
255
Adam Cozzetted1e7bd92016-12-20 09:08:19 -0800256cc_binary(
257 name = "js_embed",
258 srcs = ["src/google/protobuf/compiler/js/embed.cc"],
259 visibility = ["//visibility:public"],
260)
261
262genrule(
263 name = "generate_js_well_known_types_embed",
264 srcs = [
265 "src/google/protobuf/compiler/js/well_known_types/any.js",
266 "src/google/protobuf/compiler/js/well_known_types/struct.js",
267 "src/google/protobuf/compiler/js/well_known_types/timestamp.js",
268 ],
269 outs = ["src/google/protobuf/compiler/js/well_known_types_embed.cc"],
270 cmd = "$(location :js_embed) $(SRCS) > $@",
271 tools = [":js_embed"],
272)
273
Jisi Liud19604f2015-06-17 17:37:58 -0700274cc_library(
275 name = "protoc_lib",
276 srcs = [
277 # AUTOGEN(protoc_lib_srcs)
278 "src/google/protobuf/compiler/code_generator.cc",
279 "src/google/protobuf/compiler/command_line_interface.cc",
280 "src/google/protobuf/compiler/cpp/cpp_enum.cc",
281 "src/google/protobuf/compiler/cpp/cpp_enum_field.cc",
282 "src/google/protobuf/compiler/cpp/cpp_extension.cc",
283 "src/google/protobuf/compiler/cpp/cpp_field.cc",
284 "src/google/protobuf/compiler/cpp/cpp_file.cc",
285 "src/google/protobuf/compiler/cpp/cpp_generator.cc",
286 "src/google/protobuf/compiler/cpp/cpp_helpers.cc",
287 "src/google/protobuf/compiler/cpp/cpp_map_field.cc",
288 "src/google/protobuf/compiler/cpp/cpp_message.cc",
289 "src/google/protobuf/compiler/cpp/cpp_message_field.cc",
Adam Cozzette13fd0452017-09-12 10:32:01 -0700290 "src/google/protobuf/compiler/cpp/cpp_padding_optimizer.cc",
Jisi Liud19604f2015-06-17 17:37:58 -0700291 "src/google/protobuf/compiler/cpp/cpp_primitive_field.cc",
292 "src/google/protobuf/compiler/cpp/cpp_service.cc",
293 "src/google/protobuf/compiler/cpp/cpp_string_field.cc",
Ming Zhao5cdd9362015-10-05 14:37:21 -0700294 "src/google/protobuf/compiler/csharp/csharp_doc_comment.cc",
Jisi Liud19604f2015-06-17 17:37:58 -0700295 "src/google/protobuf/compiler/csharp/csharp_enum.cc",
296 "src/google/protobuf/compiler/csharp/csharp_enum_field.cc",
Jisi Liud19604f2015-06-17 17:37:58 -0700297 "src/google/protobuf/compiler/csharp/csharp_field_base.cc",
298 "src/google/protobuf/compiler/csharp/csharp_generator.cc",
299 "src/google/protobuf/compiler/csharp/csharp_helpers.cc",
Jon Skeetb2ac8682015-07-15 13:17:42 +0100300 "src/google/protobuf/compiler/csharp/csharp_map_field.cc",
Jisi Liud19604f2015-06-17 17:37:58 -0700301 "src/google/protobuf/compiler/csharp/csharp_message.cc",
302 "src/google/protobuf/compiler/csharp/csharp_message_field.cc",
303 "src/google/protobuf/compiler/csharp/csharp_primitive_field.cc",
Jon Skeeta6361a12015-11-19 13:05:17 +0000304 "src/google/protobuf/compiler/csharp/csharp_reflection_class.cc",
Jisi Liud19604f2015-06-17 17:37:58 -0700305 "src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc",
306 "src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc",
307 "src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc",
308 "src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc",
Jon Skeetb2ac8682015-07-15 13:17:42 +0100309 "src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc",
Jisi Liud19604f2015-06-17 17:37:58 -0700310 "src/google/protobuf/compiler/java/java_context.cc",
311 "src/google/protobuf/compiler/java/java_doc_comment.cc",
312 "src/google/protobuf/compiler/java/java_enum.cc",
313 "src/google/protobuf/compiler/java/java_enum_field.cc",
314 "src/google/protobuf/compiler/java/java_enum_field_lite.cc",
Jisi Liub90f9f82015-08-25 17:06:33 -0700315 "src/google/protobuf/compiler/java/java_enum_lite.cc",
Jisi Liud19604f2015-06-17 17:37:58 -0700316 "src/google/protobuf/compiler/java/java_extension.cc",
Jisi Liu1f4f3e22016-04-18 14:12:08 -0700317 "src/google/protobuf/compiler/java/java_extension_lite.cc",
Jisi Liud19604f2015-06-17 17:37:58 -0700318 "src/google/protobuf/compiler/java/java_field.cc",
319 "src/google/protobuf/compiler/java/java_file.cc",
320 "src/google/protobuf/compiler/java/java_generator.cc",
321 "src/google/protobuf/compiler/java/java_generator_factory.cc",
322 "src/google/protobuf/compiler/java/java_helpers.cc",
323 "src/google/protobuf/compiler/java/java_lazy_message_field.cc",
324 "src/google/protobuf/compiler/java/java_lazy_message_field_lite.cc",
325 "src/google/protobuf/compiler/java/java_map_field.cc",
326 "src/google/protobuf/compiler/java/java_map_field_lite.cc",
327 "src/google/protobuf/compiler/java/java_message.cc",
328 "src/google/protobuf/compiler/java/java_message_builder.cc",
329 "src/google/protobuf/compiler/java/java_message_builder_lite.cc",
330 "src/google/protobuf/compiler/java/java_message_field.cc",
331 "src/google/protobuf/compiler/java/java_message_field_lite.cc",
332 "src/google/protobuf/compiler/java/java_message_lite.cc",
333 "src/google/protobuf/compiler/java/java_name_resolver.cc",
334 "src/google/protobuf/compiler/java/java_primitive_field.cc",
335 "src/google/protobuf/compiler/java/java_primitive_field_lite.cc",
336 "src/google/protobuf/compiler/java/java_service.cc",
337 "src/google/protobuf/compiler/java/java_shared_code_generator.cc",
338 "src/google/protobuf/compiler/java/java_string_field.cc",
339 "src/google/protobuf/compiler/java/java_string_field_lite.cc",
340 "src/google/protobuf/compiler/javanano/javanano_enum.cc",
341 "src/google/protobuf/compiler/javanano/javanano_enum_field.cc",
342 "src/google/protobuf/compiler/javanano/javanano_extension.cc",
343 "src/google/protobuf/compiler/javanano/javanano_field.cc",
344 "src/google/protobuf/compiler/javanano/javanano_file.cc",
345 "src/google/protobuf/compiler/javanano/javanano_generator.cc",
346 "src/google/protobuf/compiler/javanano/javanano_helpers.cc",
347 "src/google/protobuf/compiler/javanano/javanano_map_field.cc",
348 "src/google/protobuf/compiler/javanano/javanano_message.cc",
349 "src/google/protobuf/compiler/javanano/javanano_message_field.cc",
350 "src/google/protobuf/compiler/javanano/javanano_primitive_field.cc",
Feng Xiaoef6c72b2015-12-28 17:33:55 -0800351 "src/google/protobuf/compiler/js/js_generator.cc",
Jisi Liuf92b4552016-12-05 10:16:47 -0800352 "src/google/protobuf/compiler/js/well_known_types_embed.cc",
Jisi Liud19604f2015-06-17 17:37:58 -0700353 "src/google/protobuf/compiler/objectivec/objectivec_enum.cc",
354 "src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc",
355 "src/google/protobuf/compiler/objectivec/objectivec_extension.cc",
356 "src/google/protobuf/compiler/objectivec/objectivec_field.cc",
357 "src/google/protobuf/compiler/objectivec/objectivec_file.cc",
358 "src/google/protobuf/compiler/objectivec/objectivec_generator.cc",
359 "src/google/protobuf/compiler/objectivec/objectivec_helpers.cc",
360 "src/google/protobuf/compiler/objectivec/objectivec_map_field.cc",
361 "src/google/protobuf/compiler/objectivec/objectivec_message.cc",
362 "src/google/protobuf/compiler/objectivec/objectivec_message_field.cc",
363 "src/google/protobuf/compiler/objectivec/objectivec_oneof.cc",
364 "src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc",
Jisi Liud9473082016-09-22 15:14:58 -0700365 "src/google/protobuf/compiler/php/php_generator.cc",
Jisi Liud19604f2015-06-17 17:37:58 -0700366 "src/google/protobuf/compiler/plugin.cc",
367 "src/google/protobuf/compiler/plugin.pb.cc",
368 "src/google/protobuf/compiler/python/python_generator.cc",
369 "src/google/protobuf/compiler/ruby/ruby_generator.cc",
370 "src/google/protobuf/compiler/subprocess.cc",
371 "src/google/protobuf/compiler/zip_writer.cc",
372 ],
373 copts = COPTS,
374 includes = ["src/"],
375 linkopts = LINK_OPTS,
376 visibility = ["//visibility:public"],
377 deps = [":protobuf"],
378)
379
380cc_binary(
381 name = "protoc",
382 srcs = ["src/google/protobuf/compiler/main.cc"],
Jisi Liud19604f2015-06-17 17:37:58 -0700383 linkopts = LINK_OPTS,
384 visibility = ["//visibility:public"],
385 deps = [":protoc_lib"],
386)
387
Jisi Liud19604f2015-06-17 17:37:58 -0700388################################################################################
389# Tests
390################################################################################
391
Jisi Liu993fb702015-10-19 17:19:49 -0700392RELATIVE_LITE_TEST_PROTOS = [
Jisi Liud19604f2015-06-17 17:37:58 -0700393 # AUTOGEN(lite_test_protos)
394 "google/protobuf/map_lite_unittest.proto",
395 "google/protobuf/unittest_import_lite.proto",
396 "google/protobuf/unittest_import_public_lite.proto",
397 "google/protobuf/unittest_lite.proto",
Jisi Liub90f9f82015-08-25 17:06:33 -0700398 "google/protobuf/unittest_no_arena_lite.proto",
Jisi Liud19604f2015-06-17 17:37:58 -0700399]
400
Jisi Liu993fb702015-10-19 17:19:49 -0700401LITE_TEST_PROTOS = ["src/" + s for s in RELATIVE_LITE_TEST_PROTOS]
402
403RELATIVE_TEST_PROTOS = [
Jisi Liud19604f2015-06-17 17:37:58 -0700404 # AUTOGEN(test_protos)
405 "google/protobuf/any_test.proto",
406 "google/protobuf/compiler/cpp/cpp_test_bad_identifiers.proto",
407 "google/protobuf/compiler/cpp/cpp_test_large_enum_value.proto",
408 "google/protobuf/map_proto2_unittest.proto",
409 "google/protobuf/map_unittest.proto",
410 "google/protobuf/unittest.proto",
411 "google/protobuf/unittest_arena.proto",
412 "google/protobuf/unittest_custom_options.proto",
413 "google/protobuf/unittest_drop_unknown_fields.proto",
414 "google/protobuf/unittest_embed_optimize_for.proto",
415 "google/protobuf/unittest_empty.proto",
416 "google/protobuf/unittest_enormous_descriptor.proto",
417 "google/protobuf/unittest_import.proto",
418 "google/protobuf/unittest_import_public.proto",
Feng Xiao32d78302017-03-29 14:01:40 -0700419 "google/protobuf/unittest_lazy_dependencies.proto",
420 "google/protobuf/unittest_lazy_dependencies_custom_option.proto",
421 "google/protobuf/unittest_lazy_dependencies_enum.proto",
Jisi Liud19604f2015-06-17 17:37:58 -0700422 "google/protobuf/unittest_lite_imports_nonlite.proto",
423 "google/protobuf/unittest_mset.proto",
Jisi Liub90f9f82015-08-25 17:06:33 -0700424 "google/protobuf/unittest_mset_wire_format.proto",
Jisi Liud19604f2015-06-17 17:37:58 -0700425 "google/protobuf/unittest_no_arena.proto",
426 "google/protobuf/unittest_no_arena_import.proto",
427 "google/protobuf/unittest_no_field_presence.proto",
428 "google/protobuf/unittest_no_generic_services.proto",
429 "google/protobuf/unittest_optimize_for.proto",
430 "google/protobuf/unittest_preserve_unknown_enum.proto",
431 "google/protobuf/unittest_preserve_unknown_enum2.proto",
432 "google/protobuf/unittest_proto3_arena.proto",
Chad Whipkeybaf52bd2016-04-15 09:23:50 -0700433 "google/protobuf/unittest_proto3_arena_lite.proto",
434 "google/protobuf/unittest_proto3_lite.proto",
Jisi Liud19604f2015-06-17 17:37:58 -0700435 "google/protobuf/unittest_well_known_types.proto",
Jisi Liuaf3eafd2015-06-18 13:38:36 -0700436 "google/protobuf/util/internal/testdata/anys.proto",
437 "google/protobuf/util/internal/testdata/books.proto",
438 "google/protobuf/util/internal/testdata/default_value.proto",
439 "google/protobuf/util/internal/testdata/default_value_test.proto",
440 "google/protobuf/util/internal/testdata/field_mask.proto",
441 "google/protobuf/util/internal/testdata/maps.proto",
Jisi Liub90f9f82015-08-25 17:06:33 -0700442 "google/protobuf/util/internal/testdata/oneofs.proto",
Jisi Liu9d4657a2016-09-22 15:11:17 -0700443 "google/protobuf/util/internal/testdata/proto3.proto",
Jisi Liuaf3eafd2015-06-18 13:38:36 -0700444 "google/protobuf/util/internal/testdata/struct.proto",
445 "google/protobuf/util/internal/testdata/timestamp_duration.proto",
Jisi Liu9d4657a2016-09-22 15:11:17 -0700446 "google/protobuf/util/internal/testdata/wrappers.proto",
Jisi Liuaf3eafd2015-06-18 13:38:36 -0700447 "google/protobuf/util/json_format_proto3.proto",
Feng Xiaoef6c72b2015-12-28 17:33:55 -0800448 "google/protobuf/util/message_differencer_unittest.proto",
Jisi Liud19604f2015-06-17 17:37:58 -0700449]
450
Jisi Liu993fb702015-10-19 17:19:49 -0700451TEST_PROTOS = ["src/" + s for s in RELATIVE_TEST_PROTOS]
452
Jisi Liu39362b32015-10-14 17:12:11 -0700453cc_proto_library(
454 name = "cc_test_protos",
Jisi Liu993fb702015-10-19 17:19:49 -0700455 srcs = LITE_TEST_PROTOS + TEST_PROTOS,
Jisi Liu3101e732015-10-16 12:46:26 -0700456 include = "src",
Jisi Liube92ffb2015-10-27 15:11:38 -0700457 default_runtime = ":protobuf",
Manjunath Kudlur3ff1dca2015-12-07 13:08:21 -0800458 protoc = ":protoc",
Jisi Liud8701b52015-10-16 11:44:21 -0700459 deps = [":cc_wkt_protos"],
Jisi Liud19604f2015-06-17 17:37:58 -0700460)
461
462COMMON_TEST_SRCS = [
463 # AUTOGEN(common_test_srcs)
464 "src/google/protobuf/arena_test_util.cc",
465 "src/google/protobuf/map_test_util.cc",
466 "src/google/protobuf/test_util.cc",
467 "src/google/protobuf/testing/file.cc",
468 "src/google/protobuf/testing/googletest.cc",
469]
470
Jisi Liu7a0c4312015-06-18 16:45:27 -0700471cc_binary(
472 name = "test_plugin",
473 srcs = [
474 # AUTOGEN(test_plugin_srcs)
475 "src/google/protobuf/compiler/mock_code_generator.cc",
476 "src/google/protobuf/compiler/test_plugin.cc",
477 "src/google/protobuf/testing/file.cc",
478 ],
479 deps = [
480 ":protobuf",
481 ":protoc_lib",
482 "//external:gtest",
483 ],
484)
485
486cc_test(
Jisi Liu759245a2017-07-25 11:52:33 -0700487 name = "win32_test",
488 srcs = ["src/google/protobuf/stubs/io_win32_unittest.cc"],
489 deps = [
490 ":protobuf_lite",
491 "//external:gtest_main",
492 ],
493 tags = ["manual", "windows"],
494)
495
496cc_test(
Jisi Liu7a0c4312015-06-18 16:45:27 -0700497 name = "protobuf_test",
Jisi Liu39362b32015-10-14 17:12:11 -0700498 srcs = COMMON_TEST_SRCS + [
Jisi Liu7a0c4312015-06-18 16:45:27 -0700499 # AUTOGEN(test_srcs)
500 "src/google/protobuf/any_test.cc",
501 "src/google/protobuf/arena_unittest.cc",
502 "src/google/protobuf/arenastring_unittest.cc",
503 "src/google/protobuf/compiler/command_line_interface_unittest.cc",
504 "src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc",
Jisi Liu11b66612017-07-19 12:10:43 -0700505 "src/google/protobuf/compiler/cpp/cpp_move_unittest.cc",
Jisi Liu7a0c4312015-06-18 16:45:27 -0700506 "src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc",
507 "src/google/protobuf/compiler/cpp/cpp_unittest.cc",
Jisi Liu1f4f3e22016-04-18 14:12:08 -0700508 "src/google/protobuf/compiler/cpp/metadata_test.cc",
Feng Xiao32d78302017-03-29 14:01:40 -0700509 "src/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc",
Jisi Liu7a0c4312015-06-18 16:45:27 -0700510 "src/google/protobuf/compiler/csharp/csharp_generator_unittest.cc",
511 "src/google/protobuf/compiler/importer_unittest.cc",
512 "src/google/protobuf/compiler/java/java_doc_comment_unittest.cc",
513 "src/google/protobuf/compiler/java/java_plugin_unittest.cc",
514 "src/google/protobuf/compiler/mock_code_generator.cc",
515 "src/google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc",
516 "src/google/protobuf/compiler/parser_unittest.cc",
517 "src/google/protobuf/compiler/python/python_plugin_unittest.cc",
518 "src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc",
519 "src/google/protobuf/descriptor_database_unittest.cc",
520 "src/google/protobuf/descriptor_unittest.cc",
521 "src/google/protobuf/drop_unknown_fields_test.cc",
522 "src/google/protobuf/dynamic_message_unittest.cc",
523 "src/google/protobuf/extension_set_unittest.cc",
524 "src/google/protobuf/generated_message_reflection_unittest.cc",
525 "src/google/protobuf/io/coded_stream_unittest.cc",
526 "src/google/protobuf/io/printer_unittest.cc",
527 "src/google/protobuf/io/tokenizer_unittest.cc",
528 "src/google/protobuf/io/zero_copy_stream_unittest.cc",
529 "src/google/protobuf/map_field_test.cc",
530 "src/google/protobuf/map_test.cc",
531 "src/google/protobuf/message_unittest.cc",
532 "src/google/protobuf/no_field_presence_test.cc",
533 "src/google/protobuf/preserve_unknown_enum_test.cc",
Chad Whipkeybaf52bd2016-04-15 09:23:50 -0700534 "src/google/protobuf/proto3_arena_lite_unittest.cc",
Jisi Liuf86d39c2016-04-28 14:43:22 -0700535 "src/google/protobuf/proto3_arena_unittest.cc",
Chad Whipkeybaf52bd2016-04-15 09:23:50 -0700536 "src/google/protobuf/proto3_lite_unittest.cc",
Jisi Liu7a0c4312015-06-18 16:45:27 -0700537 "src/google/protobuf/reflection_ops_unittest.cc",
538 "src/google/protobuf/repeated_field_reflection_unittest.cc",
539 "src/google/protobuf/repeated_field_unittest.cc",
540 "src/google/protobuf/stubs/bytestream_unittest.cc",
541 "src/google/protobuf/stubs/common_unittest.cc",
Jisi Liub90f9f82015-08-25 17:06:33 -0700542 "src/google/protobuf/stubs/int128_unittest.cc",
Jisi Liu759245a2017-07-25 11:52:33 -0700543 "src/google/protobuf/stubs/io_win32_unittest.cc",
Jisi Liu7a0c4312015-06-18 16:45:27 -0700544 "src/google/protobuf/stubs/once_unittest.cc",
545 "src/google/protobuf/stubs/status_test.cc",
546 "src/google/protobuf/stubs/statusor_test.cc",
547 "src/google/protobuf/stubs/stringpiece_unittest.cc",
548 "src/google/protobuf/stubs/stringprintf_unittest.cc",
549 "src/google/protobuf/stubs/structurally_valid_unittest.cc",
550 "src/google/protobuf/stubs/strutil_unittest.cc",
551 "src/google/protobuf/stubs/template_util_unittest.cc",
552 "src/google/protobuf/stubs/time_test.cc",
553 "src/google/protobuf/stubs/type_traits_unittest.cc",
554 "src/google/protobuf/text_format_unittest.cc",
555 "src/google/protobuf/unknown_field_set_unittest.cc",
Byron Yicb3e84b2017-03-16 20:01:22 +0800556 "src/google/protobuf/util/delimited_message_util_test.cc",
Jisi Liu7a0c4312015-06-18 16:45:27 -0700557 "src/google/protobuf/util/field_comparator_test.cc",
Jisi Liub90f9f82015-08-25 17:06:33 -0700558 "src/google/protobuf/util/field_mask_util_test.cc",
Jisi Liu7a0c4312015-06-18 16:45:27 -0700559 "src/google/protobuf/util/internal/default_value_objectwriter_test.cc",
560 "src/google/protobuf/util/internal/json_objectwriter_test.cc",
561 "src/google/protobuf/util/internal/json_stream_parser_test.cc",
562 "src/google/protobuf/util/internal/protostream_objectsource_test.cc",
563 "src/google/protobuf/util/internal/protostream_objectwriter_test.cc",
564 "src/google/protobuf/util/internal/type_info_test_helper.cc",
565 "src/google/protobuf/util/json_util_test.cc",
Feng Xiaoef6c72b2015-12-28 17:33:55 -0800566 "src/google/protobuf/util/message_differencer_unittest.cc",
Jisi Liub90f9f82015-08-25 17:06:33 -0700567 "src/google/protobuf/util/time_util_test.cc",
Jisi Liu7a0c4312015-06-18 16:45:27 -0700568 "src/google/protobuf/util/type_resolver_util_test.cc",
569 "src/google/protobuf/well_known_types_unittest.cc",
570 "src/google/protobuf/wire_format_unittest.cc",
571 ],
572 copts = COPTS,
573 data = [
574 ":test_plugin",
Jisi Liu598480d2015-10-21 11:19:16 -0700575 ] + glob([
576 "src/google/protobuf/**/*",
Feng Xiaoacde1652017-03-29 15:14:18 -0700577 # Files for csharp_bootstrap_unittest.cc.
578 "conformance/**/*",
579 "csharp/src/**/*",
Jisi Liu598480d2015-10-21 11:19:16 -0700580 ]),
Jisi Liu7a0c4312015-06-18 16:45:27 -0700581 includes = [
582 "src/",
583 ],
584 linkopts = LINK_OPTS,
585 deps = [
Jisi Liu993fb702015-10-19 17:19:49 -0700586 ":cc_test_protos",
Jisi Liu7a0c4312015-06-18 16:45:27 -0700587 ":protobuf",
588 ":protoc_lib",
589 "//external:gtest_main",
590 ],
591)
Jisi Liu993fb702015-10-19 17:19:49 -0700592
593################################################################################
594# Java support
595################################################################################
Steven Parkesea188662016-02-25 07:53:19 -0800596internal_gen_well_known_protos_java(
Ming Zhao4fe03812016-01-21 23:03:28 -0800597 srcs = WELL_KNOWN_PROTOS,
Jisi Liu993fb702015-10-19 17:19:49 -0700598)
599
600java_library(
Jisi Liu166e9bb2015-10-21 10:56:38 -0700601 name = "protobuf_java",
Jisi Liu993fb702015-10-19 17:19:49 -0700602 srcs = glob([
Ming Zhao4fe03812016-01-21 23:03:28 -0800603 "java/core/src/main/java/com/google/protobuf/*.java",
Jisi Liu993fb702015-10-19 17:19:49 -0700604 ]) + [
Ming Zhao4fe03812016-01-21 23:03:28 -0800605 ":gen_well_known_protos_java",
Jisi Liu993fb702015-10-19 17:19:49 -0700606 ],
Jakob Buchgraber36e63da2017-06-16 12:41:40 +0200607 javacopts = ["-source 6", "-target 6"],
Jisi Liu993fb702015-10-19 17:19:49 -0700608 visibility = ["//visibility:public"],
609)
610
Steven Parkesa9244ca2016-03-10 17:50:25 -0800611java_library(
612 name = "protobuf_java_util",
613 srcs = glob([
614 "java/util/src/main/java/com/google/protobuf/util/*.java",
615 ]),
Jakob Buchgraber36e63da2017-06-16 12:41:40 +0200616 javacopts = ["-source 6", "-target 6"],
Manjunath Kudlur2d430f82017-02-23 08:17:24 -0800617 visibility = ["//visibility:public"],
Steven Parkesa9244ca2016-03-10 17:50:25 -0800618 deps = [
David Z. Chen5ebeefb2016-04-08 13:30:13 -0700619 "protobuf_java",
620 "//external:gson",
621 "//external:guava",
Steven Parkesa9244ca2016-03-10 17:50:25 -0800622 ],
Steven Parkesa9244ca2016-03-10 17:50:25 -0800623)
624
Jisi Liu993fb702015-10-19 17:19:49 -0700625################################################################################
626# Python support
627################################################################################
628
David Z. Chen985c9682016-02-11 18:11:10 -0800629py_library(
Jisi Liu993fb702015-10-19 17:19:49 -0700630 name = "python_srcs",
631 srcs = glob(
632 [
633 "python/google/protobuf/*.py",
634 "python/google/protobuf/**/*.py",
635 ],
636 exclude = [
David Z. Chen02cd45c2016-05-20 16:49:04 -0700637 "python/google/protobuf/__init__.py",
638 "python/google/protobuf/**/__init__.py",
Jisi Liu993fb702015-10-19 17:19:49 -0700639 "python/google/protobuf/internal/*_test.py",
640 "python/google/protobuf/internal/test_util.py",
641 ],
642 ),
David Z. Chen985c9682016-02-11 18:11:10 -0800643 imports = ["python"],
Manjunath Kudlur2d430f82017-02-23 08:17:24 -0800644 srcs_version = "PY2AND3",
Jisi Liu993fb702015-10-19 17:19:49 -0700645)
646
Manjunath Kudlur3ff1dca2015-12-07 13:08:21 -0800647cc_binary(
Richard Shindf5841f2016-10-18 13:16:44 -0700648 name = "python/google/protobuf/internal/_api_implementation.so",
Manjunath Kudlur3ff1dca2015-12-07 13:08:21 -0800649 srcs = ["python/google/protobuf/internal/api_implementation.cc"],
650 copts = COPTS + [
Manjunath Kudlur3ff1dca2015-12-07 13:08:21 -0800651 "-DPYTHON_PROTO2_CPP_IMPL_V2",
652 ],
653 linkshared = 1,
654 linkstatic = 1,
Manjunath Kudlura1949212015-12-08 08:24:37 -0800655 deps = select({
656 "//conditions:default": [],
David Z. Chen985c9682016-02-11 18:11:10 -0800657 ":use_fast_cpp_protos": ["//external:python_headers"],
Manjunath Kudlura1949212015-12-08 08:24:37 -0800658 }),
Manjunath Kudlur3ff1dca2015-12-07 13:08:21 -0800659)
660
661cc_binary(
Richard Shindf5841f2016-10-18 13:16:44 -0700662 name = "python/google/protobuf/pyext/_message.so",
Manjunath Kudlur3ff1dca2015-12-07 13:08:21 -0800663 srcs = glob([
664 "python/google/protobuf/pyext/*.cc",
665 "python/google/protobuf/pyext/*.h",
666 ]),
667 copts = COPTS + [
668 "-DGOOGLE_PROTOBUF_HAS_ONEOF=1",
Manjunath Kudlur99a3e302016-02-16 15:17:10 -0800669 ] + select({
670 "//conditions:default": [],
671 ":allow_oversize_protos": ["-DPROTOBUF_PYTHON_ALLOW_OVERSIZE_PROTOS=1"],
672 }),
Manjunath Kudlur3ff1dca2015-12-07 13:08:21 -0800673 includes = [
674 "python/",
675 "src/",
676 ],
677 linkshared = 1,
678 linkstatic = 1,
Manjunath Kudlura1949212015-12-08 08:24:37 -0800679 deps = [
680 ":protobuf",
681 ] + select({
682 "//conditions:default": [],
David Z. Chen985c9682016-02-11 18:11:10 -0800683 ":use_fast_cpp_protos": ["//external:python_headers"],
Manjunath Kudlura1949212015-12-08 08:24:37 -0800684 }),
685)
686
687config_setting(
688 name = "use_fast_cpp_protos",
689 values = {
690 "define": "use_fast_cpp_protos=true",
691 },
Manjunath Kudlur3ff1dca2015-12-07 13:08:21 -0800692)
693
Manjunath Kudlur99a3e302016-02-16 15:17:10 -0800694config_setting(
695 name = "allow_oversize_protos",
696 values = {
697 "define": "allow_oversize_protos=true",
698 },
699)
700
David Z. Chen02cd45c2016-05-20 16:49:04 -0700701# Copy the builtin proto files from src/google/protobuf to
702# python/google/protobuf. This way, the generated Python sources will be in the
703# same directory as the Python runtime sources. This is necessary for the
704# modules to be imported correctly since they are all part of the same Python
705# package.
706internal_copied_filegroup(
707 name = "protos_python",
708 srcs = WELL_KNOWN_PROTOS,
David Z. Chen02cd45c2016-05-20 16:49:04 -0700709 dest = "python",
Manjunath Kudlur2d430f82017-02-23 08:17:24 -0800710 strip_prefix = "src",
David Z. Chen02cd45c2016-05-20 16:49:04 -0700711)
712
713# TODO(dzc): Remove this once py_proto_library can have labels in srcs, in
714# which case we can simply add :protos_python in srcs.
715COPIED_WELL_KNOWN_PROTOS = ["python/" + s for s in RELATIVE_WELL_KNOWN_PROTOS]
716
Jisi Liu993fb702015-10-19 17:19:49 -0700717py_proto_library(
Jisi Liu166e9bb2015-10-21 10:56:38 -0700718 name = "protobuf_python",
David Z. Chen02cd45c2016-05-20 16:49:04 -0700719 srcs = COPIED_WELL_KNOWN_PROTOS,
720 include = "python",
Manjunath Kudlura1949212015-12-08 08:24:37 -0800721 data = select({
722 "//conditions:default": [],
723 ":use_fast_cpp_protos": [
Richard Shindf5841f2016-10-18 13:16:44 -0700724 ":python/google/protobuf/internal/_api_implementation.so",
725 ":python/google/protobuf/pyext/_message.so",
Manjunath Kudlura1949212015-12-08 08:24:37 -0800726 ],
727 }),
Manjunath Kudlur3ff1dca2015-12-07 13:08:21 -0800728 default_runtime = "",
Jisi Liu04658a32015-10-20 15:00:13 -0700729 protoc = ":protoc",
David Z. Chen985c9682016-02-11 18:11:10 -0800730 py_libs = [
731 ":python_srcs",
Manjunath Kudlur2d430f82017-02-23 08:17:24 -0800732 "//external:six",
David Z. Chen985c9682016-02-11 18:11:10 -0800733 ],
Manjunath Kudlur3ff1dca2015-12-07 13:08:21 -0800734 srcs_version = "PY2AND3",
Jisi Liu993fb702015-10-19 17:19:49 -0700735 visibility = ["//visibility:public"],
736)
737
David Z. Chen02cd45c2016-05-20 16:49:04 -0700738# Copy the test proto files from src/google/protobuf to
739# python/google/protobuf. This way, the generated Python sources will be in the
740# same directory as the Python runtime sources. This is necessary for the
741# modules to be imported correctly by the tests since they are all part of the
742# same Python package.
743internal_copied_filegroup(
744 name = "protos_python_test",
745 srcs = LITE_TEST_PROTOS + TEST_PROTOS,
David Z. Chen02cd45c2016-05-20 16:49:04 -0700746 dest = "python",
Manjunath Kudlur2d430f82017-02-23 08:17:24 -0800747 strip_prefix = "src",
David Z. Chen02cd45c2016-05-20 16:49:04 -0700748)
749
750# TODO(dzc): Remove this once py_proto_library can have labels in srcs, in
751# which case we can simply add :protos_python_test in srcs.
752COPIED_LITE_TEST_PROTOS = ["python/" + s for s in RELATIVE_LITE_TEST_PROTOS]
Manjunath Kudlur2d430f82017-02-23 08:17:24 -0800753
David Z. Chen02cd45c2016-05-20 16:49:04 -0700754COPIED_TEST_PROTOS = ["python/" + s for s in RELATIVE_TEST_PROTOS]
755
Jisi Liu993fb702015-10-19 17:19:49 -0700756py_proto_library(
757 name = "python_common_test_protos",
David Z. Chen02cd45c2016-05-20 16:49:04 -0700758 srcs = COPIED_LITE_TEST_PROTOS + COPIED_TEST_PROTOS,
759 include = "python",
Manjunath Kudlur3ff1dca2015-12-07 13:08:21 -0800760 default_runtime = "",
Jisi Liu04658a32015-10-20 15:00:13 -0700761 protoc = ":protoc",
David Z. Chen5ebeefb2016-04-08 13:30:13 -0700762 srcs_version = "PY2AND3",
Jisi Liu166e9bb2015-10-21 10:56:38 -0700763 deps = [":protobuf_python"],
Jisi Liu993fb702015-10-19 17:19:49 -0700764)
765
766py_proto_library(
767 name = "python_specific_test_protos",
Jisi Liu68e13f42015-10-22 11:13:14 -0700768 srcs = glob([
769 "python/google/protobuf/internal/*.proto",
770 "python/google/protobuf/internal/import_test_package/*.proto",
771 ]),
Jisi Liu993fb702015-10-19 17:19:49 -0700772 include = "python",
Manjunath Kudlur3ff1dca2015-12-07 13:08:21 -0800773 default_runtime = ":protobuf_python",
Jisi Liu04658a32015-10-20 15:00:13 -0700774 protoc = ":protoc",
David Z. Chen5ebeefb2016-04-08 13:30:13 -0700775 srcs_version = "PY2AND3",
Jisi Liu993fb702015-10-19 17:19:49 -0700776 deps = [":python_common_test_protos"],
777)
778
779py_library(
780 name = "python_tests",
David Z. Chen985c9682016-02-11 18:11:10 -0800781 srcs = glob(
782 [
783 "python/google/protobuf/internal/*_test.py",
784 "python/google/protobuf/internal/test_util.py",
David Z. Chen02cd45c2016-05-20 16:49:04 -0700785 "python/google/protobuf/internal/import_test_package/__init__.py",
David Z. Chen985c9682016-02-11 18:11:10 -0800786 ],
787 ),
788 imports = ["python"],
Geoffrey Irving29799232015-12-03 13:11:19 -0800789 srcs_version = "PY2AND3",
Jisi Liu993fb702015-10-19 17:19:49 -0700790 deps = [
Jisi Liu166e9bb2015-10-21 10:56:38 -0700791 ":protobuf_python",
Jisi Liu598480d2015-10-21 11:19:16 -0700792 ":python_common_test_protos",
Jisi Liu993fb702015-10-19 17:19:49 -0700793 ":python_specific_test_protos",
794 ],
795)
796
797internal_protobuf_py_tests(
Jisi Liu8f540262015-10-20 16:21:41 -0700798 name = "python_tests_batch",
Jisi Liu68e13f42015-10-22 11:13:14 -0700799 data = glob([
800 "src/google/protobuf/**/*",
801 ]),
Jisi Liu993fb702015-10-19 17:19:49 -0700802 modules = [
803 "descriptor_database_test",
804 "descriptor_pool_test",
805 "descriptor_test",
806 "generator_test",
807 "json_format_test",
808 "message_factory_test",
Jisi Liu68e13f42015-10-22 11:13:14 -0700809 "message_test",
Jisi Liu993fb702015-10-19 17:19:49 -0700810 "proto_builder_test",
Jisi Liu68e13f42015-10-22 11:13:14 -0700811 "reflection_test",
Jisi Liu993fb702015-10-19 17:19:49 -0700812 "service_reflection_test",
813 "symbol_database_test",
814 "text_encoding_test",
Jisi Liu68e13f42015-10-22 11:13:14 -0700815 "text_format_test",
Jisi Liu993fb702015-10-19 17:19:49 -0700816 "unknown_fields_test",
817 "wire_format_test",
818 ],
819 deps = [":python_tests"],
820)
cgrushko45d92ae2016-12-02 19:40:50 -0500821
822proto_lang_toolchain(
Manjunath Kudlur2d430f82017-02-23 08:17:24 -0800823 name = "cc_toolchain",
824 command_line = "--cpp_out=$(OUT)",
825 runtime = ":protobuf",
826 visibility = ["//visibility:public"],
cgrushko45d92ae2016-12-02 19:40:50 -0500827)
cgrushkoe4baf3f2017-01-12 12:51:04 -0500828
829proto_lang_toolchain(
830 name = "java_toolchain",
831 command_line = "--java_out=$(OUT)",
832 runtime = ":protobuf_java",
833 visibility = ["//visibility:public"],
834)
makdharma286f0592017-05-01 09:49:26 -0700835
836OBJC_HDRS = [
837 "objectivec/GPBArray.h",
838 "objectivec/GPBBootstrap.h",
839 "objectivec/GPBCodedInputStream.h",
840 "objectivec/GPBCodedOutputStream.h",
841 "objectivec/GPBDescriptor.h",
842 "objectivec/GPBDictionary.h",
843 "objectivec/GPBExtensionInternals.h",
844 "objectivec/GPBExtensionRegistry.h",
845 "objectivec/GPBMessage.h",
846 "objectivec/GPBProtocolBuffers.h",
847 "objectivec/GPBProtocolBuffers_RuntimeSupport.h",
848 "objectivec/GPBRootObject.h",
849 "objectivec/GPBRuntimeTypes.h",
850 "objectivec/GPBUnknownField.h",
851 "objectivec/GPBUnknownFieldSet.h",
852 "objectivec/GPBUtilities.h",
853 "objectivec/GPBWellKnownTypes.h",
854 "objectivec/GPBWireFormat.h",
855 "objectivec/google/protobuf/Any.pbobjc.h",
856 "objectivec/google/protobuf/Api.pbobjc.h",
857 "objectivec/google/protobuf/Duration.pbobjc.h",
858 "objectivec/google/protobuf/Empty.pbobjc.h",
859 "objectivec/google/protobuf/FieldMask.pbobjc.h",
860 "objectivec/google/protobuf/SourceContext.pbobjc.h",
861 "objectivec/google/protobuf/Struct.pbobjc.h",
862 "objectivec/google/protobuf/Timestamp.pbobjc.h",
863 "objectivec/google/protobuf/Type.pbobjc.h",
864 "objectivec/google/protobuf/Wrappers.pbobjc.h",
865]
866
867OBJC_PRIVATE_HDRS = [
868 "objectivec/GPBArray_PackagePrivate.h",
869 "objectivec/GPBCodedInputStream_PackagePrivate.h",
870 "objectivec/GPBCodedOutputStream_PackagePrivate.h",
871 "objectivec/GPBDescriptor_PackagePrivate.h",
872 "objectivec/GPBDictionary_PackagePrivate.h",
873 "objectivec/GPBMessage_PackagePrivate.h",
874 "objectivec/GPBRootObject_PackagePrivate.h",
875 "objectivec/GPBUnknownFieldSet_PackagePrivate.h",
876 "objectivec/GPBUnknownField_PackagePrivate.h",
877 "objectivec/GPBUtilities_PackagePrivate.h",
878]
879
880OBJC_SRCS = [
881 "objectivec/GPBArray.m",
882 "objectivec/GPBCodedInputStream.m",
883 "objectivec/GPBCodedOutputStream.m",
884 "objectivec/GPBDescriptor.m",
885 "objectivec/GPBDictionary.m",
886 "objectivec/GPBExtensionInternals.m",
887 "objectivec/GPBExtensionRegistry.m",
888 "objectivec/GPBMessage.m",
889 "objectivec/GPBRootObject.m",
890 "objectivec/GPBUnknownField.m",
891 "objectivec/GPBUnknownFieldSet.m",
892 "objectivec/GPBUtilities.m",
893 "objectivec/GPBWellKnownTypes.m",
894 "objectivec/GPBWireFormat.m",
895 "objectivec/google/protobuf/Any.pbobjc.m",
896 "objectivec/google/protobuf/Api.pbobjc.m",
897 "objectivec/google/protobuf/Duration.pbobjc.m",
898 "objectivec/google/protobuf/Empty.pbobjc.m",
899 "objectivec/google/protobuf/FieldMask.pbobjc.m",
900 "objectivec/google/protobuf/SourceContext.pbobjc.m",
901 "objectivec/google/protobuf/Struct.pbobjc.m",
902 "objectivec/google/protobuf/Timestamp.pbobjc.m",
903 "objectivec/google/protobuf/Type.pbobjc.m",
904 "objectivec/google/protobuf/Wrappers.pbobjc.m",
905]
906
907objc_library(
908 name = "objectivec",
909 hdrs = OBJC_HDRS + OBJC_PRIVATE_HDRS,
910 includes = [
911 "objectivec",
912 ],
913 non_arc_srcs = OBJC_SRCS,
914 visibility = ["//visibility:public"],
915)