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