Grpc bazel build support (#273)
* WORKSPACE and BUILD for bazel support * added google/protobuf BUILD file and protos * more cleanup * added bazel support to readme * removed local copy of .bzl files Using the grpc's bzl files Cleaned up WORKSPACE Formated BUILD files * removed local copy of google/protobuf Modified grpc skylark files to use protobuf submodule's copies of the well known protos.
This commit is contained in:
parent
ca97f8c75f
commit
e15b9f0790
|
|
@ -0,0 +1,12 @@
|
|||
[submodule "third_party/protobuf"]
|
||||
path = third_party/protobuf
|
||||
url = https://github.com/google/protobuf
|
||||
[submodule "third_party/zlib"]
|
||||
path = third_party/zlib
|
||||
url = https://github.com/makdharma/zlib
|
||||
[submodule "third_party/boringssl-with-bazel"]
|
||||
path = third_party/boringssl-with-bazel
|
||||
url = https://boringssl.googlesource.com/boringssl
|
||||
[submodule "third_party/nanopb"]
|
||||
path = third_party/nanopb
|
||||
url = https://github.com/nanopb/nanopb
|
||||
|
|
@ -67,6 +67,11 @@ entire repository. It is not for generating linkable client library
|
|||
for a specific API. Please see other repositories under
|
||||
https://github.com/googleapis for generating linkable client libraries.
|
||||
|
||||
### Using bazel with gRPC
|
||||
Bazel build now works for a subset of the repository. You can use build
|
||||
targets from this repo as dependency into your grpc code. For example,
|
||||
this works: ```bazel build //google/monitoring/v3:metric_service```
|
||||
|
||||
### Go gRPC Source Code
|
||||
It is difficult to generate Go gRPC source code from this repository,
|
||||
since Go has different directory structure.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,73 @@
|
|||
# nanopb
|
||||
bind(
|
||||
name = "nanopb",
|
||||
actual = "//third_party/nanopb",
|
||||
)
|
||||
|
||||
# Boringssl
|
||||
bind(
|
||||
name = "libssl",
|
||||
actual = "@submodule_boringssl//:ssl",
|
||||
)
|
||||
|
||||
new_local_repository(
|
||||
name = "submodule_boringssl",
|
||||
build_file = "third_party/boringssl-with-bazel/BUILD",
|
||||
path = "third_party/boringssl-with-bazel",
|
||||
)
|
||||
|
||||
# Zlib
|
||||
bind(
|
||||
name = "zlib",
|
||||
actual = "@submodule_zlib//:z",
|
||||
)
|
||||
|
||||
local_repository(
|
||||
name = "submodule_zlib",
|
||||
path = "third_party/zlib",
|
||||
)
|
||||
|
||||
# Protobuf
|
||||
bind(
|
||||
name = "protobuf",
|
||||
actual = "@submodule_protobuf//:protobuf",
|
||||
)
|
||||
|
||||
bind(
|
||||
name = "protobuf_clib",
|
||||
actual = "@submodule_protobuf//:protoc_lib",
|
||||
)
|
||||
|
||||
bind(
|
||||
name = "protocol_compiler",
|
||||
actual = "@submodule_protobuf//:protoc",
|
||||
)
|
||||
|
||||
new_local_repository(
|
||||
name = "submodule_protobuf",
|
||||
build_file = "third_party/protobuf/BUILD",
|
||||
path = "third_party/protobuf",
|
||||
)
|
||||
|
||||
# grpc
|
||||
bind(
|
||||
name = "grpc++",
|
||||
actual = "@submodule_grpc//:grpc++",
|
||||
)
|
||||
|
||||
bind(
|
||||
name = "grpc++_codegen_proto",
|
||||
actual = "@submodule_grpc//:grpc++_codegen_proto",
|
||||
)
|
||||
|
||||
bind(
|
||||
name = "grpc_cpp_plugin",
|
||||
actual = "@submodule_grpc//:grpc_cpp_plugin",
|
||||
)
|
||||
|
||||
git_repository(
|
||||
name = "submodule_grpc",
|
||||
remote = "https://github.com/grpc/grpc",
|
||||
# TODO(makdharma): replace with version when bazel file fix is released
|
||||
commit = "eb064ec7b81b60c5e1eb47d6124d0c05056b3097",
|
||||
)
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load("@submodule_grpc//bazel:grpc_build_system.bzl", "grpc_proto_library")
|
||||
|
||||
grpc_proto_library(
|
||||
name = "http",
|
||||
srcs = [
|
||||
"http.proto",
|
||||
],
|
||||
use_external = True,
|
||||
)
|
||||
|
||||
grpc_proto_library(
|
||||
name = "label",
|
||||
srcs = [
|
||||
"label.proto",
|
||||
],
|
||||
use_external = True,
|
||||
)
|
||||
|
||||
grpc_proto_library(
|
||||
name = "distribution",
|
||||
srcs = ["distribution.proto"],
|
||||
deps = [
|
||||
":annotations",
|
||||
],
|
||||
well_known_protos = "@submodule_protobuf//:well_known_protos",
|
||||
use_external = True,
|
||||
)
|
||||
|
||||
grpc_proto_library(
|
||||
name = "metric",
|
||||
srcs = ["metric.proto"],
|
||||
deps = [
|
||||
"//google/api:label",
|
||||
],
|
||||
use_external = True,
|
||||
)
|
||||
|
||||
grpc_proto_library(
|
||||
name = "annotations",
|
||||
srcs = ["annotations.proto"],
|
||||
deps = [
|
||||
":http",
|
||||
],
|
||||
well_known_protos = "@submodule_protobuf//:well_known_protos",
|
||||
use_external = True,
|
||||
)
|
||||
|
||||
grpc_proto_library(
|
||||
name = "monitored_resource",
|
||||
srcs = ["monitored_resource.proto"],
|
||||
deps = [
|
||||
":label",
|
||||
],
|
||||
use_external = True,
|
||||
)
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load("@submodule_grpc//bazel:grpc_build_system.bzl", "grpc_proto_library")
|
||||
|
||||
grpc_proto_library(name = "metric",
|
||||
srcs = ["metric.proto"],
|
||||
deps = [
|
||||
"//google/api:metric",
|
||||
"//google/api:monitored_resource",
|
||||
":common",
|
||||
],
|
||||
well_known_protos = "@submodule_protobuf//:well_known_protos",
|
||||
use_external = True,
|
||||
)
|
||||
|
||||
grpc_proto_library(
|
||||
name = "common",
|
||||
srcs = ["common.proto"],
|
||||
deps = [
|
||||
"//google/api:distribution",
|
||||
"//google/api:annotations",
|
||||
],
|
||||
well_known_protos = "@submodule_protobuf//:well_known_protos",
|
||||
use_external = True,
|
||||
)
|
||||
|
||||
grpc_proto_library(
|
||||
name = "metric_service",
|
||||
srcs = ["metric_service.proto"],
|
||||
deps = [
|
||||
"//google/api:annotations",
|
||||
"//google/api:metric",
|
||||
"//google/api:monitored_resource",
|
||||
"//google/api:label",
|
||||
"//google/rpc:status",
|
||||
":common",
|
||||
":metric",
|
||||
],
|
||||
well_known_protos = "@submodule_protobuf//:well_known_protos",
|
||||
use_external = True,
|
||||
)
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load("@submodule_grpc//bazel:grpc_build_system.bzl", "grpc_proto_library")
|
||||
|
||||
grpc_proto_library(
|
||||
name = "status",
|
||||
srcs = ["status.proto"],
|
||||
well_known_protos = "@submodule_protobuf//:well_known_protos",
|
||||
use_external = True,
|
||||
)
|
||||
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 886e7d75368e3f4fab3f4d0d3584e4abfc557755
|
||||
|
|
@ -0,0 +1 @@
|
|||
Subproject commit ac6405b4b8c7b3f449bd19bc3f8b84e6bc9fff77
|
||||
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 593e917c176b5bc5aafa57bf9f6030d749d91cd5
|
||||
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 8003d572d7a41438a37e58af14302c2c5928cdd5
|
||||
Loading…
Reference in New Issue