1// Copyright (C) 2020 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_static {
20    name: "android.hardware.automotive.vehicle@2.0-virtualization-utils",
21    vendor: true,
22    host_supported: true,
23    defaults: ["vhal_v2_0_defaults"],
24    srcs: [
25        "Utils.cpp",
26    ],
27    static_libs: [
28        "android.hardware.automotive.utils.vsockinfo",
29    ],
30    shared_libs: [
31        "libbase",
32    ],
33}
34
35cc_library_static {
36    name: "android.hardware.automotive.vehicle@2.0-grpc-trout",
37    vendor: true,
38    host_supported: true,
39    include_dirs: [
40        "external/protobuf/src",
41    ],
42    generated_headers: [
43        "DefaultVehicleHalProtoStub_h",
44        "VehicleServerProtoStub_h@2.0-grpc-trout",
45    ],
46    export_generated_headers: [
47        "DefaultVehicleHalProtoStub_h",
48        "VehicleServerProtoStub_h@2.0-grpc-trout",
49    ],
50    generated_sources: [
51        "DefaultVehicleHalProtoStub_cc",
52        "VehicleServerProtoStub_cc@2.0-grpc-trout",
53    ],
54    shared_libs: [
55        "libgrpc++_unsecure",
56    ],
57    cflags: [
58        "-Wno-unused-parameter",
59    ],
60}
61
62genrule {
63    name: "VehicleServerProtoStub_h@2.0-grpc-trout",
64    tools: [
65        "aprotoc",
66        "protoc-gen-grpc-cpp-plugin",
67    ],
68    cmd: "$(location aprotoc) -I$$(dirname $(location proto/VehicleServer.proto)) -Ihardware/interfaces/automotive/vehicle/proto -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(location proto/VehicleServer.proto) --grpc_out=$(genDir) --cpp_out=$(genDir)",
69    srcs: [
70        "proto/VehicleServer.proto",
71        ":vhal-proto-src",
72        ":libprotobuf-internal-protos",
73    ],
74    out: [
75        "VehicleServer.pb.h",
76        "VehicleServer.grpc.pb.h",
77    ],
78}
79
80genrule {
81    name: "VehicleServerProtoStub_cc@2.0-grpc-trout",
82    tools: [
83        "aprotoc",
84        "protoc-gen-grpc-cpp-plugin",
85    ],
86    cmd: "$(location aprotoc) -I$$(dirname $(location proto/VehicleServer.proto)) -Ihardware/interfaces/automotive/vehicle/proto -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(location proto/VehicleServer.proto) --grpc_out=$(genDir) --cpp_out=$(genDir)",
87    srcs: [
88        "proto/VehicleServer.proto",
89        ":vhal-proto-src",
90        ":libprotobuf-internal-protos",
91    ],
92    out: [
93        "VehicleServer.pb.cc",
94        "VehicleServer.grpc.pb.cc",
95    ],
96}
97
98cc_library_static {
99    name: "android.hardware.automotive.vehicle@2.0-virtualization-client-lib",
100    defaults: ["vhal_v2_0_target_defaults"],
101    vendor: true,
102    srcs: [
103        "GrpcVehicleClient.cpp",
104    ],
105    whole_static_libs: [
106        "android.hardware.automotive.utils.vsockinfo",
107        "android.hardware.automotive.vehicle@2.0-manager-lib",
108        "android.hardware.automotive.vehicle@2.0-default-impl-lib",
109        "android.hardware.automotive.vehicle@2.0-grpc-trout",
110        "android.hardware.automotive.vehicle@2.0-virtualization-utils",
111    ],
112    shared_libs: [
113        "libgrpc++",
114        "libprotobuf-cpp-full",
115    ],
116    export_include_dirs: ["."],
117    cflags: [
118        "-Wno-unused-parameter",
119    ],
120}
121
122cc_library_static {
123    name: "android.hardware.automotive.vehicle@2.0-virtualization-grpc-server-lib",
124    defaults: ["vhal_v2_0_defaults"],
125    host_supported: true,
126    vendor: true,
127    srcs: [
128        "GarageModeServerSideHandler.cpp",
129        "GrpcVehicleServer.cpp",
130        "PowerStateListener.cpp",
131    ],
132    whole_static_libs: [
133        "android.hardware.automotive.utils.vsockinfo",
134        "android.hardware.automotive.vehicle@2.0-grpc-trout",
135        "android.hardware.automotive.vehicle@2.0-server-impl-lib",
136        "android.hardware.automotive.vehicle@2.0-virtualization-utils",
137    ],
138    shared_libs: [
139        "libgrpc++",
140        "libprotobuf-cpp-full",
141    ],
142    export_include_dirs: ["."],
143    cflags: [
144        "-Wno-unused-parameter",
145    ],
146}
147
148cc_binary {
149    name: "android.hardware.automotive.vehicle@2.0-virtualization-service",
150    defaults: ["vhal_v2_0_target_defaults"],
151    init_rc: ["android.hardware.automotive.vehicle@2.0-virtualization-service.rc"],
152    vendor: true,
153    relative_install_path: "hw",
154    srcs: [
155        "VirtualizedVehicleService.cpp",
156    ],
157    shared_libs: [
158        "libbase",
159        "libcutils",
160        "libjsoncpp",
161        "libprotobuf-cpp-full",
162        "libgrpc++",
163    ],
164    static_libs: [
165        "android.hardware.automotive.vehicle@2.0-virtualization-client-lib",
166    ],
167    cflags: [
168        "-Wno-unused-parameter",
169    ],
170    vintf_fragments: ["manifest_android.hardware.automotive.vehicle@2.0-virtualization-service.xml"],
171}
172
173cc_binary {
174    name: "android.hardware.automotive.vehicle@2.0-virtualization-grpc-server",
175    init_rc: ["android.hardware.automotive.vehicle@2.0-virtualization-grpc-server.rc"],
176    defaults: ["vhal_v2_0_defaults"],
177    host_supported: true,
178    vendor: true,
179    srcs: [
180        "VirtualizationGrpcServer.cpp",
181    ],
182    shared_libs: [
183        "libbase",
184        "libjsoncpp",
185        "libprotobuf-cpp-full",
186        "libgrpc++",
187    ],
188    static_libs: [
189        "android.hardware.automotive.vehicle@2.0-virtualization-grpc-server-lib",
190    ],
191}
192