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: "libopenwrt_control_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        "OpenwrtControlServerProto_h",
33    ],
34    generated_sources: [
35        "OpenwrtControlServerProto_cc",
36    ],
37    export_generated_headers: [
38        "OpenwrtControlServerProto_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: "openwrt_control_server",
49    shared_libs: [
50        "libbase",
51        "libcuttlefish_utils",
52        "libcuttlefish_web",
53        "libprotobuf-cpp-full",
54        "libgrpc++_unsecure",
55    ],
56    static_libs: [
57        "libcuttlefish_host_config",
58        "libgflags",
59        "libjsoncpp",
60        "libopenwrt_control_server",
61        "libgrpc++_reflection",
62    ],
63    srcs: [
64        "main.cpp",
65    ],
66    cflags: [
67        "-Wno-unused-parameter",
68    ],
69    defaults: ["cuttlefish_host"],
70}
71
72filegroup {
73    name: "OpenwrtControlServerProto",
74    srcs: [
75        "openwrt_control.proto",
76        ":libprotobuf-internal-protos",
77    ],
78}
79
80genrule {
81    name: "OpenwrtControlServerProto_h",
82    tools: [
83        "aprotoc",
84        "protoc-gen-grpc-cpp-plugin",
85    ],
86    cmd: "$(location aprotoc) -Idevice/google/cuttlefish/host/commands/openwrt_control_server -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(in) --grpc_out=$(genDir) --cpp_out=$(genDir)",
87    srcs: [
88        ":OpenwrtControlServerProto",
89    ],
90    out: [
91        "openwrt_control.grpc.pb.h",
92        "openwrt_control.pb.h",
93    ],
94}
95
96genrule {
97    name: "OpenwrtControlServerProto_cc",
98    tools: [
99        "aprotoc",
100        "protoc-gen-grpc-cpp-plugin",
101    ],
102    cmd: "$(location aprotoc) -Idevice/google/cuttlefish/host/commands/openwrt_control_server -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(in) --grpc_out=$(genDir) --cpp_out=$(genDir)",
103    srcs: [
104        ":OpenwrtControlServerProto",
105    ],
106    out: [
107        "openwrt_control.grpc.pb.cc",
108        "openwrt_control.pb.cc",
109    ],
110}
111