aboutsummaryrefslogtreecommitdiffhomepage
path: root/third_party/protobuf
diff options
context:
space:
mode:
authorGravatar Damien Martin-Guillerez <dmarting@google.com>2016-12-21 18:29:04 +0100
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2016-12-21 18:29:04 +0100
commitf1ce35f4691fa5cd8849bf8944d1a4bdd2393690 (patch)
tree8687d77030d82048b53612e0bce816555dd46dd2 /third_party/protobuf
parentb649428620711c12ba18f7f1477d36742f267a31 (diff)
Commit 6d31cb was an internal reorganization of google repository that should have resulted in no change. Due to a bug in our export process it deleted several files in third_party.
Diffstat (limited to 'third_party/protobuf')
-rw-r--r--third_party/protobuf/3.0.0/BUILD316
-rw-r--r--third_party/protobuf/3.0.0/com_google_protobuf_java.BUILD11
-rw-r--r--third_party/protobuf/BUILD33
-rw-r--r--third_party/protobuf/README.md28
-rw-r--r--third_party/protobuf/proto_alias.bzl18
5 files changed, 406 insertions, 0 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..5260df61c3
--- /dev/null
+++ b/third_party/protobuf/3.0.0/BUILD
@@ -0,0 +1,316 @@
+package(default_visibility = ["//visibility:public"])
+
+licenses(["notice"])
+
+load("//third_party/protobuf/3.0.0: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__"],
+)
+
+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 = "protobuf_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 = select({
+ "//src:freebsd": [
+ "-lpthread",
+ "-lm",
+ ],
+ "//conditions:default": ["-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"],
+)
+
+proto_lang_toolchain(
+ name = "java_toolchain",
+ command_line = "--java_out=shared,immutable:$(OUT)",
+ runtime = ":protobuf",
+)
+
+cc_binary(
+ name = "protoc",
+ srcs = ["src/google/protobuf/compiler/main.cc"],
+ linkopts = LINK_OPTS,
+ visibility = ["//visibility:public"],
+ deps = [":protoc_lib"],
+)
diff --git a/third_party/protobuf/3.0.0/com_google_protobuf_java.BUILD b/third_party/protobuf/3.0.0/com_google_protobuf_java.BUILD
new file mode 100644
index 0000000000..fe8e3f0fcb
--- /dev/null
+++ b/third_party/protobuf/3.0.0/com_google_protobuf_java.BUILD
@@ -0,0 +1,11 @@
+java_import(
+ name = "protobuf",
+ jars = ["protobuf-java-3.0.0.jar"],
+)
+
+proto_lang_toolchain(
+ name = "java_toolchain",
+ command_line = "--java_out=shared,immutable:$(OUT)",
+ runtime = ":protobuf",
+ visibility = ["//visibility:public"],
+)
diff --git a/third_party/protobuf/BUILD b/third_party/protobuf/BUILD
new file mode 100644
index 0000000000..f6e1ea9fda
--- /dev/null
+++ b/third_party/protobuf/BUILD
@@ -0,0 +1,33 @@
+package(default_visibility = ["//visibility:public"])
+
+licenses(["notice"])
+
+load(":proto_alias.bzl", "proto_alias")
+
+PROTOBUF_VERSION = "3.0.0"
+
+filegroup(
+ name = "srcs",
+ srcs = [
+ "//third_party/protobuf/" + PROTOBUF_VERSION + ":srcs",
+ ] + glob(["**"]), # glob everything to satisfy the compile.sh srcs test
+ visibility = ["//third_party:__pkg__"],
+)
+
+proto_alias("protoc", PROTOBUF_VERSION)
+
+proto_alias("protobuf", PROTOBUF_VERSION)
+
+proto_alias("protobuf-jars", PROTOBUF_VERSION)
+
+proto_alias("protobuf_python_srcs", PROTOBUF_VERSION)
+
+proto_alias("protobuf_python", PROTOBUF_VERSION)
+
+proto_alias("protobuf_lite", PROTOBUF_VERSION)
+
+proto_alias("protobuf_clib", PROTOBUF_VERSION)
+
+proto_alias("protoc_lib", PROTOBUF_VERSION)
+
+proto_alias("java_toolchain", PROTOBUF_VERSION)
diff --git a/third_party/protobuf/README.md b/third_party/protobuf/README.md
new file mode 100644
index 0000000000..367d542d06
--- /dev/null
+++ b/third_party/protobuf/README.md
@@ -0,0 +1,28 @@
+### Updating the jar binary
+
+1. Go to http://search.maven.org/
+2. Search for g:"com.google.protobuf"
+3. Download the "jar" link from protobuf-java and put them in `<Bazel tree>/third_party/protobuf/<version>`
+
+* * *
+### Updating `protobuf.bzl` and the `src/` directory:
+
+1. `git clone http://github.com/google/protobuf.git`
+2. `git checkout <tag or commithash>` (e.g. `v3.0.0` or `e8ae137`)
+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
+Follow usual procedure as described on https://www.bazel.build/contributing.html
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)