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