diff --git a/buildscripts/kokoro/bazel.sh b/buildscripts/kokoro/bazel.sh index 13bbaa4bf1..56133d967d 100755 --- a/buildscripts/kokoro/bazel.sh +++ b/buildscripts/kokoro/bazel.sh @@ -7,4 +7,9 @@ cd github/grpc-java bazel build ... cd examples +bazel clean +bazel build ... + +cd example-alts +bazel clean bazel build ... diff --git a/examples/BUILD.bazel b/examples/BUILD.bazel index 196c7655cb..6a006735c8 100644 --- a/examples/BUILD.bazel +++ b/examples/BUILD.bazel @@ -72,7 +72,6 @@ java_library( "@com_google_j2objc_j2objc_annotations//jar", "@com_google_protobuf//:protobuf_java", "@com_google_protobuf//:protobuf_java_util", - "@io_grpc_grpc_java//alts", "@io_grpc_grpc_java//core", "@io_grpc_grpc_java//netty", "@io_grpc_grpc_java//protobuf", @@ -99,28 +98,6 @@ java_binary( ], ) -java_binary( - name = "hello-world-alts-client", - testonly = 1, - main_class = "io.grpc.examples.alts.HelloWorldAltsClient", - runtime_deps = [ - ":examples", - "@io_grpc_grpc_java//alts", - "@io_grpc_grpc_java//netty", - ], -) - -java_binary( - name = "hello-world-alts-server", - testonly = 1, - main_class = "io.grpc.examples.alts.HelloWorldAltsServer", - runtime_deps = [ - ":examples", - "@io_grpc_grpc_java//alts", - "@io_grpc_grpc_java//netty", - ], -) - java_binary( name = "route-guide-client", testonly = 1, diff --git a/examples/example-alts/BUILD.bazel b/examples/example-alts/BUILD.bazel new file mode 100644 index 0000000000..8f747ff992 --- /dev/null +++ b/examples/example-alts/BUILD.bazel @@ -0,0 +1,53 @@ +load("@io_grpc_grpc_java//:java_grpc_library.bzl", "java_grpc_library") + +proto_library( + name = "helloworld_proto", + srcs = ["src/main/proto/helloworld/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"], +) + +java_library( + name = "example-alts", + testonly = 1, + srcs = glob( + ["src/main/java/**/*.java"], + ), + deps = [ + ":helloworld_java_grpc", + ":helloworld_java_proto", + "@io_grpc_grpc_java//alts", + "@io_grpc_grpc_java//core", + "@io_grpc_grpc_java//protobuf", + "@io_grpc_grpc_java//stub", + ], +) + +java_binary( + name = "hello-world-alts-client", + testonly = 1, + main_class = "io.grpc.examples.alts.HelloWorldAltsClient", + runtime_deps = [ + ":example-alts", + "@io_grpc_grpc_java//netty", + ], +) + +java_binary( + name = "hello-world-alts-server", + testonly = 1, + main_class = "io.grpc.examples.alts.HelloWorldAltsServer", + runtime_deps = [ + ":example-alts", + "@io_grpc_grpc_java//netty", + ], +) diff --git a/examples/example-alts/WORKSPACE b/examples/example-alts/WORKSPACE new file mode 100644 index 0000000000..11ac4e3765 --- /dev/null +++ b/examples/example-alts/WORKSPACE @@ -0,0 +1,16 @@ +workspace(name = "example_alts") + +# For released versions, use the tagged git-repository: +# git_repository( +# name = "io_grpc_grpc_java", +# remote = "https://github.com/grpc/grpc-java.git", +# tag = "", +# ) +local_repository( + name = "io_grpc_grpc_java", + path = "../..", +) + +load("@io_grpc_grpc_java//:repositories.bzl", "grpc_java_repositories") + +grpc_java_repositories() diff --git a/examples/pom.xml b/examples/pom.xml index 9ab6f6bca5..ec50bed6fb 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -35,11 +35,6 @@ grpc-stub ${grpc.version} - - io.grpc - grpc-alts - ${grpc.version} - javax.annotation javax.annotation-api