aboutsummaryrefslogtreecommitdiffhomepage
path: root/third_party/protobuf
diff options
context:
space:
mode:
authorGravatar Alex Humesky <ahumesky@google.com>2016-09-29 20:19:15 +0000
committerGravatar Yun Peng <pcloudy@google.com>2016-09-30 08:14:30 +0000
commitb35fe6960f6a7eea73221913dd90e72f5cb9a191 (patch)
tree9a0d976991825e1bbe6c55f4246e88f2da9e2e6c /third_party/protobuf
parent542f87a1f3693c85e2547ebe93c44fa2c85bab5c (diff)
*** Reason for rollback *** Windows protoc compiler fixed: https://github.com/bazelbuild/bazel/issues/1856 *** Original change description *** Automated [] rollback of commit a12aae73ee292fdcb170f4eaeb8939283d05383c. *** Reason for rollback *** Breaks Bazel Windows Bootstrap Fix https://github.com/bazelbuild/bazel/issues/1851 *** Original change description *** Updates protobuf in bazel to version 3.0.0. -- MOS_MIGRATED_REVID=134699683
Diffstat (limited to 'third_party/protobuf')
-rw-r--r--third_party/protobuf/3.0.0/BUILD312
-rw-r--r--third_party/protobuf/BUILD288
-rw-r--r--third_party/protobuf/README.md29
-rw-r--r--third_party/protobuf/proto_alias.bzl18
4 files changed, 362 insertions, 285 deletions
diff --git a/third_party/protobuf/3.0.0/BUILD b/third_party/protobuf/3.0.0/BUILD
new file mode 100644
index 0000000000..f5c37596d8
--- /dev/null
+++ b/third_party/protobuf/3.0.0/BUILD
@@ -0,0 +1,312 @@
+package(default_visibility = ["//visibility:public"])
+
+licenses(["notice"])
+
+load("//third_party/protobuf:protobuf.bzl", "py_proto_library")
+
+filegroup(
+ name = "srcs",
+ srcs = glob(
+ [
+ "**",
+ "protobuf.bzl",
+ "python/google/protobuf/**/*.py",
+ "src/google/protobuf/**/*.proto",
+ ],
+ ),
+ visibility = ["//third_party/protobuf:__pkg__"],
+)
+
+filegroup(
+ name = "protoc",
+ srcs = select({
+ # protoc-windows-x86_64.exe can't deal with long path(length > 260),
+ # so use protoc-mingw.exe instead.
+ "//third_party:windows_mingw": ["protoc-3.0.0-mingw.exe"],
+ "//third_party:windows_msys64_mingw64": ["protoc-3.0.0-mingw.exe"],
+ "//third_party:windows_msys64": ["protoc-3.0.0-mingw.exe"],
+ "//third_party:windows_clang": ["protoc-3.0.0-mingw.exe"],
+ "//third_party:darwin": ["protoc-3.0.0-osx-x86_32.exe"],
+ "//third_party:k8": ["protoc-3.0.0-linux-x86_64.exe"],
+ "//third_party:piii": ["protoc-3.0.0-linux-x86_32.exe"],
+ "//third_party:freebsd": ["protoc-3.0.0-linux-x86_32.exe"],
+ }),
+)
+
+java_import(
+ name = "protobuf",
+ jars = ["protobuf-java-3.0.0.jar"],
+)
+
+# For bootstrapping JavaBuilder
+filegroup(
+ name = "protobuf-jars",
+ srcs = ["protobuf-java-3.0.0.jar"],
+)
+
+################################################################################
+# The following rules are based on the build rules in protobuf's BUILD files.
+################################################################################
+
+py_library(
+ name = "python_srcs",
+ srcs = glob(
+ [
+ "python/google/protobuf/*.py",
+ "python/google/protobuf/**/*.py",
+ ],
+ exclude = [
+ "python/google/protobuf/__init__.py",
+ "python/google/protobuf/**/__init__.py",
+ "python/google/protobuf/internal/*_test.py",
+ "python/google/protobuf/internal/test_util.py",
+ ],
+ ),
+ imports = ["python"],
+ srcs_version = "PY2AND3",
+)
+
+py_proto_library(
+ name = "protobuf_python",
+ srcs = [
+ "src/google/protobuf/any.proto",
+ "src/google/protobuf/api.proto",
+ "src/google/protobuf/compiler/plugin.proto",
+ "src/google/protobuf/descriptor.proto",
+ "src/google/protobuf/duration.proto",
+ "src/google/protobuf/empty.proto",
+ "src/google/protobuf/field_mask.proto",
+ "src/google/protobuf/source_context.proto",
+ "src/google/protobuf/struct.proto",
+ "src/google/protobuf/timestamp.proto",
+ "src/google/protobuf/type.proto",
+ "src/google/protobuf/wrappers.proto",
+ ],
+ include = "src",
+ default_runtime = "",
+ protoc = ":protoc",
+ py_libs = [
+ ":protobuf_python_srcs",
+ "//third_party/py/six",
+ ],
+ srcs_version = "PY2AND3",
+)
+
+COPTS = [
+ "-DHAVE_PTHREAD",
+ "-Wall",
+ "-Wwrite-strings",
+ "-Woverloaded-virtual",
+ "-Wno-sign-compare",
+ "-Wno-error=unused-function",
+ "-Wno-error=unused-variable",
+]
+
+LINK_OPTS = ["-lpthread"]
+
+cc_library(
+ name = "protobuf_lite",
+ srcs = [
+ # AUTOGEN(protobuf_lite_srcs)
+ "src/google/protobuf/arena.cc",
+ "src/google/protobuf/arenastring.cc",
+ "src/google/protobuf/extension_set.cc",
+ "src/google/protobuf/generated_message_util.cc",
+ "src/google/protobuf/io/coded_stream.cc",
+ "src/google/protobuf/io/zero_copy_stream.cc",
+ "src/google/protobuf/io/zero_copy_stream_impl_lite.cc",
+ "src/google/protobuf/message_lite.cc",
+ "src/google/protobuf/repeated_field.cc",
+ "src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc",
+ "src/google/protobuf/stubs/atomicops_internals_x86_msvc.cc",
+ "src/google/protobuf/stubs/bytestream.cc",
+ "src/google/protobuf/stubs/common.cc",
+ "src/google/protobuf/stubs/int128.cc",
+ "src/google/protobuf/stubs/once.cc",
+ "src/google/protobuf/stubs/status.cc",
+ "src/google/protobuf/stubs/statusor.cc",
+ "src/google/protobuf/stubs/stringpiece.cc",
+ "src/google/protobuf/stubs/stringprintf.cc",
+ "src/google/protobuf/stubs/structurally_valid.cc",
+ "src/google/protobuf/stubs/strutil.cc",
+ "src/google/protobuf/stubs/time.cc",
+ "src/google/protobuf/wire_format_lite.cc",
+ ],
+ hdrs = glob(["src/google/protobuf/**/*.h"]),
+ copts = COPTS,
+ includes = ["src/"],
+ linkopts = LINK_OPTS,
+ visibility = ["//visibility:public"],
+)
+
+# This is named just "protobuf" in protobuf's BUILD file, but it is renamed here
+# to "protobuf_clib" to avoid conflicting with the java_import named "protobuf"
+# above.
+cc_library(
+ name = "protobuf_clib",
+ srcs = [
+ # AUTOGEN(protobuf_srcs)
+ "src/google/protobuf/any.cc",
+ "src/google/protobuf/any.pb.cc",
+ "src/google/protobuf/api.pb.cc",
+ "src/google/protobuf/compiler/importer.cc",
+ "src/google/protobuf/compiler/parser.cc",
+ "src/google/protobuf/descriptor.cc",
+ "src/google/protobuf/descriptor.pb.cc",
+ "src/google/protobuf/descriptor_database.cc",
+ "src/google/protobuf/duration.pb.cc",
+ "src/google/protobuf/dynamic_message.cc",
+ "src/google/protobuf/empty.pb.cc",
+ "src/google/protobuf/extension_set_heavy.cc",
+ "src/google/protobuf/field_mask.pb.cc",
+ "src/google/protobuf/generated_message_reflection.cc",
+ "src/google/protobuf/io/gzip_stream.cc",
+ "src/google/protobuf/io/printer.cc",
+ "src/google/protobuf/io/strtod.cc",
+ "src/google/protobuf/io/tokenizer.cc",
+ "src/google/protobuf/io/zero_copy_stream_impl.cc",
+ "src/google/protobuf/map_field.cc",
+ "src/google/protobuf/message.cc",
+ "src/google/protobuf/reflection_ops.cc",
+ "src/google/protobuf/service.cc",
+ "src/google/protobuf/source_context.pb.cc",
+ "src/google/protobuf/struct.pb.cc",
+ "src/google/protobuf/stubs/mathlimits.cc",
+ "src/google/protobuf/stubs/substitute.cc",
+ "src/google/protobuf/text_format.cc",
+ "src/google/protobuf/timestamp.pb.cc",
+ "src/google/protobuf/type.pb.cc",
+ "src/google/protobuf/unknown_field_set.cc",
+ "src/google/protobuf/util/field_comparator.cc",
+ "src/google/protobuf/util/field_mask_util.cc",
+ "src/google/protobuf/util/internal/datapiece.cc",
+ "src/google/protobuf/util/internal/default_value_objectwriter.cc",
+ "src/google/protobuf/util/internal/error_listener.cc",
+ "src/google/protobuf/util/internal/field_mask_utility.cc",
+ "src/google/protobuf/util/internal/json_escaping.cc",
+ "src/google/protobuf/util/internal/json_objectwriter.cc",
+ "src/google/protobuf/util/internal/json_stream_parser.cc",
+ "src/google/protobuf/util/internal/object_writer.cc",
+ "src/google/protobuf/util/internal/proto_writer.cc",
+ "src/google/protobuf/util/internal/protostream_objectsource.cc",
+ "src/google/protobuf/util/internal/protostream_objectwriter.cc",
+ "src/google/protobuf/util/internal/type_info.cc",
+ "src/google/protobuf/util/internal/type_info_test_helper.cc",
+ "src/google/protobuf/util/internal/utility.cc",
+ "src/google/protobuf/util/json_util.cc",
+ "src/google/protobuf/util/message_differencer.cc",
+ "src/google/protobuf/util/time_util.cc",
+ "src/google/protobuf/util/type_resolver_util.cc",
+ "src/google/protobuf/wire_format.cc",
+ "src/google/protobuf/wrappers.pb.cc",
+ ],
+ hdrs = glob(["src/**/*.h"]),
+ copts = COPTS,
+ includes = ["src/"],
+ linkopts = LINK_OPTS,
+ visibility = ["//visibility:public"],
+ deps = [":protobuf_lite"],
+)
+
+cc_library(
+ name = "protoc_lib",
+ srcs = [
+ # AUTOGEN(protoc_lib_srcs)
+ "src/google/protobuf/compiler/code_generator.cc",
+ "src/google/protobuf/compiler/command_line_interface.cc",
+ "src/google/protobuf/compiler/cpp/cpp_enum.cc",
+ "src/google/protobuf/compiler/cpp/cpp_enum_field.cc",
+ "src/google/protobuf/compiler/cpp/cpp_extension.cc",
+ "src/google/protobuf/compiler/cpp/cpp_field.cc",
+ "src/google/protobuf/compiler/cpp/cpp_file.cc",
+ "src/google/protobuf/compiler/cpp/cpp_generator.cc",
+ "src/google/protobuf/compiler/cpp/cpp_helpers.cc",
+ "src/google/protobuf/compiler/cpp/cpp_map_field.cc",
+ "src/google/protobuf/compiler/cpp/cpp_message.cc",
+ "src/google/protobuf/compiler/cpp/cpp_message_field.cc",
+ "src/google/protobuf/compiler/cpp/cpp_primitive_field.cc",
+ "src/google/protobuf/compiler/cpp/cpp_service.cc",
+ "src/google/protobuf/compiler/cpp/cpp_string_field.cc",
+ "src/google/protobuf/compiler/csharp/csharp_doc_comment.cc",
+ "src/google/protobuf/compiler/csharp/csharp_enum.cc",
+ "src/google/protobuf/compiler/csharp/csharp_enum_field.cc",
+ "src/google/protobuf/compiler/csharp/csharp_field_base.cc",
+ "src/google/protobuf/compiler/csharp/csharp_generator.cc",
+ "src/google/protobuf/compiler/csharp/csharp_helpers.cc",
+ "src/google/protobuf/compiler/csharp/csharp_map_field.cc",
+ "src/google/protobuf/compiler/csharp/csharp_message.cc",
+ "src/google/protobuf/compiler/csharp/csharp_message_field.cc",
+ "src/google/protobuf/compiler/csharp/csharp_primitive_field.cc",
+ "src/google/protobuf/compiler/csharp/csharp_reflection_class.cc",
+ "src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc",
+ "src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc",
+ "src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc",
+ "src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc",
+ "src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc",
+ "src/google/protobuf/compiler/java/java_context.cc",
+ "src/google/protobuf/compiler/java/java_doc_comment.cc",
+ "src/google/protobuf/compiler/java/java_enum.cc",
+ "src/google/protobuf/compiler/java/java_enum_field.cc",
+ "src/google/protobuf/compiler/java/java_enum_field_lite.cc",
+ "src/google/protobuf/compiler/java/java_enum_lite.cc",
+ "src/google/protobuf/compiler/java/java_extension.cc",
+ "src/google/protobuf/compiler/java/java_extension_lite.cc",
+ "src/google/protobuf/compiler/java/java_field.cc",
+ "src/google/protobuf/compiler/java/java_file.cc",
+ "src/google/protobuf/compiler/java/java_generator.cc",
+ "src/google/protobuf/compiler/java/java_generator_factory.cc",
+ "src/google/protobuf/compiler/java/java_helpers.cc",
+ "src/google/protobuf/compiler/java/java_lazy_message_field.cc",
+ "src/google/protobuf/compiler/java/java_lazy_message_field_lite.cc",
+ "src/google/protobuf/compiler/java/java_map_field.cc",
+ "src/google/protobuf/compiler/java/java_map_field_lite.cc",
+ "src/google/protobuf/compiler/java/java_message.cc",
+ "src/google/protobuf/compiler/java/java_message_builder.cc",
+ "src/google/protobuf/compiler/java/java_message_builder_lite.cc",
+ "src/google/protobuf/compiler/java/java_message_field.cc",
+ "src/google/protobuf/compiler/java/java_message_field_lite.cc",
+ "src/google/protobuf/compiler/java/java_message_lite.cc",
+ "src/google/protobuf/compiler/java/java_name_resolver.cc",
+ "src/google/protobuf/compiler/java/java_primitive_field.cc",
+ "src/google/protobuf/compiler/java/java_primitive_field_lite.cc",
+ "src/google/protobuf/compiler/java/java_service.cc",
+ "src/google/protobuf/compiler/java/java_shared_code_generator.cc",
+ "src/google/protobuf/compiler/java/java_string_field.cc",
+ "src/google/protobuf/compiler/java/java_string_field_lite.cc",
+ "src/google/protobuf/compiler/javanano/javanano_enum.cc",
+ "src/google/protobuf/compiler/javanano/javanano_enum_field.cc",
+ "src/google/protobuf/compiler/javanano/javanano_extension.cc",
+ "src/google/protobuf/compiler/javanano/javanano_field.cc",
+ "src/google/protobuf/compiler/javanano/javanano_file.cc",
+ "src/google/protobuf/compiler/javanano/javanano_generator.cc",
+ "src/google/protobuf/compiler/javanano/javanano_helpers.cc",
+ "src/google/protobuf/compiler/javanano/javanano_map_field.cc",
+ "src/google/protobuf/compiler/javanano/javanano_message.cc",
+ "src/google/protobuf/compiler/javanano/javanano_message_field.cc",
+ "src/google/protobuf/compiler/javanano/javanano_primitive_field.cc",
+ "src/google/protobuf/compiler/js/js_generator.cc",
+ "src/google/protobuf/compiler/objectivec/objectivec_enum.cc",
+ "src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc",
+ "src/google/protobuf/compiler/objectivec/objectivec_extension.cc",
+ "src/google/protobuf/compiler/objectivec/objectivec_field.cc",
+ "src/google/protobuf/compiler/objectivec/objectivec_file.cc",
+ "src/google/protobuf/compiler/objectivec/objectivec_generator.cc",
+ "src/google/protobuf/compiler/objectivec/objectivec_helpers.cc",
+ "src/google/protobuf/compiler/objectivec/objectivec_map_field.cc",
+ "src/google/protobuf/compiler/objectivec/objectivec_message.cc",
+ "src/google/protobuf/compiler/objectivec/objectivec_message_field.cc",
+ "src/google/protobuf/compiler/objectivec/objectivec_oneof.cc",
+ "src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc",
+ "src/google/protobuf/compiler/plugin.cc",
+ "src/google/protobuf/compiler/plugin.pb.cc",
+ "src/google/protobuf/compiler/python/python_generator.cc",
+ "src/google/protobuf/compiler/ruby/ruby_generator.cc",
+ "src/google/protobuf/compiler/subprocess.cc",
+ "src/google/protobuf/compiler/zip_writer.cc",
+ ],
+ copts = COPTS,
+ includes = ["src/"],
+ linkopts = LINK_OPTS,
+ visibility = ["//visibility:public"],
+ deps = [":protobuf_clib"],
+)
diff --git a/third_party/protobuf/BUILD b/third_party/protobuf/BUILD
index 203fe51ec2..0f39107b93 100644
--- a/third_party/protobuf/BUILD
+++ b/third_party/protobuf/BUILD
@@ -2,290 +2,30 @@ package(default_visibility = ["//visibility:public"])
licenses(["notice"])
-load("//third_party/protobuf:protobuf.bzl", "py_proto_library")
+load(":proto_alias.bzl", "proto_alias")
+
+PROTOBUF_VERSION = "3.0.0"
filegroup(
name = "srcs",
- srcs = glob(
- [
- "**",
- "protobuf.bzl",
- "python/google/protobuf/**/*.py",
- "src/google/protobuf/**/*.proto",
- ],
- ),
+ srcs = [
+ "//third_party/protobuf/" + PROTOBUF_VERSION + ":srcs",
+ ] + glob(["**"]), # glob everything to satisfy the compile.sh srcs test
visibility = ["//third_party:__pkg__"],
)
-filegroup(
- name = "protoc",
- srcs = select({
- # protoc-windows-x86_64.exe can't deal with long path(length > 260), change to protoc-mingw.exe.
- "//third_party:windows_mingw": ["protoc-mingw.exe"],
- "//third_party:windows_msys64_mingw64": ["protoc-mingw.exe"],
- "//third_party:windows_msys64": ["protoc-mingw.exe"],
- "//third_party:windows_clang": ["protoc-mingw.exe"],
- "//third_party:darwin": ["protoc-osx-x86_32.exe"],
- "//third_party:k8": ["protoc-linux-x86_64.exe"],
- "//third_party:piii": ["protoc-linux-x86_32.exe"],
- "//third_party:freebsd": ["protoc-linux-x86_32.exe"],
- }),
-)
-
-java_import(
- name = "protobuf",
- jars = ["protobuf-java-3.0.0-beta-4.jar"],
-)
-
-# For bootstrapping JavaBuilder
-filegroup(
- name = "protobuf-jars",
- srcs = ["protobuf-java-3.0.0-beta-4.jar"],
-)
+proto_alias("protoc", PROTOBUF_VERSION)
-py_library(
- name = "protobuf_python_srcs",
- srcs = glob(
- [
- "python/google/protobuf/*.py",
- "python/google/protobuf/**/*.py",
- ],
- ),
- imports = ["python"],
-)
+proto_alias("protobuf", PROTOBUF_VERSION)
-py_proto_library(
- name = "protobuf_python",
- srcs = [
- "src/google/protobuf/any.proto",
- "src/google/protobuf/api.proto",
- "src/google/protobuf/compiler/plugin.proto",
- "src/google/protobuf/descriptor.proto",
- "src/google/protobuf/duration.proto",
- "src/google/protobuf/empty.proto",
- "src/google/protobuf/field_mask.proto",
- "src/google/protobuf/source_context.proto",
- "src/google/protobuf/struct.proto",
- "src/google/protobuf/timestamp.proto",
- "src/google/protobuf/type.proto",
- "src/google/protobuf/wrappers.proto",
- ],
- include = "src",
- default_runtime = "",
- protoc = ":protoc",
- py_libs = [
- ":protobuf_python_srcs",
- "//third_party/py/six",
- ],
- srcs_version = "PY2AND3",
-)
+proto_alias("protobuf-jars", PROTOBUF_VERSION)
-COPTS = [
- "-DHAVE_PTHREAD",
- "-w",
-]
+proto_alias("protobuf_python_srcs", PROTOBUF_VERSION)
-LINK_OPTS = ["-lpthread"]
+proto_alias("protobuf_python", PROTOBUF_VERSION)
-cc_library(
- name = "protobuf_lite",
- srcs = [
- # AUTOGEN(protobuf_lite_srcs)
- "src/google/protobuf/arena.cc",
- "src/google/protobuf/arenastring.cc",
- "src/google/protobuf/extension_set.cc",
- "src/google/protobuf/generated_message_util.cc",
- "src/google/protobuf/io/coded_stream.cc",
- "src/google/protobuf/io/zero_copy_stream.cc",
- "src/google/protobuf/io/zero_copy_stream_impl_lite.cc",
- "src/google/protobuf/message_lite.cc",
- "src/google/protobuf/repeated_field.cc",
- "src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc",
- "src/google/protobuf/stubs/atomicops_internals_x86_msvc.cc",
- "src/google/protobuf/stubs/bytestream.cc",
- "src/google/protobuf/stubs/common.cc",
- "src/google/protobuf/stubs/int128.cc",
- "src/google/protobuf/stubs/once.cc",
- "src/google/protobuf/stubs/status.cc",
- "src/google/protobuf/stubs/statusor.cc",
- "src/google/protobuf/stubs/stringpiece.cc",
- "src/google/protobuf/stubs/stringprintf.cc",
- "src/google/protobuf/stubs/structurally_valid.cc",
- "src/google/protobuf/stubs/strutil.cc",
- "src/google/protobuf/stubs/time.cc",
- "src/google/protobuf/wire_format_lite.cc",
- ],
- hdrs = glob(["src/google/protobuf/**/*.h"]),
- copts = COPTS,
- includes = ["src/"],
- linkopts = LINK_OPTS,
- visibility = ["//visibility:public"],
-)
+proto_alias("protobuf_lite", PROTOBUF_VERSION)
-cc_library(
- name = "protobuf_clib",
- srcs = [
- # AUTOGEN(protobuf_srcs)
- "src/google/protobuf/any.cc",
- "src/google/protobuf/any.pb.cc",
- "src/google/protobuf/api.pb.cc",
- "src/google/protobuf/compiler/importer.cc",
- "src/google/protobuf/compiler/parser.cc",
- "src/google/protobuf/descriptor.cc",
- "src/google/protobuf/descriptor.pb.cc",
- "src/google/protobuf/descriptor_database.cc",
- "src/google/protobuf/duration.pb.cc",
- "src/google/protobuf/dynamic_message.cc",
- "src/google/protobuf/empty.pb.cc",
- "src/google/protobuf/extension_set_heavy.cc",
- "src/google/protobuf/field_mask.pb.cc",
- "src/google/protobuf/generated_message_reflection.cc",
- "src/google/protobuf/io/gzip_stream.cc",
- "src/google/protobuf/io/printer.cc",
- "src/google/protobuf/io/strtod.cc",
- "src/google/protobuf/io/tokenizer.cc",
- "src/google/protobuf/io/zero_copy_stream_impl.cc",
- "src/google/protobuf/map_field.cc",
- "src/google/protobuf/message.cc",
- "src/google/protobuf/reflection_ops.cc",
- "src/google/protobuf/service.cc",
- "src/google/protobuf/source_context.pb.cc",
- "src/google/protobuf/struct.pb.cc",
- "src/google/protobuf/stubs/mathlimits.cc",
- "src/google/protobuf/stubs/substitute.cc",
- "src/google/protobuf/text_format.cc",
- "src/google/protobuf/timestamp.pb.cc",
- "src/google/protobuf/type.pb.cc",
- "src/google/protobuf/unknown_field_set.cc",
- "src/google/protobuf/util/field_comparator.cc",
- "src/google/protobuf/util/field_mask_util.cc",
- "src/google/protobuf/util/internal/datapiece.cc",
- "src/google/protobuf/util/internal/default_value_objectwriter.cc",
- "src/google/protobuf/util/internal/error_listener.cc",
- "src/google/protobuf/util/internal/field_mask_utility.cc",
- "src/google/protobuf/util/internal/json_escaping.cc",
- "src/google/protobuf/util/internal/json_objectwriter.cc",
- "src/google/protobuf/util/internal/json_stream_parser.cc",
- "src/google/protobuf/util/internal/object_writer.cc",
- "src/google/protobuf/util/internal/proto_writer.cc",
- "src/google/protobuf/util/internal/protostream_objectsource.cc",
- "src/google/protobuf/util/internal/protostream_objectwriter.cc",
- "src/google/protobuf/util/internal/type_info.cc",
- "src/google/protobuf/util/internal/type_info_test_helper.cc",
- "src/google/protobuf/util/internal/utility.cc",
- "src/google/protobuf/util/json_util.cc",
- "src/google/protobuf/util/message_differencer.cc",
- "src/google/protobuf/util/time_util.cc",
- "src/google/protobuf/util/type_resolver_util.cc",
- "src/google/protobuf/wire_format.cc",
- "src/google/protobuf/wrappers.pb.cc",
- ],
- hdrs = glob(["src/**/*.h"]),
- copts = COPTS,
- includes = ["src/"],
- linkopts = LINK_OPTS,
- visibility = ["//visibility:public"],
- deps = [":protobuf_lite"],
-)
+proto_alias("protobuf_clib", PROTOBUF_VERSION)
-cc_library(
- name = "protoc_lib",
- srcs = [
- # AUTOGEN(protoc_lib_srcs)
- "src/google/protobuf/compiler/code_generator.cc",
- "src/google/protobuf/compiler/command_line_interface.cc",
- "src/google/protobuf/compiler/cpp/cpp_enum.cc",
- "src/google/protobuf/compiler/cpp/cpp_enum_field.cc",
- "src/google/protobuf/compiler/cpp/cpp_extension.cc",
- "src/google/protobuf/compiler/cpp/cpp_field.cc",
- "src/google/protobuf/compiler/cpp/cpp_file.cc",
- "src/google/protobuf/compiler/cpp/cpp_generator.cc",
- "src/google/protobuf/compiler/cpp/cpp_helpers.cc",
- "src/google/protobuf/compiler/cpp/cpp_map_field.cc",
- "src/google/protobuf/compiler/cpp/cpp_message.cc",
- "src/google/protobuf/compiler/cpp/cpp_message_field.cc",
- "src/google/protobuf/compiler/cpp/cpp_primitive_field.cc",
- "src/google/protobuf/compiler/cpp/cpp_service.cc",
- "src/google/protobuf/compiler/cpp/cpp_string_field.cc",
- "src/google/protobuf/compiler/csharp/csharp_doc_comment.cc",
- "src/google/protobuf/compiler/csharp/csharp_enum.cc",
- "src/google/protobuf/compiler/csharp/csharp_enum_field.cc",
- "src/google/protobuf/compiler/csharp/csharp_field_base.cc",
- "src/google/protobuf/compiler/csharp/csharp_generator.cc",
- "src/google/protobuf/compiler/csharp/csharp_helpers.cc",
- "src/google/protobuf/compiler/csharp/csharp_map_field.cc",
- "src/google/protobuf/compiler/csharp/csharp_message.cc",
- "src/google/protobuf/compiler/csharp/csharp_message_field.cc",
- "src/google/protobuf/compiler/csharp/csharp_primitive_field.cc",
- "src/google/protobuf/compiler/csharp/csharp_reflection_class.cc",
- "src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc",
- "src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc",
- "src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc",
- "src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc",
- "src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc",
- "src/google/protobuf/compiler/java/java_context.cc",
- "src/google/protobuf/compiler/java/java_doc_comment.cc",
- "src/google/protobuf/compiler/java/java_enum.cc",
- "src/google/protobuf/compiler/java/java_enum_field.cc",
- "src/google/protobuf/compiler/java/java_enum_field_lite.cc",
- "src/google/protobuf/compiler/java/java_enum_lite.cc",
- "src/google/protobuf/compiler/java/java_extension.cc",
- "src/google/protobuf/compiler/java/java_field.cc",
- "src/google/protobuf/compiler/java/java_file.cc",
- "src/google/protobuf/compiler/java/java_generator.cc",
- "src/google/protobuf/compiler/java/java_generator_factory.cc",
- "src/google/protobuf/compiler/java/java_helpers.cc",
- "src/google/protobuf/compiler/java/java_lazy_message_field.cc",
- "src/google/protobuf/compiler/java/java_lazy_message_field_lite.cc",
- "src/google/protobuf/compiler/java/java_map_field.cc",
- "src/google/protobuf/compiler/java/java_map_field_lite.cc",
- "src/google/protobuf/compiler/java/java_message.cc",
- "src/google/protobuf/compiler/java/java_message_builder.cc",
- "src/google/protobuf/compiler/java/java_message_builder_lite.cc",
- "src/google/protobuf/compiler/java/java_message_field.cc",
- "src/google/protobuf/compiler/java/java_message_field_lite.cc",
- "src/google/protobuf/compiler/java/java_message_lite.cc",
- "src/google/protobuf/compiler/java/java_name_resolver.cc",
- "src/google/protobuf/compiler/java/java_primitive_field.cc",
- "src/google/protobuf/compiler/java/java_primitive_field_lite.cc",
- "src/google/protobuf/compiler/java/java_service.cc",
- "src/google/protobuf/compiler/java/java_shared_code_generator.cc",
- "src/google/protobuf/compiler/java/java_string_field.cc",
- "src/google/protobuf/compiler/java/java_string_field_lite.cc",
- "src/google/protobuf/compiler/javanano/javanano_enum.cc",
- "src/google/protobuf/compiler/javanano/javanano_enum_field.cc",
- "src/google/protobuf/compiler/javanano/javanano_extension.cc",
- "src/google/protobuf/compiler/javanano/javanano_field.cc",
- "src/google/protobuf/compiler/javanano/javanano_file.cc",
- "src/google/protobuf/compiler/javanano/javanano_generator.cc",
- "src/google/protobuf/compiler/javanano/javanano_helpers.cc",
- "src/google/protobuf/compiler/javanano/javanano_map_field.cc",
- "src/google/protobuf/compiler/javanano/javanano_message.cc",
- "src/google/protobuf/compiler/javanano/javanano_message_field.cc",
- "src/google/protobuf/compiler/javanano/javanano_primitive_field.cc",
- "src/google/protobuf/compiler/js/js_generator.cc",
- "src/google/protobuf/compiler/objectivec/objectivec_enum.cc",
- "src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc",
- "src/google/protobuf/compiler/objectivec/objectivec_extension.cc",
- "src/google/protobuf/compiler/objectivec/objectivec_field.cc",
- "src/google/protobuf/compiler/objectivec/objectivec_file.cc",
- "src/google/protobuf/compiler/objectivec/objectivec_generator.cc",
- "src/google/protobuf/compiler/objectivec/objectivec_helpers.cc",
- "src/google/protobuf/compiler/objectivec/objectivec_map_field.cc",
- "src/google/protobuf/compiler/objectivec/objectivec_message.cc",
- "src/google/protobuf/compiler/objectivec/objectivec_message_field.cc",
- "src/google/protobuf/compiler/objectivec/objectivec_oneof.cc",
- "src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc",
- "src/google/protobuf/compiler/plugin.cc",
- "src/google/protobuf/compiler/plugin.pb.cc",
- "src/google/protobuf/compiler/python/python_generator.cc",
- "src/google/protobuf/compiler/ruby/ruby_generator.cc",
- "src/google/protobuf/compiler/subprocess.cc",
- "src/google/protobuf/compiler/zip_writer.cc",
- ],
- copts = COPTS,
- includes = ["src/"],
- linkopts = LINK_OPTS,
- visibility = ["//visibility:public"],
- deps = [":protobuf_clib"],
-)
+proto_alias("protoc_lib", PROTOBUF_VERSION)
diff --git a/third_party/protobuf/README.md b/third_party/protobuf/README.md
index 0c7627c8d0..f5e0cd3919 100644
--- a/third_party/protobuf/README.md
+++ b/third_party/protobuf/README.md
@@ -2,12 +2,9 @@
1. Go to http://search.maven.org/
2. Search for g:"com.google.protobuf"
-3. Download the "jar" link from protobuf-java.
-4. Download all binaries from "protoc".
-5. Strip version number from protoc files: for `i in *.exe; do mv $i $(echo $i | sed s/3.0.0-beta-2-//); done`
-6. Set executable bit: `chmod +x *.exe`
-7. Update `third_party/BUILD` to point to the new jar file.
-8. Done.
+3. Download the "jar" link from protobuf-java and put them in `<Bazel tree>/third_party/protobuf/<version>`
+4. Download all binaries from "protoc" and put them in `<Bazel tree>/third_party/protobuf/<version>`
+5. Set executable bit: `chmod +x *.exe`
* * *
### Updating the Linux 64-bit proto compiler
@@ -20,7 +17,7 @@ the following steps on an x86_64 machine:
4. `LDFLAGS=-static ./configure`
5. Change `LDFLAGS = -static` to `LDFLAGS = -all-static` in `src/Makefile`.
6. `make`
-7. `cp src/protoc <Bazel tree>/third_party/protobuf/protoc-linux-x86_64.exe` .
+7. `cp src/protoc <Bazel tree>/third_party/protobuf/<version>/protoc-<version>-linux-x86_64.exe` .
* * *
### Updating the MinGW proto compiler (64-bit)
@@ -37,6 +34,7 @@ a Windows machine.
2. Close all other MSYS/MinGW/Cygwin windows. Kill all running background jobs.
This step is optional, but if you have other terminal windows open the next
step may print some error messages (though it still seems to work).
+
3. Install necessary MinGW packages
```sh
@@ -62,10 +60,19 @@ a Windows machine.
1. `git clone http://github.com/google/protobuf.git`
2. `git checkout <tag or commithash>` (e.g. `v3.0.0` or `e8ae137`)
-2. `mkdir -p third_party/protobuf/src/google` in the root of the Bazel tree.
-3. `cp -R <root of protobuf tree>/src/google/protobuf third_party/protobuf/src/google`
-4. Update rules in `third_party/protobuf/BUILD` with the rules in the protobuf repository.
-5. Done.
+3. `mkdir -p third_party/protobuf/<version>/src/google` in the root of the Bazel tree.
+4. `cp -R <root of protobuf tree>/src/google/protobuf third_party/protobuf/src/google`
+5. Update the rules in `third_party/protobuf/BUILD` with the rules in the protobuf repository.
+
+Finally, update the rules:
+
+1. Add a BUILD file to `third_party/protobuf/<version>/`. Use the BUILD file
+ for the previous version as a template. Update the `cc_library` rules to
+ match the rules in the BUILD file in the protobuf repository. Also copy
+ `protobuf.bzl` from the protobuf repository into
+ `third_party/protobuf/<version>/`.
+2. Modify `third_party/protobuf/BUILD` to point to the new rules.
+3. Delete the old version of protobuf.
* * *
### Updating anything else in the directory
diff --git a/third_party/protobuf/proto_alias.bzl b/third_party/protobuf/proto_alias.bzl
new file mode 100644
index 0000000000..e47728f96d
--- /dev/null
+++ b/third_party/protobuf/proto_alias.bzl
@@ -0,0 +1,18 @@
+# Copyright 2016 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+def proto_alias(name, version):
+ native.alias(
+ name = name,
+ actual = "//third_party/protobuf/" + version + ":" + name)