1// Copyright (C) 2023 The Android Open Source Project 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15package { 16 default_applicable_licenses: ["Android-Apache-2.0"], 17} 18 19cc_library { 20 name: "libecho_server", 21 shared_libs: [ 22 "libprotobuf-cpp-full", 23 "libgrpc++_unsecure", 24 ], 25 static_libs: [ 26 "libgflags", 27 ], 28 cflags: [ 29 "-Wno-unused-parameter", 30 ], 31 generated_headers: [ 32 "EchoServerProto_h", 33 ], 34 generated_sources: [ 35 "EchoServerProto_cc", 36 ], 37 export_generated_headers: [ 38 "EchoServerProto_h", 39 ], 40 defaults: ["cuttlefish_host"], 41 include_dirs: [ 42 "external/grpc-grpc/include", 43 "external/protobuf/src", 44 ], 45 target: { 46 darwin: { 47 enabled: true, 48 }, 49 }, 50} 51 52cc_binary_host { 53 name: "echo_server", 54 shared_libs: [ 55 "libprotobuf-cpp-full", 56 "libgrpc++_unsecure", 57 ], 58 static_libs: [ 59 "libcuttlefish_host_config", 60 "libgflags", 61 "libecho_server", 62 "libgrpc++_reflection", 63 ], 64 srcs: [ 65 "main.cpp", 66 ], 67 cflags: [ 68 "-Wno-unused-parameter", 69 ], 70 defaults: ["cuttlefish_host"], 71 target: { 72 darwin: { 73 enabled: true, 74 }, 75 }, 76} 77 78filegroup { 79 name: "EchoServerProto", 80 srcs: [ 81 "echo.proto", 82 ], 83} 84 85genrule { 86 name: "EchoServerProto_h", 87 tools: [ 88 "aprotoc", 89 "protoc-gen-grpc-cpp-plugin", 90 ], 91 cmd: "$(location aprotoc) -Idevice/google/cuttlefish/host/commands/echo_server -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(in) --grpc_out=$(genDir) --cpp_out=$(genDir)", 92 srcs: [ 93 ":EchoServerProto", 94 ], 95 out: [ 96 "echo.grpc.pb.h", 97 "echo.pb.h", 98 ], 99} 100 101genrule { 102 name: "EchoServerProto_cc", 103 tools: [ 104 "aprotoc", 105 "protoc-gen-grpc-cpp-plugin", 106 ], 107 cmd: "$(location aprotoc) -Idevice/google/cuttlefish/host/commands/echo_server -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(in) --grpc_out=$(genDir) --cpp_out=$(genDir)", 108 srcs: [ 109 ":EchoServerProto", 110 ], 111 out: [ 112 "echo.grpc.pb.cc", 113 "echo.pb.cc", 114 ], 115} 116