load("@grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library")
load("@protobuf//bazel:cc_proto_library.bzl", "cc_proto_library")
load("@protobuf//bazel:proto_library.bzl", "proto_library")
load("//cuttlefish/bazel:rules.bzl", "cf_cc_binary")

package(
    default_visibility = ["//:android_cuttlefish"],
)

proto_library(
    name = "echo_server_proto",
    srcs = ["echo.proto"],
)

cc_proto_library(
    name = "echo_server_cc_proto",
    deps = [":echo_server_proto"],
)

cc_grpc_library(
    name = "libecho_server",
    srcs = [":echo_server_proto"],
    grpc_only = True,
    deps = [
        ":echo_server_cc_proto",
        "@grpc//:grpc++",
    ],
)

cf_cc_binary(
    name = "echo_server",
    srcs = [
        "main.cpp",
    ],
    deps = [
        ":libecho_server",
        "@gflags",
        "@grpc",
        "@grpc//:grpc++",
        "@grpc//:grpc++_reflection",
    ],
)
