xref: /aosp_15_r20/hardware/interfaces/automotive/vehicle/aidl/impl/current/grpc/Android.bp (revision 4d7e907c777eeecc4c5bd7cf640a754fac206ff7)
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
19genrule {
20    name: "VehicleServerProtoStub_h@default-grpc",
21    tools: [
22        "aprotoc",
23        "protoc-gen-grpc-cpp-plugin",
24    ],
25    cmd: "$(location aprotoc) -I$$(dirname $(location proto/VehicleServer.proto)) -Ihardware/interfaces/automotive/vehicle/aidl/impl/current/proto -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(location proto/VehicleServer.proto) --grpc_opt=generate_mock_code=true --grpc_out=$(genDir) --cpp_out=$(genDir)",
26    srcs: [
27        "proto/VehicleServer.proto",
28        ":libprotobuf-internal-protos",
29        ":VehicleHalProtoFiles",
30    ],
31    out: [
32        "VehicleServer.pb.h",
33        "VehicleServer.grpc.pb.h",
34        "VehicleServer_mock.grpc.pb.h",
35    ],
36    visibility: ["//visibility:private"],
37}
38
39genrule {
40    name: "VehicleServerProtoStub_cc@default-grpc",
41    tools: [
42        "aprotoc",
43        "protoc-gen-grpc-cpp-plugin",
44    ],
45    cmd: "$(location aprotoc) -I$$(dirname $(location proto/VehicleServer.proto)) -Ihardware/interfaces/automotive/vehicle/aidl/impl/current/proto -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(location proto/VehicleServer.proto) --grpc_out=$(genDir) --cpp_out=$(genDir)",
46    srcs: [
47        "proto/VehicleServer.proto",
48        ":libprotobuf-internal-protos",
49        ":VehicleHalProtoFiles",
50    ],
51    out: [
52        "VehicleServer.pb.cc",
53        "VehicleServer.grpc.pb.cc",
54    ],
55    visibility: ["//visibility:private"],
56}
57
58cc_library_static {
59    name: "android.hardware.automotive.vehicle@default-grpc-libgrpc",
60    vendor: true,
61    host_supported: true,
62    include_dirs: [
63        "external/protobuf/src",
64    ],
65    generated_headers: [
66        "VehicleServerProtoStub_h@default-grpc",
67    ],
68    export_generated_headers: [
69        "VehicleServerProtoStub_h@default-grpc",
70    ],
71    generated_sources: [
72        "VehicleServerProtoStub_cc@default-grpc",
73    ],
74    whole_static_libs: [
75        "VehicleHalProtos",
76    ],
77    shared_libs: [
78        "libgrpc++",
79    ],
80    cflags: [
81        "-Wno-unused-parameter",
82    ],
83}
84
85cc_library_static {
86    name: "android.hardware.automotive.vehicle@default-grpc-hardware-lib",
87    defaults: ["VehicleHalDefaults"],
88    vendor: true,
89    srcs: [
90        "GRPCVehicleHardware.cpp",
91    ],
92    whole_static_libs: [
93        "android.hardware.automotive.vehicle@default-grpc-libgrpc",
94        "VehicleHalProtoMessageConverter",
95    ],
96    header_libs: [
97        "IVehicleHardware",
98    ],
99    shared_libs: [
100        "libgrpc++",
101        "libprotobuf-cpp-full",
102    ],
103    export_include_dirs: ["."],
104    cflags: [
105        "-Wno-unused-parameter",
106    ],
107}
108
109cc_library_static {
110    name: "android.hardware.automotive.vehicle@default-grpc-server-lib",
111    defaults: ["VehicleHalDefaults"],
112    vendor: true,
113    srcs: [
114        "GRPCVehicleProxyServer.cpp",
115    ],
116    whole_static_libs: [
117        "android.hardware.automotive.vehicle@default-grpc-libgrpc",
118        "VehicleHalProtoMessageConverter",
119    ],
120    header_libs: [
121        "IVehicleHardware",
122    ],
123    shared_libs: [
124        "libgrpc++",
125        "libprotobuf-cpp-full",
126    ],
127    export_include_dirs: ["."],
128    cflags: [
129        "-Wno-unused-parameter",
130    ],
131    host_supported: true,
132}
133