Laszlo Csomor | 5517168 | 2017-12-01 12:05:32 +0100 | [diff] [blame] | 1 | # Bazel (https://bazel.build/) BUILD file for Protobuf. |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 2 | |
| 3 | licenses(["notice"]) |
| 4 | |
Piotr Sikora | faea19c | 2016-08-04 15:32:14 -0700 | [diff] [blame] | 5 | exports_files(["LICENSE"]) |
| 6 | |
Jorge Canizales | d5d7bb3 | 2015-06-28 15:23:02 -0700 | [diff] [blame] | 7 | ################################################################################ |
David Ostrovsky | 85b488f | 2018-01-31 09:01:27 +0100 | [diff] [blame] | 8 | # Java 9 configuration |
| 9 | ################################################################################ |
| 10 | |
| 11 | config_setting( |
| 12 | name = "jdk9", |
| 13 | values = { |
| 14 | "java_toolchain": "@bazel_tools//tools/jdk:toolchain_jdk9", |
| 15 | }, |
| 16 | ) |
| 17 | |
| 18 | ################################################################################ |
Cody Schroeder | 802d543 | 2018-12-11 11:58:26 -0800 | [diff] [blame] | 19 | # ZLIB configuration |
| 20 | ################################################################################ |
| 21 | |
| 22 | ZLIB_DEPS = ["//external:zlib"] |
| 23 | |
| 24 | ################################################################################ |
Jorge Canizales | d5d7bb3 | 2015-06-28 15:23:02 -0700 | [diff] [blame] | 25 | # Protobuf Runtime Library |
| 26 | ################################################################################ |
| 27 | |
Pascal Muetschard | a6957f2 | 2018-03-22 13:14:10 -0700 | [diff] [blame] | 28 | MSVC_COPTS = [ |
Yun Peng | 0b059a3 | 2017-05-31 14:01:23 +0200 | [diff] [blame] | 29 | "/DHAVE_PTHREAD", |
| 30 | "/wd4018", # -Wno-sign-compare |
Loo Rong Jie | 0456e26 | 2018-06-06 10:03:25 +0800 | [diff] [blame] | 31 | "/wd4065", # switch statement contains 'default' but no 'case' labels |
| 32 | "/wd4146", # unary minus operator applied to unsigned type, result still unsigned |
| 33 | "/wd4244", # 'conversion' conversion from 'type1' to 'type2', possible loss of data |
| 34 | "/wd4251", # 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2' |
| 35 | "/wd4267", # 'var' : conversion from 'size_t' to 'type', possible loss of data |
| 36 | "/wd4305", # 'identifier' : truncation from 'type1' to 'type2' |
| 37 | "/wd4307", # 'operator' : integral constant overflow |
| 38 | "/wd4309", # 'conversion' : truncation of constant value |
| 39 | "/wd4334", # 'operator' : result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?) |
| 40 | "/wd4355", # 'this' : used in base member initializer list |
| 41 | "/wd4506", # no definition for inline function 'function' |
Yun Peng | 0b059a3 | 2017-05-31 14:01:23 +0200 | [diff] [blame] | 42 | "/wd4514", # -Wno-unused-function |
Loo Rong Jie | 0456e26 | 2018-06-06 10:03:25 +0800 | [diff] [blame] | 43 | "/wd4800", # 'type' : forcing value to bool 'true' or 'false' (performance warning) |
| 44 | "/wd4996", # The compiler encountered a deprecated declaration. |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 45 | ] |
| 46 | |
Yun Peng | 0b059a3 | 2017-05-31 14:01:23 +0200 | [diff] [blame] | 47 | COPTS = select({ |
Pascal Muetschard | a6957f2 | 2018-03-22 13:14:10 -0700 | [diff] [blame] | 48 | ":msvc" : MSVC_COPTS, |
Yun Peng | 0b059a3 | 2017-05-31 14:01:23 +0200 | [diff] [blame] | 49 | "//conditions:default": [ |
| 50 | "-DHAVE_PTHREAD", |
Cody Schroeder | 802d543 | 2018-12-11 11:58:26 -0800 | [diff] [blame] | 51 | "-DHAVE_ZLIB", |
Yun Peng | 0b059a3 | 2017-05-31 14:01:23 +0200 | [diff] [blame] | 52 | "-Wall", |
Yun Peng | 0b059a3 | 2017-05-31 14:01:23 +0200 | [diff] [blame] | 53 | "-Woverloaded-virtual", |
| 54 | "-Wno-sign-compare", |
| 55 | "-Wno-unused-function", |
Justine Tunney | ac5371d | 2017-11-17 18:27:39 -0800 | [diff] [blame] | 56 | # Prevents ISO C++ const string assignment warnings for pyext sources. |
| 57 | "-Wno-writable-strings", |
depristo | 2506cf5 | 2018-06-28 22:54:43 +0000 | [diff] [blame] | 58 | "-Wno-write-strings", |
Yun Peng | 0b059a3 | 2017-05-31 14:01:23 +0200 | [diff] [blame] | 59 | ], |
| 60 | }) |
| 61 | |
scentini | b30ddee | 2018-08-28 14:07:55 +0200 | [diff] [blame] | 62 | load(":compiler_config_setting.bzl", "create_compiler_config_setting") |
| 63 | |
| 64 | create_compiler_config_setting(name = "msvc", value = "msvc-cl") |
Yun Peng | 0b059a3 | 2017-05-31 14:01:23 +0200 | [diff] [blame] | 65 | |
Andrew Harp | b56b461 | 2016-04-04 15:13:30 -0400 | [diff] [blame] | 66 | config_setting( |
| 67 | name = "android", |
| 68 | values = { |
| 69 | "crosstool_top": "//external:android/crosstool", |
| 70 | }, |
| 71 | ) |
| 72 | |
Pascal Muetschard | a6957f2 | 2018-03-22 13:14:10 -0700 | [diff] [blame] | 73 | # Android and MSVC builds do not need to link in a separate pthread library. |
Andrew Harp | b56b461 | 2016-04-04 15:13:30 -0400 | [diff] [blame] | 74 | LINK_OPTS = select({ |
Andrew Harp | 3b4e7dc | 2016-04-04 16:13:31 -0400 | [diff] [blame] | 75 | ":android": [], |
Jan Tattermusch | ccc56a3 | 2018-05-24 09:51:53 -0700 | [diff] [blame] | 76 | ":msvc": [ |
Loo Rong Jie | 0456e26 | 2018-06-06 10:03:25 +0800 | [diff] [blame] | 77 | # Suppress linker warnings about files with no symbols defined. |
| 78 | "-ignore:4221", |
Laszlo Csomor | 5517168 | 2017-12-01 12:05:32 +0100 | [diff] [blame] | 79 | ], |
Daniel Ylitalo | 32fa55e | 2017-01-25 22:04:11 +0100 | [diff] [blame] | 80 | "//conditions:default": ["-lpthread", "-lm"], |
Andrew Harp | b56b461 | 2016-04-04 15:13:30 -0400 | [diff] [blame] | 81 | }) |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 82 | |
Jisi Liu | 04658a3 | 2015-10-20 15:00:13 -0700 | [diff] [blame] | 83 | load( |
cgrushko | 65a4d20 | 2017-02-08 15:23:57 -0500 | [diff] [blame] | 84 | ":protobuf.bzl", |
Jisi Liu | 04658a3 | 2015-10-20 15:00:13 -0700 | [diff] [blame] | 85 | "cc_proto_library", |
| 86 | "py_proto_library", |
David Z. Chen | 02cd45c | 2016-05-20 16:49:04 -0700 | [diff] [blame] | 87 | "internal_copied_filegroup", |
Steven Parkes | ea18866 | 2016-02-25 07:53:19 -0800 | [diff] [blame] | 88 | "internal_gen_well_known_protos_java", |
Jisi Liu | 04658a3 | 2015-10-20 15:00:13 -0700 | [diff] [blame] | 89 | "internal_protobuf_py_tests", |
| 90 | ) |
Jisi Liu | 39362b3 | 2015-10-14 17:12:11 -0700 | [diff] [blame] | 91 | |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 92 | cc_library( |
| 93 | name = "protobuf_lite", |
| 94 | srcs = [ |
| 95 | # AUTOGEN(protobuf_lite_srcs) |
| 96 | "src/google/protobuf/arena.cc", |
| 97 | "src/google/protobuf/arenastring.cc", |
| 98 | "src/google/protobuf/extension_set.cc", |
Jisi Liu | 12c186f | 2017-07-25 14:38:00 -0700 | [diff] [blame] | 99 | "src/google/protobuf/generated_message_table_driven_lite.cc", |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 100 | "src/google/protobuf/generated_message_util.cc", |
Adam Cozzette | 609d752 | 2017-12-07 14:16:50 -0800 | [diff] [blame] | 101 | "src/google/protobuf/implicit_weak_message.cc", |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 102 | "src/google/protobuf/io/coded_stream.cc", |
| 103 | "src/google/protobuf/io/zero_copy_stream.cc", |
| 104 | "src/google/protobuf/io/zero_copy_stream_impl_lite.cc", |
| 105 | "src/google/protobuf/message_lite.cc", |
| 106 | "src/google/protobuf/repeated_field.cc", |
Jisi Liu | af3eafd | 2015-06-18 13:38:36 -0700 | [diff] [blame] | 107 | "src/google/protobuf/stubs/bytestream.cc", |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 108 | "src/google/protobuf/stubs/common.cc", |
Jisi Liu | b90f9f8 | 2015-08-25 17:06:33 -0700 | [diff] [blame] | 109 | "src/google/protobuf/stubs/int128.cc", |
Jisi Liu | 759245a | 2017-07-25 11:52:33 -0700 | [diff] [blame] | 110 | "src/google/protobuf/stubs/io_win32.cc", |
Jisi Liu | af3eafd | 2015-06-18 13:38:36 -0700 | [diff] [blame] | 111 | "src/google/protobuf/stubs/status.cc", |
| 112 | "src/google/protobuf/stubs/statusor.cc", |
| 113 | "src/google/protobuf/stubs/stringpiece.cc", |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 114 | "src/google/protobuf/stubs/stringprintf.cc", |
Jisi Liu | b90f9f8 | 2015-08-25 17:06:33 -0700 | [diff] [blame] | 115 | "src/google/protobuf/stubs/structurally_valid.cc", |
Jisi Liu | af3eafd | 2015-06-18 13:38:36 -0700 | [diff] [blame] | 116 | "src/google/protobuf/stubs/strutil.cc", |
| 117 | "src/google/protobuf/stubs/time.cc", |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 118 | "src/google/protobuf/wire_format_lite.cc", |
| 119 | ], |
Feng Xiao | bde4eaf | 2018-08-13 12:58:55 -0700 | [diff] [blame] | 120 | hdrs = glob(["src/google/protobuf/**/*.h", "src/google/protobuf/**/*.inc"]), |
Param Reddy | 16792c6 | 2017-10-15 13:06:58 -0700 | [diff] [blame] | 121 | copts = COPTS, |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 122 | includes = ["src/"], |
| 123 | linkopts = LINK_OPTS, |
| 124 | visibility = ["//visibility:public"], |
| 125 | ) |
| 126 | |
Cody Schroeder | 802d543 | 2018-12-11 11:58:26 -0800 | [diff] [blame] | 127 | PROTOBUF_DEPS = select({ |
| 128 | ":msvc": [], |
| 129 | "//conditions:default": ZLIB_DEPS, |
| 130 | }) |
| 131 | |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 132 | cc_library( |
| 133 | name = "protobuf", |
| 134 | srcs = [ |
| 135 | # AUTOGEN(protobuf_srcs) |
| 136 | "src/google/protobuf/any.cc", |
| 137 | "src/google/protobuf/any.pb.cc", |
| 138 | "src/google/protobuf/api.pb.cc", |
| 139 | "src/google/protobuf/compiler/importer.cc", |
| 140 | "src/google/protobuf/compiler/parser.cc", |
| 141 | "src/google/protobuf/descriptor.cc", |
| 142 | "src/google/protobuf/descriptor.pb.cc", |
| 143 | "src/google/protobuf/descriptor_database.cc", |
| 144 | "src/google/protobuf/duration.pb.cc", |
| 145 | "src/google/protobuf/dynamic_message.cc", |
| 146 | "src/google/protobuf/empty.pb.cc", |
| 147 | "src/google/protobuf/extension_set_heavy.cc", |
| 148 | "src/google/protobuf/field_mask.pb.cc", |
| 149 | "src/google/protobuf/generated_message_reflection.cc", |
Jisi Liu | 759245a | 2017-07-25 11:52:33 -0700 | [diff] [blame] | 150 | "src/google/protobuf/generated_message_table_driven.cc", |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 151 | "src/google/protobuf/io/gzip_stream.cc", |
| 152 | "src/google/protobuf/io/printer.cc", |
| 153 | "src/google/protobuf/io/strtod.cc", |
| 154 | "src/google/protobuf/io/tokenizer.cc", |
| 155 | "src/google/protobuf/io/zero_copy_stream_impl.cc", |
| 156 | "src/google/protobuf/map_field.cc", |
| 157 | "src/google/protobuf/message.cc", |
| 158 | "src/google/protobuf/reflection_ops.cc", |
| 159 | "src/google/protobuf/service.cc", |
| 160 | "src/google/protobuf/source_context.pb.cc", |
| 161 | "src/google/protobuf/struct.pb.cc", |
Jisi Liu | af3eafd | 2015-06-18 13:38:36 -0700 | [diff] [blame] | 162 | "src/google/protobuf/stubs/mathlimits.cc", |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 163 | "src/google/protobuf/stubs/substitute.cc", |
| 164 | "src/google/protobuf/text_format.cc", |
| 165 | "src/google/protobuf/timestamp.pb.cc", |
| 166 | "src/google/protobuf/type.pb.cc", |
| 167 | "src/google/protobuf/unknown_field_set.cc", |
Bairen Yi | 312e2db | 2017-03-21 03:52:37 +0800 | [diff] [blame] | 168 | "src/google/protobuf/util/delimited_message_util.cc", |
Jisi Liu | af3eafd | 2015-06-18 13:38:36 -0700 | [diff] [blame] | 169 | "src/google/protobuf/util/field_comparator.cc", |
Jisi Liu | b90f9f8 | 2015-08-25 17:06:33 -0700 | [diff] [blame] | 170 | "src/google/protobuf/util/field_mask_util.cc", |
Jisi Liu | af3eafd | 2015-06-18 13:38:36 -0700 | [diff] [blame] | 171 | "src/google/protobuf/util/internal/datapiece.cc", |
| 172 | "src/google/protobuf/util/internal/default_value_objectwriter.cc", |
| 173 | "src/google/protobuf/util/internal/error_listener.cc", |
| 174 | "src/google/protobuf/util/internal/field_mask_utility.cc", |
| 175 | "src/google/protobuf/util/internal/json_escaping.cc", |
| 176 | "src/google/protobuf/util/internal/json_objectwriter.cc", |
| 177 | "src/google/protobuf/util/internal/json_stream_parser.cc", |
| 178 | "src/google/protobuf/util/internal/object_writer.cc", |
Feng Xiao | ef6c72b | 2015-12-28 17:33:55 -0800 | [diff] [blame] | 179 | "src/google/protobuf/util/internal/proto_writer.cc", |
Jisi Liu | af3eafd | 2015-06-18 13:38:36 -0700 | [diff] [blame] | 180 | "src/google/protobuf/util/internal/protostream_objectsource.cc", |
| 181 | "src/google/protobuf/util/internal/protostream_objectwriter.cc", |
| 182 | "src/google/protobuf/util/internal/type_info.cc", |
| 183 | "src/google/protobuf/util/internal/type_info_test_helper.cc", |
| 184 | "src/google/protobuf/util/internal/utility.cc", |
| 185 | "src/google/protobuf/util/json_util.cc", |
| 186 | "src/google/protobuf/util/message_differencer.cc", |
Jisi Liu | b90f9f8 | 2015-08-25 17:06:33 -0700 | [diff] [blame] | 187 | "src/google/protobuf/util/time_util.cc", |
Jisi Liu | af3eafd | 2015-06-18 13:38:36 -0700 | [diff] [blame] | 188 | "src/google/protobuf/util/type_resolver_util.cc", |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 189 | "src/google/protobuf/wire_format.cc", |
| 190 | "src/google/protobuf/wrappers.pb.cc", |
| 191 | ], |
Feng Xiao | bde4eaf | 2018-08-13 12:58:55 -0700 | [diff] [blame] | 192 | hdrs = glob(["src/**/*.h", "src/**/*.inc"]), |
Param Reddy | 16792c6 | 2017-10-15 13:06:58 -0700 | [diff] [blame] | 193 | copts = COPTS, |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 194 | includes = ["src/"], |
| 195 | linkopts = LINK_OPTS, |
| 196 | visibility = ["//visibility:public"], |
Cody Schroeder | 802d543 | 2018-12-11 11:58:26 -0800 | [diff] [blame] | 197 | deps = [":protobuf_lite"] + PROTOBUF_DEPS, |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 198 | ) |
| 199 | |
Manjunath Kudlur | 6837b2d | 2017-03-02 18:02:05 -0800 | [diff] [blame] | 200 | # This provides just the header files for use in projects that need to build |
| 201 | # shared libraries for dynamic loading. This target is available until Bazel |
| 202 | # adds native support for such use cases. |
| 203 | # TODO(keveman): Remove this target once the support gets added to Bazel. |
Manjunath Kudlur | 2d430f8 | 2017-02-23 08:17:24 -0800 | [diff] [blame] | 204 | cc_library( |
| 205 | name = "protobuf_headers", |
| 206 | hdrs = glob(["src/**/*.h"]), |
| 207 | includes = ["src/"], |
| 208 | visibility = ["//visibility:public"], |
| 209 | ) |
| 210 | |
Jakob Buchgraber | 699c0eb | 2017-09-05 17:15:10 +0200 | [diff] [blame] | 211 | # Map of all well known protos. |
| 212 | # name => (include path, imports) |
| 213 | WELL_KNOWN_PROTO_MAP = { |
| 214 | "any" : ("google/protobuf/any.proto", []), |
| 215 | "api" : ("google/protobuf/api.proto", ["source_context", "type"]), |
| 216 | "compiler_plugin" : ("google/protobuf/compiler/plugin.proto", ["descriptor"]), |
| 217 | "descriptor" : ("google/protobuf/descriptor.proto", []), |
| 218 | "duration" : ("google/protobuf/duration.proto", []), |
| 219 | "empty" : ("google/protobuf/empty.proto", []), |
| 220 | "field_mask" : ("google/protobuf/field_mask.proto", []), |
| 221 | "source_context" : ("google/protobuf/source_context.proto", []), |
| 222 | "struct" : ("google/protobuf/struct.proto", []), |
| 223 | "timestamp" : ("google/protobuf/timestamp.proto", []), |
| 224 | "type" : ("google/protobuf/type.proto", ["any", "source_context"]), |
| 225 | "wrappers" : ("google/protobuf/wrappers.proto", []), |
| 226 | } |
| 227 | |
| 228 | RELATIVE_WELL_KNOWN_PROTOS = [proto[1][0] for proto in WELL_KNOWN_PROTO_MAP.items()] |
Jorge Canizales | d5d7bb3 | 2015-06-28 15:23:02 -0700 | [diff] [blame] | 229 | |
Jisi Liu | 993fb70 | 2015-10-19 17:19:49 -0700 | [diff] [blame] | 230 | WELL_KNOWN_PROTOS = ["src/" + s for s in RELATIVE_WELL_KNOWN_PROTOS] |
| 231 | |
Steven Parkes | d5a5732 | 2016-03-22 17:56:07 -0700 | [diff] [blame] | 232 | filegroup( |
| 233 | name = "well_known_protos", |
| 234 | srcs = WELL_KNOWN_PROTOS, |
| 235 | visibility = ["//visibility:public"], |
| 236 | ) |
| 237 | |
Jisi Liu | 39362b3 | 2015-10-14 17:12:11 -0700 | [diff] [blame] | 238 | cc_proto_library( |
| 239 | name = "cc_wkt_protos", |
Jisi Liu | 993fb70 | 2015-10-19 17:19:49 -0700 | [diff] [blame] | 240 | srcs = WELL_KNOWN_PROTOS, |
Jisi Liu | 3101e73 | 2015-10-16 12:46:26 -0700 | [diff] [blame] | 241 | include = "src", |
Manjunath Kudlur | 3ff1dca | 2015-12-07 13:08:21 -0800 | [diff] [blame] | 242 | default_runtime = ":protobuf", |
Jisi Liu | 993fb70 | 2015-10-19 17:19:49 -0700 | [diff] [blame] | 243 | internal_bootstrap_hack = 1, |
Jisi Liu | 04658a3 | 2015-10-20 15:00:13 -0700 | [diff] [blame] | 244 | protoc = ":protoc", |
Jisi Liu | 6a40bf8 | 2015-11-17 12:36:21 -0800 | [diff] [blame] | 245 | visibility = ["//visibility:public"], |
Jisi Liu | 39362b3 | 2015-10-14 17:12:11 -0700 | [diff] [blame] | 246 | ) |
| 247 | |
Jorge Canizales | d5d7bb3 | 2015-06-28 15:23:02 -0700 | [diff] [blame] | 248 | ################################################################################ |
Jakob Buchgraber | 699c0eb | 2017-09-05 17:15:10 +0200 | [diff] [blame] | 249 | # Well Known Types Proto Library Rules |
| 250 | # |
| 251 | # These proto_library rules can be used with one of the language specific proto |
| 252 | # library rules i.e. java_proto_library: |
| 253 | # |
| 254 | # java_proto_library( |
| 255 | # name = "any_java_proto", |
| 256 | # deps = ["@com_google_protobuf//:any_proto], |
| 257 | # ) |
| 258 | ################################################################################ |
| 259 | |
| 260 | internal_copied_filegroup( |
| 261 | name = "_internal_wkt_protos", |
| 262 | srcs = WELL_KNOWN_PROTOS, |
| 263 | dest = "", |
| 264 | strip_prefix = "src", |
James O'Kane | 950f5e4 | 2018-03-08 22:30:44 -0800 | [diff] [blame] | 265 | visibility = ["//visibility:private"], |
Jakob Buchgraber | 699c0eb | 2017-09-05 17:15:10 +0200 | [diff] [blame] | 266 | ) |
| 267 | |
| 268 | [proto_library( |
| 269 | name = proto[0] + "_proto", |
| 270 | srcs = [proto[1][0]], |
| 271 | deps = [dep + "_proto" for dep in proto[1][1]], |
| 272 | visibility = ["//visibility:public"], |
| 273 | ) for proto in WELL_KNOWN_PROTO_MAP.items()] |
| 274 | |
| 275 | ################################################################################ |
Jorge Canizales | d5d7bb3 | 2015-06-28 15:23:02 -0700 | [diff] [blame] | 276 | # Protocol Buffers Compiler |
| 277 | ################################################################################ |
| 278 | |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 279 | cc_library( |
| 280 | name = "protoc_lib", |
| 281 | srcs = [ |
| 282 | # AUTOGEN(protoc_lib_srcs) |
| 283 | "src/google/protobuf/compiler/code_generator.cc", |
| 284 | "src/google/protobuf/compiler/command_line_interface.cc", |
| 285 | "src/google/protobuf/compiler/cpp/cpp_enum.cc", |
| 286 | "src/google/protobuf/compiler/cpp/cpp_enum_field.cc", |
| 287 | "src/google/protobuf/compiler/cpp/cpp_extension.cc", |
| 288 | "src/google/protobuf/compiler/cpp/cpp_field.cc", |
| 289 | "src/google/protobuf/compiler/cpp/cpp_file.cc", |
| 290 | "src/google/protobuf/compiler/cpp/cpp_generator.cc", |
| 291 | "src/google/protobuf/compiler/cpp/cpp_helpers.cc", |
| 292 | "src/google/protobuf/compiler/cpp/cpp_map_field.cc", |
| 293 | "src/google/protobuf/compiler/cpp/cpp_message.cc", |
| 294 | "src/google/protobuf/compiler/cpp/cpp_message_field.cc", |
Adam Cozzette | 13fd045 | 2017-09-12 10:32:01 -0700 | [diff] [blame] | 295 | "src/google/protobuf/compiler/cpp/cpp_padding_optimizer.cc", |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 296 | "src/google/protobuf/compiler/cpp/cpp_primitive_field.cc", |
| 297 | "src/google/protobuf/compiler/cpp/cpp_service.cc", |
| 298 | "src/google/protobuf/compiler/cpp/cpp_string_field.cc", |
Ming Zhao | 5cdd936 | 2015-10-05 14:37:21 -0700 | [diff] [blame] | 299 | "src/google/protobuf/compiler/csharp/csharp_doc_comment.cc", |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 300 | "src/google/protobuf/compiler/csharp/csharp_enum.cc", |
| 301 | "src/google/protobuf/compiler/csharp/csharp_enum_field.cc", |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 302 | "src/google/protobuf/compiler/csharp/csharp_field_base.cc", |
| 303 | "src/google/protobuf/compiler/csharp/csharp_generator.cc", |
| 304 | "src/google/protobuf/compiler/csharp/csharp_helpers.cc", |
Jon Skeet | b2ac868 | 2015-07-15 13:17:42 +0100 | [diff] [blame] | 305 | "src/google/protobuf/compiler/csharp/csharp_map_field.cc", |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 306 | "src/google/protobuf/compiler/csharp/csharp_message.cc", |
| 307 | "src/google/protobuf/compiler/csharp/csharp_message_field.cc", |
| 308 | "src/google/protobuf/compiler/csharp/csharp_primitive_field.cc", |
Jon Skeet | a6361a1 | 2015-11-19 13:05:17 +0000 | [diff] [blame] | 309 | "src/google/protobuf/compiler/csharp/csharp_reflection_class.cc", |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 310 | "src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc", |
| 311 | "src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc", |
| 312 | "src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc", |
| 313 | "src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc", |
Jon Skeet | b2ac868 | 2015-07-15 13:17:42 +0100 | [diff] [blame] | 314 | "src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc", |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 315 | "src/google/protobuf/compiler/java/java_context.cc", |
| 316 | "src/google/protobuf/compiler/java/java_doc_comment.cc", |
| 317 | "src/google/protobuf/compiler/java/java_enum.cc", |
| 318 | "src/google/protobuf/compiler/java/java_enum_field.cc", |
| 319 | "src/google/protobuf/compiler/java/java_enum_field_lite.cc", |
Jisi Liu | b90f9f8 | 2015-08-25 17:06:33 -0700 | [diff] [blame] | 320 | "src/google/protobuf/compiler/java/java_enum_lite.cc", |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 321 | "src/google/protobuf/compiler/java/java_extension.cc", |
Jisi Liu | 1f4f3e2 | 2016-04-18 14:12:08 -0700 | [diff] [blame] | 322 | "src/google/protobuf/compiler/java/java_extension_lite.cc", |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 323 | "src/google/protobuf/compiler/java/java_field.cc", |
| 324 | "src/google/protobuf/compiler/java/java_file.cc", |
| 325 | "src/google/protobuf/compiler/java/java_generator.cc", |
| 326 | "src/google/protobuf/compiler/java/java_generator_factory.cc", |
| 327 | "src/google/protobuf/compiler/java/java_helpers.cc", |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 328 | "src/google/protobuf/compiler/java/java_map_field.cc", |
| 329 | "src/google/protobuf/compiler/java/java_map_field_lite.cc", |
| 330 | "src/google/protobuf/compiler/java/java_message.cc", |
| 331 | "src/google/protobuf/compiler/java/java_message_builder.cc", |
| 332 | "src/google/protobuf/compiler/java/java_message_builder_lite.cc", |
| 333 | "src/google/protobuf/compiler/java/java_message_field.cc", |
| 334 | "src/google/protobuf/compiler/java/java_message_field_lite.cc", |
| 335 | "src/google/protobuf/compiler/java/java_message_lite.cc", |
| 336 | "src/google/protobuf/compiler/java/java_name_resolver.cc", |
| 337 | "src/google/protobuf/compiler/java/java_primitive_field.cc", |
| 338 | "src/google/protobuf/compiler/java/java_primitive_field_lite.cc", |
| 339 | "src/google/protobuf/compiler/java/java_service.cc", |
| 340 | "src/google/protobuf/compiler/java/java_shared_code_generator.cc", |
| 341 | "src/google/protobuf/compiler/java/java_string_field.cc", |
| 342 | "src/google/protobuf/compiler/java/java_string_field_lite.cc", |
Feng Xiao | ef6c72b | 2015-12-28 17:33:55 -0800 | [diff] [blame] | 343 | "src/google/protobuf/compiler/js/js_generator.cc", |
Jisi Liu | f92b455 | 2016-12-05 10:16:47 -0800 | [diff] [blame] | 344 | "src/google/protobuf/compiler/js/well_known_types_embed.cc", |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 345 | "src/google/protobuf/compiler/objectivec/objectivec_enum.cc", |
| 346 | "src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc", |
| 347 | "src/google/protobuf/compiler/objectivec/objectivec_extension.cc", |
| 348 | "src/google/protobuf/compiler/objectivec/objectivec_field.cc", |
| 349 | "src/google/protobuf/compiler/objectivec/objectivec_file.cc", |
| 350 | "src/google/protobuf/compiler/objectivec/objectivec_generator.cc", |
| 351 | "src/google/protobuf/compiler/objectivec/objectivec_helpers.cc", |
| 352 | "src/google/protobuf/compiler/objectivec/objectivec_map_field.cc", |
| 353 | "src/google/protobuf/compiler/objectivec/objectivec_message.cc", |
| 354 | "src/google/protobuf/compiler/objectivec/objectivec_message_field.cc", |
| 355 | "src/google/protobuf/compiler/objectivec/objectivec_oneof.cc", |
| 356 | "src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc", |
Jisi Liu | d947308 | 2016-09-22 15:14:58 -0700 | [diff] [blame] | 357 | "src/google/protobuf/compiler/php/php_generator.cc", |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 358 | "src/google/protobuf/compiler/plugin.cc", |
Feng Xiao | fd595fc | 2018-03-01 16:36:05 -0800 | [diff] [blame] | 359 | "src/google/protobuf/compiler/plugin.pb.cc", |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 360 | "src/google/protobuf/compiler/python/python_generator.cc", |
| 361 | "src/google/protobuf/compiler/ruby/ruby_generator.cc", |
| 362 | "src/google/protobuf/compiler/subprocess.cc", |
| 363 | "src/google/protobuf/compiler/zip_writer.cc", |
| 364 | ], |
| 365 | copts = COPTS, |
| 366 | includes = ["src/"], |
Loo Rong Jie | 0456e26 | 2018-06-06 10:03:25 +0800 | [diff] [blame] | 367 | linkopts = LINK_OPTS + select({ |
| 368 | ":msvc": [ |
| 369 | # Linking to setargv.obj makes the default command line argument |
| 370 | # parser expand wildcards, so the main method's argv will contain the |
| 371 | # expanded list instead of the wildcards. |
| 372 | # |
| 373 | # Adding dummy "-DEFAULTLIB:kernel32.lib", because: |
| 374 | # - Microsoft ships this object file next to default libraries |
| 375 | # - but this file is not a library, just a precompiled object |
| 376 | # - "-WHOLEARCHIVE" and "-DEFAULTLIB" only accept library, |
| 377 | # not precompiled object. |
| 378 | # - Bazel would assume linkopt that does not start with "-" or "$" |
| 379 | # as a label to a target, so we add a harmless "-DEFAULTLIB:kernel32.lib" |
| 380 | # before "setargv.obj". |
| 381 | # See https://msdn.microsoft.com/en-us/library/8bch7bkk.aspx |
| 382 | "-DEFAULTLIB:kernel32.lib setargv.obj", |
| 383 | ], |
| 384 | "//conditions:default": [], |
| 385 | }), |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 386 | visibility = ["//visibility:public"], |
| 387 | deps = [":protobuf"], |
| 388 | ) |
| 389 | |
| 390 | cc_binary( |
| 391 | name = "protoc", |
| 392 | srcs = ["src/google/protobuf/compiler/main.cc"], |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 393 | linkopts = LINK_OPTS, |
| 394 | visibility = ["//visibility:public"], |
| 395 | deps = [":protoc_lib"], |
| 396 | ) |
| 397 | |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 398 | ################################################################################ |
| 399 | # Tests |
| 400 | ################################################################################ |
| 401 | |
Jisi Liu | 993fb70 | 2015-10-19 17:19:49 -0700 | [diff] [blame] | 402 | RELATIVE_LITE_TEST_PROTOS = [ |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 403 | # AUTOGEN(lite_test_protos) |
| 404 | "google/protobuf/map_lite_unittest.proto", |
| 405 | "google/protobuf/unittest_import_lite.proto", |
| 406 | "google/protobuf/unittest_import_public_lite.proto", |
| 407 | "google/protobuf/unittest_lite.proto", |
Jisi Liu | b90f9f8 | 2015-08-25 17:06:33 -0700 | [diff] [blame] | 408 | "google/protobuf/unittest_no_arena_lite.proto", |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 409 | ] |
| 410 | |
Jisi Liu | 993fb70 | 2015-10-19 17:19:49 -0700 | [diff] [blame] | 411 | LITE_TEST_PROTOS = ["src/" + s for s in RELATIVE_LITE_TEST_PROTOS] |
| 412 | |
| 413 | RELATIVE_TEST_PROTOS = [ |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 414 | # AUTOGEN(test_protos) |
| 415 | "google/protobuf/any_test.proto", |
| 416 | "google/protobuf/compiler/cpp/cpp_test_bad_identifiers.proto", |
| 417 | "google/protobuf/compiler/cpp/cpp_test_large_enum_value.proto", |
| 418 | "google/protobuf/map_proto2_unittest.proto", |
| 419 | "google/protobuf/map_unittest.proto", |
| 420 | "google/protobuf/unittest.proto", |
| 421 | "google/protobuf/unittest_arena.proto", |
| 422 | "google/protobuf/unittest_custom_options.proto", |
| 423 | "google/protobuf/unittest_drop_unknown_fields.proto", |
| 424 | "google/protobuf/unittest_embed_optimize_for.proto", |
| 425 | "google/protobuf/unittest_empty.proto", |
| 426 | "google/protobuf/unittest_enormous_descriptor.proto", |
| 427 | "google/protobuf/unittest_import.proto", |
| 428 | "google/protobuf/unittest_import_public.proto", |
Feng Xiao | 32d7830 | 2017-03-29 14:01:40 -0700 | [diff] [blame] | 429 | "google/protobuf/unittest_lazy_dependencies.proto", |
| 430 | "google/protobuf/unittest_lazy_dependencies_custom_option.proto", |
| 431 | "google/protobuf/unittest_lazy_dependencies_enum.proto", |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 432 | "google/protobuf/unittest_lite_imports_nonlite.proto", |
| 433 | "google/protobuf/unittest_mset.proto", |
Jisi Liu | b90f9f8 | 2015-08-25 17:06:33 -0700 | [diff] [blame] | 434 | "google/protobuf/unittest_mset_wire_format.proto", |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 435 | "google/protobuf/unittest_no_arena.proto", |
| 436 | "google/protobuf/unittest_no_arena_import.proto", |
| 437 | "google/protobuf/unittest_no_field_presence.proto", |
| 438 | "google/protobuf/unittest_no_generic_services.proto", |
| 439 | "google/protobuf/unittest_optimize_for.proto", |
| 440 | "google/protobuf/unittest_preserve_unknown_enum.proto", |
| 441 | "google/protobuf/unittest_preserve_unknown_enum2.proto", |
Feng Xiao | bde4eaf | 2018-08-13 12:58:55 -0700 | [diff] [blame] | 442 | "google/protobuf/unittest_proto3.proto", |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 443 | "google/protobuf/unittest_proto3_arena.proto", |
Chad Whipkey | baf52bd | 2016-04-15 09:23:50 -0700 | [diff] [blame] | 444 | "google/protobuf/unittest_proto3_arena_lite.proto", |
| 445 | "google/protobuf/unittest_proto3_lite.proto", |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 446 | "google/protobuf/unittest_well_known_types.proto", |
Jisi Liu | af3eafd | 2015-06-18 13:38:36 -0700 | [diff] [blame] | 447 | "google/protobuf/util/internal/testdata/anys.proto", |
| 448 | "google/protobuf/util/internal/testdata/books.proto", |
| 449 | "google/protobuf/util/internal/testdata/default_value.proto", |
| 450 | "google/protobuf/util/internal/testdata/default_value_test.proto", |
| 451 | "google/protobuf/util/internal/testdata/field_mask.proto", |
| 452 | "google/protobuf/util/internal/testdata/maps.proto", |
Jisi Liu | b90f9f8 | 2015-08-25 17:06:33 -0700 | [diff] [blame] | 453 | "google/protobuf/util/internal/testdata/oneofs.proto", |
Jisi Liu | 9d4657a | 2016-09-22 15:11:17 -0700 | [diff] [blame] | 454 | "google/protobuf/util/internal/testdata/proto3.proto", |
Jisi Liu | af3eafd | 2015-06-18 13:38:36 -0700 | [diff] [blame] | 455 | "google/protobuf/util/internal/testdata/struct.proto", |
| 456 | "google/protobuf/util/internal/testdata/timestamp_duration.proto", |
Jisi Liu | 9d4657a | 2016-09-22 15:11:17 -0700 | [diff] [blame] | 457 | "google/protobuf/util/internal/testdata/wrappers.proto", |
Feng Xiao | bde4eaf | 2018-08-13 12:58:55 -0700 | [diff] [blame] | 458 | "google/protobuf/util/json_format.proto", |
Jisi Liu | af3eafd | 2015-06-18 13:38:36 -0700 | [diff] [blame] | 459 | "google/protobuf/util/json_format_proto3.proto", |
Feng Xiao | ef6c72b | 2015-12-28 17:33:55 -0800 | [diff] [blame] | 460 | "google/protobuf/util/message_differencer_unittest.proto", |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 461 | ] |
| 462 | |
Jisi Liu | 993fb70 | 2015-10-19 17:19:49 -0700 | [diff] [blame] | 463 | TEST_PROTOS = ["src/" + s for s in RELATIVE_TEST_PROTOS] |
| 464 | |
Jisi Liu | 39362b3 | 2015-10-14 17:12:11 -0700 | [diff] [blame] | 465 | cc_proto_library( |
| 466 | name = "cc_test_protos", |
Jisi Liu | 993fb70 | 2015-10-19 17:19:49 -0700 | [diff] [blame] | 467 | srcs = LITE_TEST_PROTOS + TEST_PROTOS, |
Jisi Liu | 3101e73 | 2015-10-16 12:46:26 -0700 | [diff] [blame] | 468 | include = "src", |
Jisi Liu | be92ffb | 2015-10-27 15:11:38 -0700 | [diff] [blame] | 469 | default_runtime = ":protobuf", |
Manjunath Kudlur | 3ff1dca | 2015-12-07 13:08:21 -0800 | [diff] [blame] | 470 | protoc = ":protoc", |
Jisi Liu | d8701b5 | 2015-10-16 11:44:21 -0700 | [diff] [blame] | 471 | deps = [":cc_wkt_protos"], |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 472 | ) |
| 473 | |
| 474 | COMMON_TEST_SRCS = [ |
| 475 | # AUTOGEN(common_test_srcs) |
| 476 | "src/google/protobuf/arena_test_util.cc", |
| 477 | "src/google/protobuf/map_test_util.cc", |
| 478 | "src/google/protobuf/test_util.cc", |
Adam Cozzette | 5bed368 | 2018-03-23 10:19:04 -0700 | [diff] [blame] | 479 | "src/google/protobuf/test_util.inc", |
Jisi Liu | d19604f | 2015-06-17 17:37:58 -0700 | [diff] [blame] | 480 | "src/google/protobuf/testing/file.cc", |
| 481 | "src/google/protobuf/testing/googletest.cc", |
| 482 | ] |
| 483 | |
Jisi Liu | 7a0c431 | 2015-06-18 16:45:27 -0700 | [diff] [blame] | 484 | cc_binary( |
| 485 | name = "test_plugin", |
| 486 | srcs = [ |
| 487 | # AUTOGEN(test_plugin_srcs) |
| 488 | "src/google/protobuf/compiler/mock_code_generator.cc", |
| 489 | "src/google/protobuf/compiler/test_plugin.cc", |
| 490 | "src/google/protobuf/testing/file.cc", |
| 491 | ], |
| 492 | deps = [ |
| 493 | ":protobuf", |
| 494 | ":protoc_lib", |
| 495 | "//external:gtest", |
| 496 | ], |
| 497 | ) |
| 498 | |
| 499 | cc_test( |
Jisi Liu | 759245a | 2017-07-25 11:52:33 -0700 | [diff] [blame] | 500 | name = "win32_test", |
| 501 | srcs = ["src/google/protobuf/stubs/io_win32_unittest.cc"], |
| 502 | deps = [ |
| 503 | ":protobuf_lite", |
| 504 | "//external:gtest_main", |
| 505 | ], |
| 506 | tags = ["manual", "windows"], |
| 507 | ) |
| 508 | |
| 509 | cc_test( |
Jisi Liu | 7a0c431 | 2015-06-18 16:45:27 -0700 | [diff] [blame] | 510 | name = "protobuf_test", |
Jisi Liu | 39362b3 | 2015-10-14 17:12:11 -0700 | [diff] [blame] | 511 | srcs = COMMON_TEST_SRCS + [ |
Jisi Liu | 7a0c431 | 2015-06-18 16:45:27 -0700 | [diff] [blame] | 512 | # AUTOGEN(test_srcs) |
| 513 | "src/google/protobuf/any_test.cc", |
| 514 | "src/google/protobuf/arena_unittest.cc", |
| 515 | "src/google/protobuf/arenastring_unittest.cc", |
Jisi Liu | 1c682e0 | 2017-10-18 14:31:23 -0700 | [diff] [blame] | 516 | "src/google/protobuf/compiler/annotation_test_util.cc", |
Jisi Liu | 7a0c431 | 2015-06-18 16:45:27 -0700 | [diff] [blame] | 517 | "src/google/protobuf/compiler/command_line_interface_unittest.cc", |
| 518 | "src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc", |
Jisi Liu | 11b6661 | 2017-07-19 12:10:43 -0700 | [diff] [blame] | 519 | "src/google/protobuf/compiler/cpp/cpp_move_unittest.cc", |
Jisi Liu | 7a0c431 | 2015-06-18 16:45:27 -0700 | [diff] [blame] | 520 | "src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc", |
| 521 | "src/google/protobuf/compiler/cpp/cpp_unittest.cc", |
Adam Cozzette | 5bed368 | 2018-03-23 10:19:04 -0700 | [diff] [blame] | 522 | "src/google/protobuf/compiler/cpp/cpp_unittest.inc", |
Jisi Liu | 1f4f3e2 | 2016-04-18 14:12:08 -0700 | [diff] [blame] | 523 | "src/google/protobuf/compiler/cpp/metadata_test.cc", |
Feng Xiao | 32d7830 | 2017-03-29 14:01:40 -0700 | [diff] [blame] | 524 | "src/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc", |
Jisi Liu | 7a0c431 | 2015-06-18 16:45:27 -0700 | [diff] [blame] | 525 | "src/google/protobuf/compiler/csharp/csharp_generator_unittest.cc", |
| 526 | "src/google/protobuf/compiler/importer_unittest.cc", |
| 527 | "src/google/protobuf/compiler/java/java_doc_comment_unittest.cc", |
| 528 | "src/google/protobuf/compiler/java/java_plugin_unittest.cc", |
| 529 | "src/google/protobuf/compiler/mock_code_generator.cc", |
| 530 | "src/google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc", |
| 531 | "src/google/protobuf/compiler/parser_unittest.cc", |
| 532 | "src/google/protobuf/compiler/python/python_plugin_unittest.cc", |
| 533 | "src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc", |
| 534 | "src/google/protobuf/descriptor_database_unittest.cc", |
| 535 | "src/google/protobuf/descriptor_unittest.cc", |
| 536 | "src/google/protobuf/drop_unknown_fields_test.cc", |
| 537 | "src/google/protobuf/dynamic_message_unittest.cc", |
| 538 | "src/google/protobuf/extension_set_unittest.cc", |
| 539 | "src/google/protobuf/generated_message_reflection_unittest.cc", |
| 540 | "src/google/protobuf/io/coded_stream_unittest.cc", |
| 541 | "src/google/protobuf/io/printer_unittest.cc", |
| 542 | "src/google/protobuf/io/tokenizer_unittest.cc", |
| 543 | "src/google/protobuf/io/zero_copy_stream_unittest.cc", |
| 544 | "src/google/protobuf/map_field_test.cc", |
| 545 | "src/google/protobuf/map_test.cc", |
| 546 | "src/google/protobuf/message_unittest.cc", |
Adam Cozzette | 5bed368 | 2018-03-23 10:19:04 -0700 | [diff] [blame] | 547 | "src/google/protobuf/message_unittest.inc", |
Jisi Liu | 7a0c431 | 2015-06-18 16:45:27 -0700 | [diff] [blame] | 548 | "src/google/protobuf/no_field_presence_test.cc", |
| 549 | "src/google/protobuf/preserve_unknown_enum_test.cc", |
Chad Whipkey | baf52bd | 2016-04-15 09:23:50 -0700 | [diff] [blame] | 550 | "src/google/protobuf/proto3_arena_lite_unittest.cc", |
Jisi Liu | f86d39c | 2016-04-28 14:43:22 -0700 | [diff] [blame] | 551 | "src/google/protobuf/proto3_arena_unittest.cc", |
Chad Whipkey | baf52bd | 2016-04-15 09:23:50 -0700 | [diff] [blame] | 552 | "src/google/protobuf/proto3_lite_unittest.cc", |
Feng Xiao | bde4eaf | 2018-08-13 12:58:55 -0700 | [diff] [blame] | 553 | "src/google/protobuf/proto3_lite_unittest.inc", |
Jisi Liu | 7a0c431 | 2015-06-18 16:45:27 -0700 | [diff] [blame] | 554 | "src/google/protobuf/reflection_ops_unittest.cc", |
| 555 | "src/google/protobuf/repeated_field_reflection_unittest.cc", |
| 556 | "src/google/protobuf/repeated_field_unittest.cc", |
| 557 | "src/google/protobuf/stubs/bytestream_unittest.cc", |
| 558 | "src/google/protobuf/stubs/common_unittest.cc", |
Jisi Liu | b90f9f8 | 2015-08-25 17:06:33 -0700 | [diff] [blame] | 559 | "src/google/protobuf/stubs/int128_unittest.cc", |
Jisi Liu | 759245a | 2017-07-25 11:52:33 -0700 | [diff] [blame] | 560 | "src/google/protobuf/stubs/io_win32_unittest.cc", |
Jisi Liu | 7a0c431 | 2015-06-18 16:45:27 -0700 | [diff] [blame] | 561 | "src/google/protobuf/stubs/status_test.cc", |
| 562 | "src/google/protobuf/stubs/statusor_test.cc", |
| 563 | "src/google/protobuf/stubs/stringpiece_unittest.cc", |
| 564 | "src/google/protobuf/stubs/stringprintf_unittest.cc", |
| 565 | "src/google/protobuf/stubs/structurally_valid_unittest.cc", |
| 566 | "src/google/protobuf/stubs/strutil_unittest.cc", |
| 567 | "src/google/protobuf/stubs/template_util_unittest.cc", |
| 568 | "src/google/protobuf/stubs/time_test.cc", |
Jisi Liu | 7a0c431 | 2015-06-18 16:45:27 -0700 | [diff] [blame] | 569 | "src/google/protobuf/text_format_unittest.cc", |
| 570 | "src/google/protobuf/unknown_field_set_unittest.cc", |
Byron Yi | cb3e84b | 2017-03-16 20:01:22 +0800 | [diff] [blame] | 571 | "src/google/protobuf/util/delimited_message_util_test.cc", |
Jisi Liu | 7a0c431 | 2015-06-18 16:45:27 -0700 | [diff] [blame] | 572 | "src/google/protobuf/util/field_comparator_test.cc", |
Jisi Liu | b90f9f8 | 2015-08-25 17:06:33 -0700 | [diff] [blame] | 573 | "src/google/protobuf/util/field_mask_util_test.cc", |
Jisi Liu | 7a0c431 | 2015-06-18 16:45:27 -0700 | [diff] [blame] | 574 | "src/google/protobuf/util/internal/default_value_objectwriter_test.cc", |
| 575 | "src/google/protobuf/util/internal/json_objectwriter_test.cc", |
| 576 | "src/google/protobuf/util/internal/json_stream_parser_test.cc", |
| 577 | "src/google/protobuf/util/internal/protostream_objectsource_test.cc", |
| 578 | "src/google/protobuf/util/internal/protostream_objectwriter_test.cc", |
| 579 | "src/google/protobuf/util/internal/type_info_test_helper.cc", |
| 580 | "src/google/protobuf/util/json_util_test.cc", |
Feng Xiao | ef6c72b | 2015-12-28 17:33:55 -0800 | [diff] [blame] | 581 | "src/google/protobuf/util/message_differencer_unittest.cc", |
Jisi Liu | b90f9f8 | 2015-08-25 17:06:33 -0700 | [diff] [blame] | 582 | "src/google/protobuf/util/time_util_test.cc", |
Jisi Liu | 7a0c431 | 2015-06-18 16:45:27 -0700 | [diff] [blame] | 583 | "src/google/protobuf/util/type_resolver_util_test.cc", |
| 584 | "src/google/protobuf/well_known_types_unittest.cc", |
| 585 | "src/google/protobuf/wire_format_unittest.cc", |
| 586 | ], |
| 587 | copts = COPTS, |
| 588 | data = [ |
| 589 | ":test_plugin", |
Jisi Liu | 598480d | 2015-10-21 11:19:16 -0700 | [diff] [blame] | 590 | ] + glob([ |
| 591 | "src/google/protobuf/**/*", |
Feng Xiao | acde165 | 2017-03-29 15:14:18 -0700 | [diff] [blame] | 592 | # Files for csharp_bootstrap_unittest.cc. |
| 593 | "conformance/**/*", |
| 594 | "csharp/src/**/*", |
Jisi Liu | 598480d | 2015-10-21 11:19:16 -0700 | [diff] [blame] | 595 | ]), |
Jisi Liu | 7a0c431 | 2015-06-18 16:45:27 -0700 | [diff] [blame] | 596 | includes = [ |
| 597 | "src/", |
| 598 | ], |
| 599 | linkopts = LINK_OPTS, |
| 600 | deps = [ |
Jisi Liu | 993fb70 | 2015-10-19 17:19:49 -0700 | [diff] [blame] | 601 | ":cc_test_protos", |
Jisi Liu | 7a0c431 | 2015-06-18 16:45:27 -0700 | [diff] [blame] | 602 | ":protobuf", |
| 603 | ":protoc_lib", |
| 604 | "//external:gtest_main", |
Cody Schroeder | 802d543 | 2018-12-11 11:58:26 -0800 | [diff] [blame] | 605 | ] + PROTOBUF_DEPS, |
Jisi Liu | 7a0c431 | 2015-06-18 16:45:27 -0700 | [diff] [blame] | 606 | ) |
Jisi Liu | 993fb70 | 2015-10-19 17:19:49 -0700 | [diff] [blame] | 607 | |
| 608 | ################################################################################ |
| 609 | # Java support |
| 610 | ################################################################################ |
Steven Parkes | ea18866 | 2016-02-25 07:53:19 -0800 | [diff] [blame] | 611 | internal_gen_well_known_protos_java( |
Ming Zhao | 4fe0381 | 2016-01-21 23:03:28 -0800 | [diff] [blame] | 612 | srcs = WELL_KNOWN_PROTOS, |
Jisi Liu | 993fb70 | 2015-10-19 17:19:49 -0700 | [diff] [blame] | 613 | ) |
| 614 | |
| 615 | java_library( |
Jisi Liu | 166e9bb | 2015-10-21 10:56:38 -0700 | [diff] [blame] | 616 | name = "protobuf_java", |
Jisi Liu | 993fb70 | 2015-10-19 17:19:49 -0700 | [diff] [blame] | 617 | srcs = glob([ |
Ming Zhao | 4fe0381 | 2016-01-21 23:03:28 -0800 | [diff] [blame] | 618 | "java/core/src/main/java/com/google/protobuf/*.java", |
Jisi Liu | 993fb70 | 2015-10-19 17:19:49 -0700 | [diff] [blame] | 619 | ]) + [ |
Ming Zhao | 4fe0381 | 2016-01-21 23:03:28 -0800 | [diff] [blame] | 620 | ":gen_well_known_protos_java", |
Jisi Liu | 993fb70 | 2015-10-19 17:19:49 -0700 | [diff] [blame] | 621 | ], |
David Ostrovsky | 85b488f | 2018-01-31 09:01:27 +0100 | [diff] [blame] | 622 | javacopts = select({ |
| 623 | "//:jdk9": ["--add-modules=jdk.unsupported"], |
| 624 | "//conditions:default": ["-source 7", "-target 7"], |
| 625 | }), |
Jisi Liu | 993fb70 | 2015-10-19 17:19:49 -0700 | [diff] [blame] | 626 | visibility = ["//visibility:public"], |
| 627 | ) |
| 628 | |
Steven Parkes | a9244ca | 2016-03-10 17:50:25 -0800 | [diff] [blame] | 629 | java_library( |
| 630 | name = "protobuf_java_util", |
| 631 | srcs = glob([ |
| 632 | "java/util/src/main/java/com/google/protobuf/util/*.java", |
| 633 | ]), |
David Ostrovsky | 019ceea | 2018-01-25 06:05:14 +0100 | [diff] [blame] | 634 | javacopts = ["-source 7", "-target 7"], |
Manjunath Kudlur | 2d430f8 | 2017-02-23 08:17:24 -0800 | [diff] [blame] | 635 | visibility = ["//visibility:public"], |
Steven Parkes | a9244ca | 2016-03-10 17:50:25 -0800 | [diff] [blame] | 636 | deps = [ |
David Z. Chen | 5ebeefb | 2016-04-08 13:30:13 -0700 | [diff] [blame] | 637 | "protobuf_java", |
| 638 | "//external:gson", |
| 639 | "//external:guava", |
Steven Parkes | a9244ca | 2016-03-10 17:50:25 -0800 | [diff] [blame] | 640 | ], |
Steven Parkes | a9244ca | 2016-03-10 17:50:25 -0800 | [diff] [blame] | 641 | ) |
| 642 | |
Jisi Liu | 993fb70 | 2015-10-19 17:19:49 -0700 | [diff] [blame] | 643 | ################################################################################ |
| 644 | # Python support |
| 645 | ################################################################################ |
| 646 | |
David Z. Chen | 985c968 | 2016-02-11 18:11:10 -0800 | [diff] [blame] | 647 | py_library( |
Jisi Liu | 993fb70 | 2015-10-19 17:19:49 -0700 | [diff] [blame] | 648 | name = "python_srcs", |
| 649 | srcs = glob( |
| 650 | [ |
Calder Coalson | 142cbe0 | 2018-05-21 15:33:43 -0700 | [diff] [blame] | 651 | "python/google/__init__.py", |
Jisi Liu | 993fb70 | 2015-10-19 17:19:49 -0700 | [diff] [blame] | 652 | "python/google/protobuf/*.py", |
| 653 | "python/google/protobuf/**/*.py", |
| 654 | ], |
| 655 | exclude = [ |
David Z. Chen | 02cd45c | 2016-05-20 16:49:04 -0700 | [diff] [blame] | 656 | "python/google/protobuf/__init__.py", |
| 657 | "python/google/protobuf/**/__init__.py", |
Jisi Liu | 993fb70 | 2015-10-19 17:19:49 -0700 | [diff] [blame] | 658 | "python/google/protobuf/internal/*_test.py", |
| 659 | "python/google/protobuf/internal/test_util.py", |
| 660 | ], |
| 661 | ), |
David Z. Chen | 985c968 | 2016-02-11 18:11:10 -0800 | [diff] [blame] | 662 | imports = ["python"], |
Manjunath Kudlur | 2d430f8 | 2017-02-23 08:17:24 -0800 | [diff] [blame] | 663 | srcs_version = "PY2AND3", |
Jisi Liu | 993fb70 | 2015-10-19 17:19:49 -0700 | [diff] [blame] | 664 | ) |
| 665 | |
Manjunath Kudlur | 3ff1dca | 2015-12-07 13:08:21 -0800 | [diff] [blame] | 666 | cc_binary( |
Richard Shin | df5841f | 2016-10-18 13:16:44 -0700 | [diff] [blame] | 667 | name = "python/google/protobuf/internal/_api_implementation.so", |
Manjunath Kudlur | 3ff1dca | 2015-12-07 13:08:21 -0800 | [diff] [blame] | 668 | srcs = ["python/google/protobuf/internal/api_implementation.cc"], |
| 669 | copts = COPTS + [ |
Manjunath Kudlur | 3ff1dca | 2015-12-07 13:08:21 -0800 | [diff] [blame] | 670 | "-DPYTHON_PROTO2_CPP_IMPL_V2", |
| 671 | ], |
| 672 | linkshared = 1, |
| 673 | linkstatic = 1, |
Manjunath Kudlur | a194921 | 2015-12-08 08:24:37 -0800 | [diff] [blame] | 674 | deps = select({ |
| 675 | "//conditions:default": [], |
David Z. Chen | 985c968 | 2016-02-11 18:11:10 -0800 | [diff] [blame] | 676 | ":use_fast_cpp_protos": ["//external:python_headers"], |
Manjunath Kudlur | a194921 | 2015-12-08 08:24:37 -0800 | [diff] [blame] | 677 | }), |
Manjunath Kudlur | 3ff1dca | 2015-12-07 13:08:21 -0800 | [diff] [blame] | 678 | ) |
| 679 | |
| 680 | cc_binary( |
Richard Shin | df5841f | 2016-10-18 13:16:44 -0700 | [diff] [blame] | 681 | name = "python/google/protobuf/pyext/_message.so", |
Manjunath Kudlur | 3ff1dca | 2015-12-07 13:08:21 -0800 | [diff] [blame] | 682 | srcs = glob([ |
| 683 | "python/google/protobuf/pyext/*.cc", |
| 684 | "python/google/protobuf/pyext/*.h", |
| 685 | ]), |
| 686 | copts = COPTS + [ |
| 687 | "-DGOOGLE_PROTOBUF_HAS_ONEOF=1", |
Manjunath Kudlur | 99a3e30 | 2016-02-16 15:17:10 -0800 | [diff] [blame] | 688 | ] + select({ |
| 689 | "//conditions:default": [], |
| 690 | ":allow_oversize_protos": ["-DPROTOBUF_PYTHON_ALLOW_OVERSIZE_PROTOS=1"], |
| 691 | }), |
Manjunath Kudlur | 3ff1dca | 2015-12-07 13:08:21 -0800 | [diff] [blame] | 692 | includes = [ |
| 693 | "python/", |
| 694 | "src/", |
| 695 | ], |
| 696 | linkshared = 1, |
| 697 | linkstatic = 1, |
Manjunath Kudlur | a194921 | 2015-12-08 08:24:37 -0800 | [diff] [blame] | 698 | deps = [ |
| 699 | ":protobuf", |
Thomas Colthurst | 7c65142 | 2018-05-29 18:26:11 -0400 | [diff] [blame] | 700 | ":proto_api", |
Manjunath Kudlur | a194921 | 2015-12-08 08:24:37 -0800 | [diff] [blame] | 701 | ] + select({ |
| 702 | "//conditions:default": [], |
David Z. Chen | 985c968 | 2016-02-11 18:11:10 -0800 | [diff] [blame] | 703 | ":use_fast_cpp_protos": ["//external:python_headers"], |
Manjunath Kudlur | a194921 | 2015-12-08 08:24:37 -0800 | [diff] [blame] | 704 | }), |
| 705 | ) |
| 706 | |
| 707 | config_setting( |
| 708 | name = "use_fast_cpp_protos", |
| 709 | values = { |
| 710 | "define": "use_fast_cpp_protos=true", |
| 711 | }, |
Manjunath Kudlur | 3ff1dca | 2015-12-07 13:08:21 -0800 | [diff] [blame] | 712 | ) |
| 713 | |
Manjunath Kudlur | 99a3e30 | 2016-02-16 15:17:10 -0800 | [diff] [blame] | 714 | config_setting( |
| 715 | name = "allow_oversize_protos", |
| 716 | values = { |
| 717 | "define": "allow_oversize_protos=true", |
| 718 | }, |
| 719 | ) |
| 720 | |
David Z. Chen | 02cd45c | 2016-05-20 16:49:04 -0700 | [diff] [blame] | 721 | # Copy the builtin proto files from src/google/protobuf to |
| 722 | # python/google/protobuf. This way, the generated Python sources will be in the |
| 723 | # same directory as the Python runtime sources. This is necessary for the |
| 724 | # modules to be imported correctly since they are all part of the same Python |
| 725 | # package. |
| 726 | internal_copied_filegroup( |
| 727 | name = "protos_python", |
| 728 | srcs = WELL_KNOWN_PROTOS, |
David Z. Chen | 02cd45c | 2016-05-20 16:49:04 -0700 | [diff] [blame] | 729 | dest = "python", |
Manjunath Kudlur | 2d430f8 | 2017-02-23 08:17:24 -0800 | [diff] [blame] | 730 | strip_prefix = "src", |
David Z. Chen | 02cd45c | 2016-05-20 16:49:04 -0700 | [diff] [blame] | 731 | ) |
| 732 | |
| 733 | # TODO(dzc): Remove this once py_proto_library can have labels in srcs, in |
| 734 | # which case we can simply add :protos_python in srcs. |
| 735 | COPIED_WELL_KNOWN_PROTOS = ["python/" + s for s in RELATIVE_WELL_KNOWN_PROTOS] |
| 736 | |
Jisi Liu | 993fb70 | 2015-10-19 17:19:49 -0700 | [diff] [blame] | 737 | py_proto_library( |
Jisi Liu | 166e9bb | 2015-10-21 10:56:38 -0700 | [diff] [blame] | 738 | name = "protobuf_python", |
David Z. Chen | 02cd45c | 2016-05-20 16:49:04 -0700 | [diff] [blame] | 739 | srcs = COPIED_WELL_KNOWN_PROTOS, |
| 740 | include = "python", |
Manjunath Kudlur | a194921 | 2015-12-08 08:24:37 -0800 | [diff] [blame] | 741 | data = select({ |
| 742 | "//conditions:default": [], |
| 743 | ":use_fast_cpp_protos": [ |
Richard Shin | df5841f | 2016-10-18 13:16:44 -0700 | [diff] [blame] | 744 | ":python/google/protobuf/internal/_api_implementation.so", |
| 745 | ":python/google/protobuf/pyext/_message.so", |
Manjunath Kudlur | a194921 | 2015-12-08 08:24:37 -0800 | [diff] [blame] | 746 | ], |
| 747 | }), |
Manjunath Kudlur | 3ff1dca | 2015-12-07 13:08:21 -0800 | [diff] [blame] | 748 | default_runtime = "", |
Jisi Liu | 04658a3 | 2015-10-20 15:00:13 -0700 | [diff] [blame] | 749 | protoc = ":protoc", |
David Z. Chen | 985c968 | 2016-02-11 18:11:10 -0800 | [diff] [blame] | 750 | py_libs = [ |
| 751 | ":python_srcs", |
Manjunath Kudlur | 2d430f8 | 2017-02-23 08:17:24 -0800 | [diff] [blame] | 752 | "//external:six", |
David Z. Chen | 985c968 | 2016-02-11 18:11:10 -0800 | [diff] [blame] | 753 | ], |
Adam Michael | 6044b24 | 2017-03-10 18:06:34 -0500 | [diff] [blame] | 754 | py_extra_srcs = glob(["python/**/__init__.py"]), |
Manjunath Kudlur | 3ff1dca | 2015-12-07 13:08:21 -0800 | [diff] [blame] | 755 | srcs_version = "PY2AND3", |
Jisi Liu | 993fb70 | 2015-10-19 17:19:49 -0700 | [diff] [blame] | 756 | visibility = ["//visibility:public"], |
| 757 | ) |
| 758 | |
David Z. Chen | 02cd45c | 2016-05-20 16:49:04 -0700 | [diff] [blame] | 759 | # Copy the test proto files from src/google/protobuf to |
| 760 | # python/google/protobuf. This way, the generated Python sources will be in the |
| 761 | # same directory as the Python runtime sources. This is necessary for the |
| 762 | # modules to be imported correctly by the tests since they are all part of the |
| 763 | # same Python package. |
| 764 | internal_copied_filegroup( |
| 765 | name = "protos_python_test", |
| 766 | srcs = LITE_TEST_PROTOS + TEST_PROTOS, |
David Z. Chen | 02cd45c | 2016-05-20 16:49:04 -0700 | [diff] [blame] | 767 | dest = "python", |
Manjunath Kudlur | 2d430f8 | 2017-02-23 08:17:24 -0800 | [diff] [blame] | 768 | strip_prefix = "src", |
David Z. Chen | 02cd45c | 2016-05-20 16:49:04 -0700 | [diff] [blame] | 769 | ) |
| 770 | |
| 771 | # TODO(dzc): Remove this once py_proto_library can have labels in srcs, in |
| 772 | # which case we can simply add :protos_python_test in srcs. |
| 773 | COPIED_LITE_TEST_PROTOS = ["python/" + s for s in RELATIVE_LITE_TEST_PROTOS] |
Manjunath Kudlur | 2d430f8 | 2017-02-23 08:17:24 -0800 | [diff] [blame] | 774 | |
David Z. Chen | 02cd45c | 2016-05-20 16:49:04 -0700 | [diff] [blame] | 775 | COPIED_TEST_PROTOS = ["python/" + s for s in RELATIVE_TEST_PROTOS] |
| 776 | |
Jisi Liu | 993fb70 | 2015-10-19 17:19:49 -0700 | [diff] [blame] | 777 | py_proto_library( |
| 778 | name = "python_common_test_protos", |
David Z. Chen | 02cd45c | 2016-05-20 16:49:04 -0700 | [diff] [blame] | 779 | srcs = COPIED_LITE_TEST_PROTOS + COPIED_TEST_PROTOS, |
| 780 | include = "python", |
Manjunath Kudlur | 3ff1dca | 2015-12-07 13:08:21 -0800 | [diff] [blame] | 781 | default_runtime = "", |
Jisi Liu | 04658a3 | 2015-10-20 15:00:13 -0700 | [diff] [blame] | 782 | protoc = ":protoc", |
David Z. Chen | 5ebeefb | 2016-04-08 13:30:13 -0700 | [diff] [blame] | 783 | srcs_version = "PY2AND3", |
Jisi Liu | 166e9bb | 2015-10-21 10:56:38 -0700 | [diff] [blame] | 784 | deps = [":protobuf_python"], |
Jisi Liu | 993fb70 | 2015-10-19 17:19:49 -0700 | [diff] [blame] | 785 | ) |
| 786 | |
| 787 | py_proto_library( |
| 788 | name = "python_specific_test_protos", |
Jisi Liu | 68e13f4 | 2015-10-22 11:13:14 -0700 | [diff] [blame] | 789 | srcs = glob([ |
| 790 | "python/google/protobuf/internal/*.proto", |
| 791 | "python/google/protobuf/internal/import_test_package/*.proto", |
| 792 | ]), |
Jisi Liu | 993fb70 | 2015-10-19 17:19:49 -0700 | [diff] [blame] | 793 | include = "python", |
Manjunath Kudlur | 3ff1dca | 2015-12-07 13:08:21 -0800 | [diff] [blame] | 794 | default_runtime = ":protobuf_python", |
Jisi Liu | 04658a3 | 2015-10-20 15:00:13 -0700 | [diff] [blame] | 795 | protoc = ":protoc", |
David Z. Chen | 5ebeefb | 2016-04-08 13:30:13 -0700 | [diff] [blame] | 796 | srcs_version = "PY2AND3", |
Jisi Liu | 993fb70 | 2015-10-19 17:19:49 -0700 | [diff] [blame] | 797 | deps = [":python_common_test_protos"], |
| 798 | ) |
| 799 | |
| 800 | py_library( |
| 801 | name = "python_tests", |
David Z. Chen | 985c968 | 2016-02-11 18:11:10 -0800 | [diff] [blame] | 802 | srcs = glob( |
| 803 | [ |
| 804 | "python/google/protobuf/internal/*_test.py", |
| 805 | "python/google/protobuf/internal/test_util.py", |
David Z. Chen | 02cd45c | 2016-05-20 16:49:04 -0700 | [diff] [blame] | 806 | "python/google/protobuf/internal/import_test_package/__init__.py", |
David Z. Chen | 985c968 | 2016-02-11 18:11:10 -0800 | [diff] [blame] | 807 | ], |
| 808 | ), |
| 809 | imports = ["python"], |
Geoffrey Irving | 2979923 | 2015-12-03 13:11:19 -0800 | [diff] [blame] | 810 | srcs_version = "PY2AND3", |
Jisi Liu | 993fb70 | 2015-10-19 17:19:49 -0700 | [diff] [blame] | 811 | deps = [ |
Jisi Liu | 166e9bb | 2015-10-21 10:56:38 -0700 | [diff] [blame] | 812 | ":protobuf_python", |
Jisi Liu | 598480d | 2015-10-21 11:19:16 -0700 | [diff] [blame] | 813 | ":python_common_test_protos", |
Jisi Liu | 993fb70 | 2015-10-19 17:19:49 -0700 | [diff] [blame] | 814 | ":python_specific_test_protos", |
| 815 | ], |
| 816 | ) |
| 817 | |
| 818 | internal_protobuf_py_tests( |
Jisi Liu | 8f54026 | 2015-10-20 16:21:41 -0700 | [diff] [blame] | 819 | name = "python_tests_batch", |
Jisi Liu | 68e13f4 | 2015-10-22 11:13:14 -0700 | [diff] [blame] | 820 | data = glob([ |
| 821 | "src/google/protobuf/**/*", |
| 822 | ]), |
Jisi Liu | 993fb70 | 2015-10-19 17:19:49 -0700 | [diff] [blame] | 823 | modules = [ |
| 824 | "descriptor_database_test", |
| 825 | "descriptor_pool_test", |
| 826 | "descriptor_test", |
| 827 | "generator_test", |
| 828 | "json_format_test", |
| 829 | "message_factory_test", |
Jisi Liu | 68e13f4 | 2015-10-22 11:13:14 -0700 | [diff] [blame] | 830 | "message_test", |
Jisi Liu | 993fb70 | 2015-10-19 17:19:49 -0700 | [diff] [blame] | 831 | "proto_builder_test", |
Jisi Liu | 68e13f4 | 2015-10-22 11:13:14 -0700 | [diff] [blame] | 832 | "reflection_test", |
Jisi Liu | 993fb70 | 2015-10-19 17:19:49 -0700 | [diff] [blame] | 833 | "service_reflection_test", |
| 834 | "symbol_database_test", |
| 835 | "text_encoding_test", |
Jisi Liu | 68e13f4 | 2015-10-22 11:13:14 -0700 | [diff] [blame] | 836 | "text_format_test", |
Jisi Liu | 993fb70 | 2015-10-19 17:19:49 -0700 | [diff] [blame] | 837 | "unknown_fields_test", |
| 838 | "wire_format_test", |
| 839 | ], |
| 840 | deps = [":python_tests"], |
| 841 | ) |
cgrushko | 45d92ae | 2016-12-02 19:40:50 -0500 | [diff] [blame] | 842 | |
Thomas Colthurst | 7c65142 | 2018-05-29 18:26:11 -0400 | [diff] [blame] | 843 | cc_library( |
| 844 | name = "proto_api", |
| 845 | hdrs = ["python/google/protobuf/proto_api.h"], |
| 846 | deps = [ |
Thomas Colthurst | 7c65142 | 2018-05-29 18:26:11 -0400 | [diff] [blame] | 847 | "//external:python_headers", |
| 848 | ], |
Cory McLean | b7d3ec3 | 2018-06-11 12:18:45 -0400 | [diff] [blame] | 849 | visibility = ["//visibility:public"], |
Thomas Colthurst | 7c65142 | 2018-05-29 18:26:11 -0400 | [diff] [blame] | 850 | ) |
| 851 | |
cgrushko | 45d92ae | 2016-12-02 19:40:50 -0500 | [diff] [blame] | 852 | proto_lang_toolchain( |
Manjunath Kudlur | 2d430f8 | 2017-02-23 08:17:24 -0800 | [diff] [blame] | 853 | name = "cc_toolchain", |
| 854 | command_line = "--cpp_out=$(OUT)", |
| 855 | runtime = ":protobuf", |
| 856 | visibility = ["//visibility:public"], |
John Millikin | 350b135 | 2018-02-24 11:36:49 -0800 | [diff] [blame] | 857 | blacklisted_protos = [":_internal_wkt_protos_genrule"], |
cgrushko | 45d92ae | 2016-12-02 19:40:50 -0500 | [diff] [blame] | 858 | ) |
cgrushko | e4baf3f | 2017-01-12 12:51:04 -0500 | [diff] [blame] | 859 | |
| 860 | proto_lang_toolchain( |
| 861 | name = "java_toolchain", |
| 862 | command_line = "--java_out=$(OUT)", |
| 863 | runtime = ":protobuf_java", |
| 864 | visibility = ["//visibility:public"], |
| 865 | ) |
makdharma | 286f059 | 2017-05-01 09:49:26 -0700 | [diff] [blame] | 866 | |
Thomas Van Lenten | 18aa296 | 2018-11-01 09:37:14 -0400 | [diff] [blame] | 867 | alias( |
| 868 | name = "objectivec", |
| 869 | actual = ":protobuf_objc", |
| 870 | visibility = ["//visibility:public"], |
| 871 | ) |
makdharma | 286f059 | 2017-05-01 09:49:26 -0700 | [diff] [blame] | 872 | |
| 873 | objc_library( |
Thomas Van Lenten | 18aa296 | 2018-11-01 09:37:14 -0400 | [diff] [blame] | 874 | name = "protobuf_objc", |
| 875 | hdrs = [ |
| 876 | "objectivec/GPBArray.h", |
| 877 | "objectivec/GPBBootstrap.h", |
| 878 | "objectivec/GPBCodedInputStream.h", |
| 879 | "objectivec/GPBCodedOutputStream.h", |
| 880 | "objectivec/GPBDescriptor.h", |
| 881 | "objectivec/GPBDictionary.h", |
| 882 | "objectivec/GPBExtensionInternals.h", |
| 883 | "objectivec/GPBExtensionRegistry.h", |
| 884 | "objectivec/GPBMessage.h", |
| 885 | "objectivec/GPBProtocolBuffers.h", |
| 886 | "objectivec/GPBProtocolBuffers_RuntimeSupport.h", |
| 887 | "objectivec/GPBRootObject.h", |
| 888 | "objectivec/GPBRuntimeTypes.h", |
| 889 | "objectivec/GPBUnknownField.h", |
| 890 | "objectivec/GPBUnknownFieldSet.h", |
| 891 | "objectivec/GPBUtilities.h", |
| 892 | "objectivec/GPBWellKnownTypes.h", |
| 893 | "objectivec/GPBWireFormat.h", |
| 894 | "objectivec/google/protobuf/Any.pbobjc.h", |
| 895 | "objectivec/google/protobuf/Api.pbobjc.h", |
| 896 | "objectivec/google/protobuf/Duration.pbobjc.h", |
| 897 | "objectivec/google/protobuf/Empty.pbobjc.h", |
| 898 | "objectivec/google/protobuf/FieldMask.pbobjc.h", |
| 899 | "objectivec/google/protobuf/SourceContext.pbobjc.h", |
| 900 | "objectivec/google/protobuf/Struct.pbobjc.h", |
| 901 | "objectivec/google/protobuf/Timestamp.pbobjc.h", |
| 902 | "objectivec/google/protobuf/Type.pbobjc.h", |
| 903 | "objectivec/google/protobuf/Wrappers.pbobjc.h", |
| 904 | # Package private headers, but exposed because the generated sources |
| 905 | # need to use them. |
| 906 | "objectivec/GPBArray_PackagePrivate.h", |
| 907 | "objectivec/GPBCodedInputStream_PackagePrivate.h", |
| 908 | "objectivec/GPBCodedOutputStream_PackagePrivate.h", |
| 909 | "objectivec/GPBDescriptor_PackagePrivate.h", |
| 910 | "objectivec/GPBDictionary_PackagePrivate.h", |
| 911 | "objectivec/GPBMessage_PackagePrivate.h", |
| 912 | "objectivec/GPBRootObject_PackagePrivate.h", |
| 913 | "objectivec/GPBUnknownFieldSet_PackagePrivate.h", |
| 914 | "objectivec/GPBUnknownField_PackagePrivate.h", |
| 915 | "objectivec/GPBUtilities_PackagePrivate.h", |
| 916 | ], |
Benjamin Barenblat | 048f5c2 | 2018-07-11 13:20:01 -0400 | [diff] [blame] | 917 | copts = [ |
| 918 | "-Wno-vla", |
| 919 | ], |
makdharma | 286f059 | 2017-05-01 09:49:26 -0700 | [diff] [blame] | 920 | includes = [ |
| 921 | "objectivec", |
| 922 | ], |
Thomas Van Lenten | 18aa296 | 2018-11-01 09:37:14 -0400 | [diff] [blame] | 923 | non_arc_srcs = [ |
| 924 | "objectivec/GPBArray.m", |
| 925 | "objectivec/GPBCodedInputStream.m", |
| 926 | "objectivec/GPBCodedOutputStream.m", |
| 927 | "objectivec/GPBDescriptor.m", |
| 928 | "objectivec/GPBDictionary.m", |
| 929 | "objectivec/GPBExtensionInternals.m", |
| 930 | "objectivec/GPBExtensionRegistry.m", |
| 931 | "objectivec/GPBMessage.m", |
| 932 | "objectivec/GPBRootObject.m", |
| 933 | "objectivec/GPBUnknownField.m", |
| 934 | "objectivec/GPBUnknownFieldSet.m", |
| 935 | "objectivec/GPBUtilities.m", |
| 936 | "objectivec/GPBWellKnownTypes.m", |
| 937 | "objectivec/GPBWireFormat.m", |
| 938 | "objectivec/google/protobuf/Any.pbobjc.m", |
| 939 | "objectivec/google/protobuf/Api.pbobjc.m", |
| 940 | "objectivec/google/protobuf/Duration.pbobjc.m", |
| 941 | "objectivec/google/protobuf/Empty.pbobjc.m", |
| 942 | "objectivec/google/protobuf/FieldMask.pbobjc.m", |
| 943 | "objectivec/google/protobuf/SourceContext.pbobjc.m", |
| 944 | "objectivec/google/protobuf/Struct.pbobjc.m", |
| 945 | "objectivec/google/protobuf/Timestamp.pbobjc.m", |
| 946 | "objectivec/google/protobuf/Type.pbobjc.m", |
| 947 | "objectivec/google/protobuf/Wrappers.pbobjc.m", |
| 948 | ], |
makdharma | 286f059 | 2017-05-01 09:49:26 -0700 | [diff] [blame] | 949 | visibility = ["//visibility:public"], |
| 950 | ) |
Fahrzin Hemmati | 0d68b29 | 2018-03-26 19:08:26 -0700 | [diff] [blame] | 951 | |
| 952 | ################################################################################ |
| 953 | # Test generated proto support |
| 954 | ################################################################################ |
| 955 | |
| 956 | genrule( |
| 957 | name = "generated_protos", |
| 958 | srcs = ["src/google/protobuf/unittest_import.proto"], |
| 959 | outs = ["unittest_gen.proto"], |
| 960 | cmd = "cat $(SRCS) | sed 's|google/|src/google/|' > $(OUTS)" |
| 961 | ) |
| 962 | |
| 963 | proto_library( |
| 964 | name = "generated_protos_proto", |
Fahrzin Hemmati | 55962db | 2018-05-07 17:36:34 -0700 | [diff] [blame] | 965 | srcs = [ |
| 966 | "unittest_gen.proto", |
| 967 | "src/google/protobuf/unittest_import_public.proto", |
| 968 | ], |
Fahrzin Hemmati | 0d68b29 | 2018-03-26 19:08:26 -0700 | [diff] [blame] | 969 | ) |
| 970 | |
Fahrzin Hemmati | 0d68b29 | 2018-03-26 19:08:26 -0700 | [diff] [blame] | 971 | py_proto_library( |
| 972 | name = "generated_protos_py", |
| 973 | srcs = [ |
| 974 | "unittest_gen.proto", |
| 975 | "src/google/protobuf/unittest_import_public.proto", |
| 976 | ], |
| 977 | default_runtime = "", |
| 978 | protoc = ":protoc", |
| 979 | ) |