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: "libcontrol_env_proxy_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        "ControlEnvProxyServerProto_h",
33    ],
34    generated_sources: [
35        "ControlEnvProxyServerProto_cc",
36    ],
37    export_generated_headers: [
38        "ControlEnvProxyServerProto_h",
39    ],
40    defaults: ["cuttlefish_host"],
41    include_dirs: [
42        "external/grpc-grpc/include",
43        "external/protobuf/src",
44    ],
45}
46
47cc_binary_host {
48    name: "control_env_proxy_server",
49    shared_libs: [
50        "libbase",
51        "libcuttlefish_utils",
52        "libprotobuf-cpp-full",
53        "libgrpc++",
54        "libjsoncpp",
55    ],
56    static_libs: [
57        "grpc_cli_libs",
58        "libabsl_host",
59        "libcuttlefish_control_env",
60        "libcuttlefish_host_config",
61        "libgflags",
62        "libcontrol_env_proxy_server",
63        "libgrpc++_reflection",
64    ],
65    srcs: [
66        "main.cpp",
67    ],
68    cflags: [
69        "-Wno-unused-parameter",
70    ],
71    defaults: ["cuttlefish_host"],
72}
73
74filegroup {
75    name: "ControlEnvProxyServerProto",
76    srcs: [
77        "control_env_proxy.proto",
78    ],
79}
80
81genrule {
82    name: "ControlEnvProxyServerProto_h",
83    tools: [
84        "aprotoc",
85        "protoc-gen-grpc-cpp-plugin",
86    ],
87    cmd: "$(location aprotoc) -Idevice/google/cuttlefish/host/commands/control_env_proxy_server -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(location :ControlEnvProxyServerProto) --grpc_out=$(genDir) --cpp_out=$(genDir)",
88    srcs: [
89        ":ControlEnvProxyServerProto",
90        ":libprotobuf-internal-protos",
91    ],
92    out: [
93        "control_env_proxy.grpc.pb.h",
94        "control_env_proxy.pb.h",
95    ],
96}
97
98genrule {
99    name: "ControlEnvProxyServerProto_cc",
100    tools: [
101        "aprotoc",
102        "protoc-gen-grpc-cpp-plugin",
103    ],
104    cmd: "$(location aprotoc) -Idevice/google/cuttlefish/host/commands/control_env_proxy_server -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(location :ControlEnvProxyServerProto) --grpc_out=$(genDir) --cpp_out=$(genDir)",
105    srcs: [
106        ":ControlEnvProxyServerProto",
107        ":libprotobuf-internal-protos",
108    ],
109    out: [
110        "control_env_proxy.grpc.pb.cc",
111        "control_env_proxy.pb.cc",
112    ],
113}
114