-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Bazel If you prefer to use Bazel: ``` (With Bazel v0.4.5 or above.) $ bazel build :hello-world-server :hello-world-client $ # Run the server: $ bazel-bin/hello-world-server $ # In another terminal run the client $ bazel-bin/hello-world-client ```
- Loading branch information
1 parent
8f75f8e
commit 36f7b34
Showing
4 changed files
with
128 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ target | |
|
||
# Bazel | ||
bazel-bin | ||
bazel-examples | ||
bazel-genfiles | ||
bazel-grpc-java | ||
bazel-out | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
load("@grpc_java//:java_grpc_library.bzl", "java_grpc_library") | ||
|
||
proto_library( | ||
name = "helloworld_proto", | ||
srcs = ["src/main/proto/helloworld.proto"], | ||
) | ||
|
||
java_proto_library( | ||
name = "helloworld_java_proto", | ||
deps = [":helloworld_proto"], | ||
) | ||
|
||
java_grpc_library( | ||
name = "helloworld_java_grpc", | ||
srcs = [":helloworld_proto"], | ||
deps = [":helloworld_java_proto"], | ||
) | ||
|
||
proto_library( | ||
name = "route_guide_proto", | ||
srcs = ["src/main/proto/route_guide.proto"], | ||
) | ||
|
||
java_proto_library( | ||
name = "route_guide_java_proto", | ||
deps = [":route_guide_proto"], | ||
) | ||
|
||
java_grpc_library( | ||
name = "route_guide_java_grpc", | ||
srcs = [":route_guide_proto"], | ||
deps = [":route_guide_java_proto"], | ||
) | ||
|
||
java_library( | ||
name = "examples", | ||
testonly = 1, | ||
srcs = glob( | ||
["src/main/java/**/*.java"], | ||
), | ||
resources = glob( | ||
["src/main/resources/**"], | ||
), | ||
deps = [ | ||
":helloworld_java_grpc", | ||
":helloworld_java_proto", | ||
":route_guide_java_grpc", | ||
":route_guide_java_proto", | ||
"@com_google_api_grpc_google_common_protos//jar", | ||
"@com_google_code_findbugs_jsr305//jar", | ||
"@com_google_guava//jar", | ||
"@com_google_protobuf//:protobuf_java_util", | ||
"@com_google_protobuf_java//:protobuf_java", | ||
"@grpc_java//protobuf", | ||
"@grpc_java//core", | ||
"@grpc_java//stub", | ||
], | ||
) | ||
|
||
java_binary( | ||
name = "hello-world-client", | ||
testonly = 1, | ||
main_class = "io.grpc.examples.helloworld.HelloWorldClient", | ||
runtime_deps = [ | ||
":examples", | ||
"@grpc_java//netty", | ||
], | ||
) | ||
|
||
java_binary( | ||
name = "hello-world-server", | ||
testonly = 1, | ||
main_class = "io.grpc.examples.helloworld.HelloWorldServer", | ||
runtime_deps = [ | ||
":examples", | ||
"@grpc_java//netty", | ||
], | ||
) | ||
|
||
java_binary( | ||
name = "route-guide-client", | ||
testonly = 1, | ||
main_class = "io.grpc.examples.routeguide.RouteGuideClient", | ||
runtime_deps = [ | ||
":examples", | ||
"@grpc_java//netty", | ||
], | ||
) | ||
|
||
java_binary( | ||
name = "route-guide-server", | ||
testonly = 1, | ||
main_class = "io.grpc.examples.routeguide.RouteGuideServer", | ||
runtime_deps = [ | ||
":examples", | ||
"@grpc_java//netty", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
workspace(name = "examples") | ||
|
||
# For released versions, use the tagged git-repository: | ||
# git_repository( | ||
# name = "grpc_java", | ||
# remote = "https://github.com/grpc/grpc-java.git", | ||
# tag = "<TAG>", | ||
# ) | ||
local_repository( | ||
name = "grpc_java", | ||
path = "..", | ||
) | ||
|
||
load("@grpc_java//:repositories.bzl", "grpc_java_repositories") | ||
|
||
grpc_java_repositories() | ||
|