Skip to content

Commit

Permalink
Generate Java protos in BUILD
Browse files Browse the repository at this point in the history
1. Simplify WORKSPACE and BUILD files
2. Add a Java proto generator

See tensorflow#5
  • Loading branch information
kbsriram committed Dec 30, 2018
1 parent 8d5198a commit 425e0d1
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 47 deletions.
42 changes: 15 additions & 27 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,39 +1,27 @@
workspace(name = "tensorflow_metadata")
git_repository(
name = "protobuf_bzl",
# v3.4.0
commit = "80a37e0782d2d702d52234b62dd4b9ec74fd2c95",
remote = "https://github.com/google/protobuf.git",
)
bind(
name = "protobuf",
actual = "@protobuf_bzl//:protobuf",
)
bind(
name = "protobuf_python",
actual = "@protobuf_bzl//:protobuf_python",
)
bind(
name = "protobuf_python_genproto",
actual = "@protobuf_bzl//:protobuf_python_genproto",
)
bind(
name = "protoc",
actual = "@protobuf_bzl//:protoc",
)

# Using protobuf version 3.6.0
# We need to import the protobuf library under the name com_google_protobuf
# to enable proto_library support in bazel.
http_archive(
name = "protobuf_archive",
name = "com_google_protobuf",
strip_prefix = "protobuf-3.6.0",
urls = ["https://github.com/google/protobuf/archive/v3.6.0.zip"],
sha256 = "50a5753995b3142627ac55cfd496cebc418a2e575ca0236e29033c67bd5665f4",
urls = [
"https://mirror.bazel.build/github.com/google/protobuf/archive/v3.6.0.tar.gz",
"https://github.com/google/protobuf/archive/v3.6.0.tar.gz",
]
)

# required by protobuf_python
# required by @com_google_protobuf//:protobuf_python
new_http_archive(
name = "six_archive",
build_file = "@protobuf_bzl//:six.BUILD",
build_file = "@com_google_protobuf//:six.BUILD",
sha256 = "105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a5ad56a",
url = "https://pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz#md5=34eed507548117b2ab523ab14b2f8b55",
urls = [
"https://mirror.bazel.build/pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz",
"https://pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz",
],
)
bind(
name = "six",
Expand Down
39 changes: 19 additions & 20 deletions tensorflow_metadata/proto/v0/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,36 @@
# limitations under the License.
# ==============================================================================


licenses(["notice"]) # Apache 2.0

package(default_visibility = ["//visibility:public"])

load("@protobuf_archive//:protobuf.bzl", "cc_proto_library", "py_proto_library")
load("@com_google_protobuf//:protobuf.bzl", "py_proto_library")

METADATA_PROTO_SRCS = [
"anomalies.proto",
"path.proto",
"schema.proto",
"statistics.proto",
]

proto_library(
name = "metadata_v0_proto",
srcs = METADATA_PROTO_SRCS,
)

cc_proto_library(
name = "metadata_v0_proto_cc_pb2",
srcs = [
"anomalies.proto",
"path.proto",
"schema.proto",
"statistics.proto",
],
cc_libs = ["@protobuf_archive//:protobuf"],
default_runtime = "@protobuf_archive//:protobuf",
protoc = "@protobuf_archive//:protoc",
deps = [":metadata_v0_proto"],
)

py_proto_library(
name = "metadata_v0_proto_py_pb2",
srcs = [
"anomalies.proto",
"path.proto",
"schema.proto",
"statistics.proto",
],
default_runtime = "@protobuf_archive//:protobuf_python",
protoc = "@protobuf_archive//:protoc",
srcs = METADATA_PROTO_SRCS,
srcs_version = "PY2AND3",
deps = ["@protobuf_archive//:protobuf_python"],
)

java_proto_library(
name = "metadata_v0_proto_java_pb2",
deps = [":metadata_v0_proto"],
)

0 comments on commit 425e0d1

Please sign in to comment.